object-oriented programming in c++ cgs...
TRANSCRIPT
![Page 1: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/1.jpg)
Object-Oriented Programming in C++CGS 3406
![Page 2: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/2.jpg)
About Myself
● Primary Research Areas– Real-time Systems
● Operating system design● Scheduling
– Storage
● Use C/C++ (among other languages) in my research
![Page 3: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/3.jpg)
About This Course
● Introductory programming course● Material applicable to many programming
languages● Object oriented programming
C++, Java, Python
Programming
![Page 4: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/4.jpg)
This Course
● Remember that this is primarily a course on programming
● However, you will have to learn some C++– Basic facilities
– Learning through doing
– Practice
![Page 5: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/5.jpg)
Objectives
● Basic understanding of software and hardware● Solve computing problems using a top-down approach with a
well-structured design using procedural programming techniques● Design, implement, test, and debug a C++ program to solve
problems● Control structures used in procedural programming● Make use of data types and structures in C++● Design and implement algorithms to perform common tasks● Demonstrate competence with the use of functions, reference
parameters, arrays, pointers, recursion and I/O
![Page 6: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/6.jpg)
Meeting the Objectives
● Lectures● Book, notes, online resources, ...● ~8 Programming Assignments● 3 Tests● Quizzes● More information in the course syllabus
![Page 7: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/7.jpg)
Programming
![Page 8: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/8.jpg)
Programming
● Translating an idea (e.g., algorithm) into a form that can be run on a computer
● Tell the computer what to do– Easy?
● Problem solving● Is programming the same as computer
science?
![Page 9: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/9.jpg)
Computer Hardware
● CPU– Executes machine language
● Main memory– Stores instructions and data
● Secondary storage (e.g., SSD, hard disk)– Persistent
![Page 10: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/10.jpg)
Programming Languages
● Machine Language– Based on machine's core instruction set
– Difficult for humans to read (1's and 0's)
– Example: 1110110101010110001101010● Say what?
● Assembly Language– Translation of machine instructions to symbols, slightly easier
for humans to read
– Example: ADD $R1, $R2, $R3
– Well, we know it has something to do with addition!
![Page 11: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/11.jpg)
Programming Languages
● High-level procedural languages– Abstraction of concepts into more human-readable terms
– Closer to "natural language" (i.e. what we speak)
– Easy to write and design, but must be modified for computer to execute
– Examples include C, Pascal, Fortran
● Object-oriented languages– Abstraction taken farther than procedural languages
– Objects model real-world objects, not only storing data (attributes), but having inherent behaviors (operations, functions)
– Easier to design and write good, portable, maintainable code
– Examples include Smalltalk, C++, Java
![Page 12: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/12.jpg)
C++
![Page 13: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/13.jpg)
Why C++
“There are only two kinds of languages: the ones people complain about and the ones nobody uses.”
― Bjarne Stroustrup, The C++ Programming Language
● Portability– supported on nearly all platforms (including embedded
systems)
● Supports major programming styles● Used in many projects
– Typically systems and embedded
● Need a programming language to learn programming
![Page 14: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/14.jpg)
This Course
● The entire C++ language will not be covered– Not necessary to meet objectives
– This course won't make you an expert in C++● C++ has many “interesting” rules/constructs
● General approach– Programming concepts, techniques, principles
– Map them to code
– Process to perform the mapping
![Page 15: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/15.jpg)
"Hello, World!"
● Program that says Hi● Very simple program● Verify
– Basic understanding of language syntax
– Build tools
– Execution platform
![Page 16: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/16.jpg)
"Hello, World!"
#include <iostream> // preprocessor directiveusing namespace std;
int main() // start of program{
cout << "Hello, World!\n"; // standard output streamreturn 0; // return value to operating system
}
![Page 17: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/17.jpg)
Compile, Link, Execute
Source Code(.cpp, .h)
compiler
linkerExecutableProgram
Object code(.o)
Libraries
![Page 18: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/18.jpg)
ExecutableProgram
standardoutput stream
![Page 19: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/19.jpg)
Operating System
Application
Libraries
Kernel
![Page 20: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/20.jpg)
Coding
● Quality– Design
● Organization
– Ease of understanding
– Self documenting code
● Style● Debugging
![Page 21: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/21.jpg)
Plagiarism
the act of using another person's words or ideas without giving credit to that person
- Merriam-Webster Dictionary
● Code– Do not “share” assignment code/ideas from others
– Do not claim others' code as your own
● Discussing material is encouraged– Especially for exams
– Help each other out
● List any sources you used– If in doubt, list the source
● Plagiarism detection software will likely catch cheating● Expect to verbally explain assignment code you turn in
![Page 22: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/22.jpg)
How to Succeed
“For the things we have to learn before we can do them, we learn by doing them.”
― Aristotle, The Nicomachean Ethics
● Write code frequently● Ask questions
– Office hours
● Assignments● Tests/Quizzes● Bring computer and do examples in class
![Page 23: Object-Oriented Programming in C++ CGS 3406ww2.cs.fsu.edu/~stanovic/teaching/cgs3406/lecture/1_introduction.pdf · Why C++ “There are only two kinds of languages: the ones people](https://reader033.vdocuments.site/reader033/viewer/2022042313/5edc9edbad6a402d66675d61/html5/thumbnails/23.jpg)
Till Next Class
● Program and execute a “hello world” program– Computer
● Lab● Personal
– Software● Visual Studio● g++● ...