Object - Oriented Programming ( O O P ) Dr, SERHANE Oussama o.serhane@esi-sba.dz Ecole Nationale Supérieure d ’ Informatique de Sidi Bel Abbes (ESI-SBA) Second Year cpi 2022 /2023 © all right reserved Esi-sba What is this course about? Chapter 01 : General Introduction and Motivation Chapter 02 : Introduction to Java Programming Language Chapter 03 : Oriented Object Approach: Class and Object Chapter 04 : Oriented Object Approach: heritage, Polymorphism and Interface. Chapter 05 : Collections Chapter 06 : Exception handling and Management Chapter 07 : Graphical interface Chapter 08 : Streams and Files Object-Oriented Programming Esi-sba 2022/2023 2 C h a p t e r 01 : O O P Ge n e r a l In tr o d u c t i o n an d M ot i v a t i o n Object-Oriented Programming Esi-sba 2022/2023 3 Motivation • Familiar with object-oriented model • taking a problem and turning it into a set of well-designed classes • Writing a clean and readable code • Testing, debugging, and fix errors • Learning to use existing software libraries and packages • Mastering software tools and development environments (IDEs) such as Netbeans You will be able to develop a desktop software By the end of this semester Object-Oriented Programming Esi-sba 2022/2023 4 Is there any process to follow in order to: 1. Organize software development process 2. Perform partial and a global tests 3. Handle bags, error, maintenance during the programming phase 4. Keeping the software updated and ensuring multiple releases and versions Questions and concerns ... Object-Oriented Programming Esi-sba 2022/2023 5 S oftware D evelopment L ife C ycle ( S DL C ) • The Software Development Life Cycle is a structured process that enables the production of high-quality software with: • lowest development cost • and in the shortest possible production time • The purpose of the SDLC is to develop software that meets all customer expectations and demands and even more. • Employing SDLC enhances development speed and minimizes project risks and reduce production costs Object-Oriented Programming Esi-sba 2022/2023 6 How does the S DL C work? SDLC framework includes the following steps: 1. Planning and requirement analysis: it includes resource allocation, project scheduling, cost estimation, and provisioning. 2. Design step: this step includes • A brief description of each module and its functionality • Database tables and their main elements • Architecture diagrams • Technology details ... etc. 3. Implementation : it includes the development environment, code analysis, and review for multiple types of devices. Object-Oriented Programming Esi-sba 2022/2023 7 How does the S DL C work? 4. Testing Phase : the testing team evaluates the developed products and checks if it meets the requirements specified in the ‘ planning ’ phase. 5. Release Phase: it involves packaging, managing, and deploying releases across different environments. 6. Deployment Phase : the software is officially released into the production environment. 7. Monitor and Maintenance Phase : monitoring various software elements, for instance, system performance, user experience, new security vulnerabilities, an analysis of bugs or errors. Object-Oriented Programming Esi-sba 2022/2023 8 S oft w a r e D e v el o p m e n t L if e C y cle (S D L C ) Object-Oriented Programming Esi-sba 2022/2023 9 Questions and concerns As software developers, we are interested more in the implementation phase, but • How to organize the implementation phase to meet Software Development Life Cycle ? • Which programming paradigm eases the development process and reduce the complexity ? What are the available programming models ? Object-Oriented Programming Esi-sba 2022/2023 10 What are available programming paradigms available? 1. Procedural programming 2. Functional programming 3. Logic programming 4. Scripting programming 5. Event-driven programming 6. Aspect-oriented programming 7. Imperative programming 8. Declarative programming 9. Concurrent programming 10. Distributed programming 11. Reactive programming 12. Symbolic programming 13. Component-based programming 14. Metaprogramming 15. Generic programming 16. Reflective programming And Oriented Object Programming Object-Oriented Programming Esi-sba 2022/2023 11 Procedural programming (Reminder) It is a programming model that derived from structured programming , based on the concept of calling procedure • Simply put, it involves writing down a list of instructions to tell the computer what it should do step - by - step to finish the task at hand. • It uses a linear top - down approach (starts coding from the top until the end) and divides the program into procedures, which are also known as routines or functions. • During a program’s execution, any given procedure might be called by the other procedure at any code line, including by itself Object-Oriented Programming Esi-sba 2022/2023 12 Procedural programming: Principle 1. Program (code) is composed of sequences of instructions. 2. Minimal abstraction is present between the code and the machine. 3. Functions/procedures are logical blocks consist of groups of instructions, that can be invoked from other places in the code. Object-Oriented Programming Esi-sba 2022/2023 13 Procedural programming: Principle 4. The procedure may accept one or more arguments and return values to the caller. 5. Functions or procedures can access and modify variables in the global scope 6. Procedural programming languages follow structured practices and use block - based control flow rather than goto commands. Object-Oriented Programming Esi-sba 2022/2023 14 Defining a program as being a set of data or variables ( passive part ) on which procedures or functions act ( active part ). Running a program is reduced to calling these procedures in a particular order, and supplying them with the necessary data. Data and procedures are treated independently of each other without taking into account the relationships that unite them. f1() f2() f3() X Y Fonctions Variables P ROGRAM Procedural programming: Principle Object-Oriented Programming Esi-sba 2022/2023 15 Procedural programming: Example Program exemple Var x :...; y :...; function f1 ():... function f2 ():... function f3 ():... BEGIN ... END C ODE Object-Oriented Programming Esi-sba 2022/2023 16 Adv a n t a g e s and Di s a d v a n t a g e s of P r oc e d u r a l P r og r a m m i n g Advantages Excellent for general -purpose programming. A large variety of documentation resources, books, and online course material, makes it easy to learn. The source code is portable, and could be reused in different parts of the program. The program flow can be tracked easily Disadvantages Mainly focuses on procedures while providing less attention is given to the data. The program code is harder to modify when procedural program is employed. Difficult to relate with real -world objects. The data is exposed to the whole program, which reduce security aspect. Code sources are difficult to tracked, manage and edit in a large projects. The main drawback there is no support in any programming language to provide a structure for code organization and decomposition. Object-Oriented Programming Esi-sba 2022/2023 17 Summary so far • The software development life cycle is a do facto process that helps teams develop and deploy software, including necessary fixes, by utilizing best practices and shortening the development time. • There are seven steps in SDLC: 1-analysis, 2-design, 3-Implementation, 4-testing, 5-release, 6-deployment, 7-monitoring and maintenance. • The procedural programming model is based on the concept of calling procedures, therefore, data and procedures are treated independently of each other. Object-Oriented Programming Esi-sba 2022/2023 18 Questions and concerns • is procedural programming model suitable for implementation following SDLC? • is procedural programming ease developer teamwork? • is procedural programming simplify the test and maintenance? • is procedural programming suitable for a large project with active maintenance and releases If no What is the alternative? Object-Oriented Programming Esi-sba 2022/2023 19 Object-Oriented Programming (OOP)