Top Banner
Programming 1 Lecture 1 COP 3014 Summer 2019 May 15, 2019
32

Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Aug 12, 2020

Download

Documents

dariahiddleston
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming 1

Lecture 1COP 3014 Summer 2019

May 15, 2019

Page 2: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming I - Course Information

I Instructor: Sharanya Jayaraman

I Teaching Faculty, PhD Candidate in Computer Science

I Research Interests: High Performance Computing, NumericalMethods, Computer Architecture

I Other Interests: Movies, Food, Spongebob

Page 3: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming I - Course Information

I Teaching Assistant: Ahana Roy choudhury

I PhD student

I Research Interests: Computer Vision, Deep Learning, MachineLearning and Recommendation Systems

I Other Interests: Music (flute), reading

Page 4: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming I - Course Information

I Teaching Assistant: Christopher Draper

I Graduate StudentI Research Interests: Random Number GenerationI Other Interests: Games, books, naps

Page 5: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming I - Course Information

I Teaching Assistant: Apurva Katti

I Graduate Student

I Research Interests: Deep Learning, Databases

I Other Interests: Dance. Travel

Page 6: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming I - Course Information

I Teaching Assistant: Shaeke Salman

I PhD Student

I Reserach Interests: Deep Learning, Machine Learning,Computer Vision

I Other Interests: Movies, Travel, Food

Page 7: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

This is a hard class

I While this class is required for several majors as a capstone, itis also an introductory class for CS majors.

I You have signed up to learn programming in C++. At theend of the course, you should be a competent entry-levelC++ programmer.

I However, this involves a lot of

Page 8: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Effort!

I Programming is a skill. Almost anyone can be trained to do itwell.

I You need to devote time outside class to practice. Practice isthe only way to better yourself as a programmer.

Page 9: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Reading

I Please read through the entire write-up a couple of times tounderstand the requirements before asking questions.

I Most of the assignments/ problem statements will be long.Jumping the gun without reading the whole thing could bedetrimental.

Page 10: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Basic Arithmetic

I You will not be allowed calculators for the test. However, youwill be expected to do some very basic math operations onyour tests.

I You are being forewarned. Math is not scary.

Page 11: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Start Early!

I You will be given a week to 10 days for homeworks. Pleasestart early. You need that amount of time to complete them.

Page 12: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Attendance

I The class is very incremental. So, skipping a few classes willget you into trouble. You are expected to attend class.

I While we understand that sometimes, circumstances result inmissing a couple of classes, missing quite a few classes is notcondoned.

Page 13: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Retention

I The class is very incremental. Material introduced in one classwill be applied through the rest of the course. Retainingmaterial is important. There is no modularization of material.

I Please make sure you understand a concept before we moveon to the next. We are ok with repeating material.

Page 14: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Course Expectations

Ask for help!

I The instructor and the TA’s are available to help. Please donot hesitate to ask for help.

I We are willing to work with you to ensure you are learning thematerial. However, this requires that you start theassignments early.

Page 15: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Student Expectations

The most common student expectations from the survey

I Interactive Lectures

I Clear expectations

I More homeworks with lower weights

I Availability

I Feedback

Page 16: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Academic Honor Code

I Of late, we have been having a lot of issues with violations ofthe Academic Honor Code.

I Since this is your first programming class, the rules might be abit ambiguous. We will try to clear up any confusion here.

I What is allowed:I Asking the instructor of TA for helpI Discussing concepts in general, discussing the concepts used in

an assignment.I Getting a tutor to help you with concepts and ideas.

I If you have a question about what counts as a violation to thehonor code, please ask the instructor or the TA’s.

Page 17: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Academic Honor Code

This is a list (inexhaustive) of things that violate the AcademicHonor Code

I Copying another person’s solution (changing variable nameswon’t help).

I Giving another person your solution.

I Telling another person how to solve the problem.

I Hiring a tutor to solve the problem for you.

I Asking friends/family to solve the problem for you.

I Copying solutions from the internet.

I Hiring people on the Internet (including websites like chegg)to solve the problem for you.

I Turning in older solutions if you’re repeating the class.

I Working with another student (collaboration).

Page 18: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

We have technology!

Page 19: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Main Components of a computer

I CPU - Central Processing Unit: The “brain” of the computer.I ISA - Instruction Set Architecture: the specific set of low-level

instructions available to a CPU. Differs for various CPU types(Intel Pentium, Mac G4, etc).

I ALU - Arithmetic & Logic Unit responsible for performingarithmetic calculations, as well as logical operations(comparisons for equality, inequality, for instance).

I Main Memory (RAM - Random Access Memory).I storage close to CPUI Faster to access than hard diskI stores executing programs and data being currently worked on

I Secondary MemoryI SSD, hard disk, DVD, etc.

