Presentation is loading. Please wait.

Presentation is loading. Please wait.

ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 1: Introduction.

Similar presentations


Presentation on theme: "ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 1: Introduction."— Presentation transcript:

1 ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 1: Introduction

2 12/18/2015 ECE 264: Lecture 1 2 What you should learn in this class An understanding, at an introductory level, of the use of objects in requirements, design, implementation, test, and maintenance of software systems The ability to write C++ programs The dynamics of working as a team on a project that covers all of the object life cycle The basics of the software / system process · To understand the interconnection of the CPU, memory, and I/O

3 What you’ll really learn … ? 12/18/2015 ECE 264: Lecture 1 3 http://xkcd.com/844

4 12/18/2015 ECE 264: Lecture 1 4 Tentative course outline Brief intro to object-oriented programming Software life cycle  We’ll introduce in lecture 2; revisit frequently Class basics: constructors, methods, members Arrays, vectors, and other container classes Destructors, pointers, and dynamic memory allocation Strings Extending classes  Operator overloading  Inheritance  Polymorphism (virtual functions, abstract classes) Note: basic programming concepts will be reviewed as needed: control statements, data types, operators, functions

5 5 What is a Computer? A computer consists of a CPU, memory, hard disk, monitor, printer, and communication devices.

6 6 Programs Computer programs, known as software, are instructions to the computer. You tell a computer what to do through programs. Without programs, a computer is an empty machine. Computers do not understand human languages, so you need to use computer languages to communicate with them. Programs are written using programming languages.

7 7 Programming Languages Machine Language Assembly Language High-Level Language Machine language is a set of primitive instructions built into every computer. The instructions are in the form of binary code, so you have to enter binary codes for various instructions. Program with native machine language is a tedious process. Moreover the programs are highly difficult to read and modify. For example, to add two numbers, you might write an instruction in binary like this: 1101101010011010

8 8 Programming Languages Machine Language Assembly Language High-Level Language Assembly languages were developed to make programming easy. Since the computer cannot understand assembly language, however, a program called assembler is used to convert assembly language programs into machine code. For example, to add two numbers, you might write an instruction in assembly code like this: ADDF3 R1, R2, R3

9 9 Programming Languages Machine Language Assembly Language High-Level Language The high-level languages are English-like and easy to learn and program. For example, the following is a high-level language statement that computes the area of a circle with radius 5: area = 5 * 5 * 3.1415;

10 10 Popular High-Level Languages COBOL (COmmon Business Oriented Language) FORTRAN (FORmula TRANslation) BASIC (Beginner All-purpose Symbolic Instructional Code) Pascal (named for Blaise Pascal) Ada (named for Ada Lovelace) C (whose developer designed B first) Visual Basic (Basic-like visual language developed by Microsoft) Delphi (Pascal-like visual language developed by Borland) C++ (an object-oriented language, based on C) Java (a popular object-oriented language, similar to C++) C# (a Java-like developed by Microsoft)

11 11 Compiling Source Code A program written in a high-level language is called a source program. Since a computer cannot understand a source program. Program called a compiler is used to translate the source program into a machine language program called an object program. The object program is often then linked with other supporting library code before the object can be executed on the machine.

12 12 History of C++ C, C++, Java, and C# are very similar. C++ evolved from C. Java was modeled after C++. C# is a subset of C++ with some features similar to Java. If you know one of these languages, it is easy to learn the others. C evolved from the B language and the B language evolved from the BCPL language. BCPL was developed by Martin Richards in the mid-1960s for writing operating systems and compilers. C++ is an extension of C, developed by Bjarne Stroustrup at Bell Labs during 1983-1985. C++ added a number of features that improved the C language.

13 Why C++? C++ embodies the dominant computing paradigm, Object-Oriented Programming (OOP). Object-oriented programming techniques are more natural than structured programming. You’ll learn both since OOP is built upon structured programming. Learning C++ also teaches you an enhanced form of C. Advanced computing topics (operating systems, etc) are typically and more efficiently implemented in C/C++. Legacy migration of systems from C to C++ (30+ years of C code to migrate to C++ means jobs!). Contrary to popular belief, it’s fun!

