170 likes | 227 Views
Object Oriented Programming (OOP). Introduction. Instructor Fasee Ullah Abasyn University, Peshawar. Computers. What is a computer? A computational device Logical decisions billions of times faster than humans Hardware keyboard, screen, disks, memory, CPU Software
E N D
Object Oriented Programming(OOP) Introduction Instructor Fasee Ullah Abasyn University, Peshawar
Computers • What is a computer? • A computational device • Logical decisions billions of times faster than humans • Hardware • keyboard, screen, disks, memory, CPU • Software • email, word processing, spreadsheets, OS
Computer Organization • Input unit • keyboard, microphone • Output unit • screen, printer • Memory unit • Random Access Memory (RAM) • short-term, rapid access, • Arithmetic and logic unit • calculations, comparisons • Central Processing Unit (CPU) • coordinator, administrator • Secondary storage unit • disks, tapes • high capacity warehouse
Programming Languages • Machine language • Native to a processor: executed directly by hardware • Instructions consist of binary code: 1s and 0s • Assembly language • Slightly higher-level language • Readability of instructions is better than machine language • One-to-one correspondence with machine language instructions • Assemblers translate assembly to machine code • Compilers translate high-level programs to machine code • Either directly, or • Indirectly via an assembler
Preprocessor program processes the code. Compiler creates object code and storesit on disk. Compiler Linker links the object code with the libraries Primary Memory Loader Loader puts program in memory. Primary Memory CPUtakes each instruction and executes it, possibly storing new data values as the program executes. CPU Preprocessor Linker Editor Disk Disk Disk Disk Disk . . . . . . . . . . . . Program Development Environment Program is created in the editor and stored on disk. • Phases of C/C++ Programs: • Edit • Preprocess • Compile • Link • Load • Execute
Weakness of C language • ‘C’ is not strong typed language e.g int a; a=“Pak” • C program is scattered which may look confusing • C program is not self-explanatory like other languages such as BASIC, Pascal etc • C program is more understandable to the author and for no one else
Weakness of C language • Any legal program of C also legal in C++ while reverse not possible
Structured Programming Structure Chart
Cornerstones of OOP & OOSE • OOP provides • Extensibility • Software Reusability • Encapsulation
Extensibility of OOP • Program creates own data type • class rectangle{ • class ball{ • class point {
Software Reusability • In this phase using inheritance • For example class Person { • Can inherit various information for inherited classes • eg class employee{, • class visitor{
Encapsulation • To keep data hide • Attributes of encapsulation • Private • Public • protected
OOSE Background • Originated in Sweden • Object Oriented Software Engineering a use case driven approach • Pragmatic method based on experience • Popular and successful • Complete method
What comprises a method? • It includes • Syntax (how it looks) • Semantic (what it means) • Pragmatic (heuristics, rule of thumbs etc)
3 Stages, 5 Models • Stages are • Analysis • Construction • Testing • Model are • Requirements model • Analysis model • Design model • Implementation model • Testing Model