Page 20: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Main Components of a computer

I Input devicesI mouse, keyboard, scanner, network card, etc.

I Output devicesI screen/console, printer, network card, etc.

I Operating SystemI Examples: Mac OS, Windows 10, LinuxI Controls computer operationsI Manages allocation of resources for currently running

applications

Page 21: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Memory Concepts

I bit: a binary digitI Stores the value 0 or 1I Smallest unit of storage in a computer

I byte: 8 bitsI Smallest addressable unit of storage in a computerI Storage units (variables) in a program are 1 or more bytesI Each byte in memory has an address (a number that identifies

the location)

Page 22: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming, and Programming Languages

Program - a set of instructions for a computer to execute

Evolution of Programming languagesI Machine Language

I Based on machine’s core instruction setI Needed by computer, hard for humans to read (1’s and 0’s)I Example: 1110110101010110001101010

Page 23: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming, and Programming Languages

I Assembly LanguageI translation of machine instructions to symbols, slightly easier

for humans to readI Example: ADD $R1, $R2, $R3

Page 24: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming, and Programming Languages

I High-level procedural languagesI Abstraction of concepts into more human-readable termsI Closer to ”natural language” (i.e. what we speak)I Easy to write and design, but must be translated for computerI Examples include C, Pascal, Fortran

I Object-oriented languagesI Abstraction taken farther than procedural languagesI Objects model real-world objects, not only storing data

(attributes), but having inherent behaviors (operations,functions)

I Easier to design and write good, portable, maintainable codeI Examples include Smalltalk, C++, Java

Page 25: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Code Translation

Bridging the gap between high-level code and machine code

I Interpreted languages – source code is directly run on aninterpreter, a program that runs the code statements

I Compiled LanguagesI A compiler program translates source code (what the

programmer writes) to machine language (object code)I A linker program puts various object code files together into an

executable program (or other target type, like a DLL)I C and C++ are compiled languages

Page 26: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Software Development

Involves more than just writing code

Page 27: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Software Development

I Analysis and problem definition

I Design - includes design of program or system structure,algorithms, user-interfaces, and more

I Implementation (coding)

I Testing - can be done during design, during implementation,and after implementation

I Maintenance - usually the major cost of a software system.Not part of ”development”, but definitely part of the softwarelife cycle

Page 28: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming is about Problem Solving

Page 29: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming is about Problem Solving

I Algorithm - a finite sequence of steps to perform a specifictask

I To solve a problem, you have to come up with the necessarystep-by-step process before you can code it

I This is often the trickiest part of programming

I Some useful tools and techniques for formulating an algorithm

I Top-down Refinement: Decomposing a task into smaller andsimpler steps, then breaking down each step into smaller steps,etc

I Pseudocode: Writing algorithms informally in a mixture ofnatural language and general types of code statements

I Flowcharting: If you can visualize it, it’s often easier to followand understand!

Page 30: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Programming is about Problem Solving

I Testing - algorithms must also be tested!I Does it do what is required?I Does it handle all possible situations?

I Syntax vs. SemanticsI Syntax – the grammar of a language.

A syntax error: ”I is a programmer.”I Semantics – the meaning of language constructs

Correct syntax, but a semantic error: ”The headphones ate thetree.”

Page 31: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Basic Creation and Execution of a C++ program

I Create source code with a text editor, store to disk.I Source code is just a plain text file, usually given a filename

extension to identify the programming language (like .c for C,or .cpp for C++)

I Preprocessor – Part of compiler process, performs anypre-processing tasks on source code.

I Compilation – syntax checking, creation of object code.I Object code is the machine code translation of the source code.

I Linking – Final stage of the creation of an executableprogram. Linking of object code files together with anynecessary libraries (also already compiled).

I Execution of programI Program loaded into memory, usually RAMI CPU executes code instructions

Page 32: Programming 1 - Florida State Universityjayarama/progsu19/Slides/Intro.pdf · 2019-05-15 · Jumping the gun without reading the whole thing could be detrimental. Course Expectations

Software Required for the Class

I The recommended software is JetBrains CLiomI You can find it at https://www.jetbrains.com/clion/buy.I Under the “Discounted and Complementary Licenses” tab,

choose “For Students and Teachers” and apply for a freelicense for and All Products Pack.

I You will get an email from JetBrains. Follow along with theinstructions and you will be asked to create a JetBrainsaccount. Upon doing that, you will get a key.

I You can then Download and Install CLion. Please follow theHowToCLion document on the Software page of the coursewebsite for instructions on installing and using the software.

I You can also use XCode, Visual Studio, etc. However, if youdo so, please keep in mind that the TA’s will use CLion tograde.

I You can also create an account on the CS departmentprogramming servers, and use a text editor and the g++compiler to run your code.