14 Why object-oriented programming? Object orientation  A natural way of thinking about the world and computer programs Object-oriented design (OOD)  Models real-world objects in software  Models communication among objects  Encapsulates attributes and operations (behaviors) Information hiding Communication through well-defined interfaces Object-oriented language  Programming in object oriented languages is called object- oriented programming (OOP)  C++ is an object-oriented language Programmers can create user-defined types called classes  Contain data members (attributes) and member functions (behaviors) 1412/18/2015 ECE 264: Lecture 1

15 What are objects? Reusable software components that model real world items Meaningful software units  Time objects, paycheck objects, record objects, etc.  Any noun can be represented as an object Objects have attributes  Size, shape, color, weight, etc. Exhibit behaviors  Babies cry, crawl, sleep, etc.; cars accelerate, brake, turn, etc. More understandable, better organized and easier to maintain than procedural programming Libraries of reusable software  MFC (Microsoft Foundation Classes) 1512/18/2015 ECE 264: Lecture 1

16 Object-oriented design Object-Oriented Analysis and Design (OOAD)  Analyze program requirements, then develop solution  Essential for large programs  Plan in pseudocode or UML Unified Modeling Language (UML)  Graphical language that uses common notation  Allows developers to represent object-oriented designs 1612/18/2015 ECE 264: Lecture 1

17 12/18/2015 ECE 264: Lecture 2 17 Pretest review Pretest intended to review the following  Control structures (if/else, switch, loops)  Basic data types  Array accesses  C output First three topics use exactly the same syntax in C++! We’ll cover C++ output starting in lecture 3

18 Pretest review: if/else statements int x, y;. if (x < 5) { y = x + 1; } else { y = x – 2; } 1. At the end of the if/else statement above, if x = 4, y is equal to: a. 1b. 2 c. 4d. 5 2. Now, if x = 5, y is equal to: a. -2b. 3 c. 5d. 6 12/18/2015 ECE 264: Lecture 2 18

19 Pretest review: loops int x = 1; int i = 0; while (i <= 3) { x = x * 2; i++; } 3. Fill in the blank: The body of the while loop executes ______ times. a. 2b. 3 c. 4 d. an infinite number of 4. The final value of x is: a. 2b. 3 c. 8 d. 16 5. Which of the following is a for loop that can replace the while loop and produce the same result for x? a. for (i = 1; i < 4; i++) b. for (i = 0; i < 3; i++) c. for (x = 0; x <= 3; x++) d. for (i = 3; i >= 0; i--) 12/18/2015 ECE 264: Lecture 2 19

20 Pretest review: arrays, I/O int A[5] = {0, 7, 13, 12, 5}; for (i = 0; i < 5; i++) { printf(“A[%d] + 3 = %d\n”, i, A[i] + 3); } 6. In the first iteration, the program will display the following text on the screen: a. A[%d] + 3 = %d\n b. A[i] + 3 = A[i] + 3 c. A[0] + 3 = 3 d. A[1] + 3 = 10 7. The value of A[4] is: a. 4 b. 5 c. 12 d. non-existent 12/18/2015 ECE 264: Lecture 2 20 Notes: http://www.cplusplus.com/reference/clibrary/cstdio/printf/

21 Pretest review: switch statements switch (var) { case 0: case 1: x = x + var; break; case 2: x = x – var; case 3: x = x * var; break; default: x = var; } Assume x always equals 5 at the start of the switch statement. What is the value of x at the end of the statement if: 8. var = 1? a. 1b. 4 c. 5 d. 6 9. var = 2? a. 2b. 3 c. 6 d. 7 10. var = 5? a. 0 b. 5 c. 10 d. 25 12/18/2015 ECE 264: Lecture 2 21

22 Next Software design cycle  General overview Software engineering steps Types of testing Requirements specifications  Introduce UML, use case diagrams Applying design cycle to ECE 264 C++ basics 12/18/2015 ECE 264: Lecture 2 22


Download ppt "ECE 264 Object-Oriented Software Development Instructor: Dr. Honggang Wang Spring 2013 Lecture 1: Introduction."

Similar presentations


Ads by Google