1 / 21

Carrano : Chapter 1

Carrano : Chapter 1. Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles. What is a Good Solution?. A solution is good if: The total cost it incurs over all phases of its life cycle is minimal

kolya
Download Presentation

Carrano : Chapter 1

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Carrano: Chapter 1 Software Engineering and Object-Oriented Design • Topics: • Solutions • Modules • Key Programming Issues • Development Methods • Object-Oriented Principles

  2. What is a Good Solution? • A solution is good if: • The total cost it incurs over all phases of its life cycle is minimal • The cost of a solution includes: • Computer resources that the program consumes • Difficulties encountered by users • Consequences of a program that does not behave correctly • Programs must be well structured and documented • Efficiency is one aspect of a solution’s cost

  3. What is a Module? • A Module is a part of a program that accomplishes a task. • In procedural programming, Modules are made up of one or more functions. • Large Modules may contain Sub-Modules.

  4. Structure of a Module • Modules have two primary components: an Interface and Internal Components. • In procedural programming, a module’s interface is just header of the function that you call to start the module. • Internal Components are the sub-modules/functions that do the task the module is designed to do.

  5. How to Evaluate a Module • Cohesion • A highly cohesive module performs one well-defined task • Leads to modular solutions • Reduces Coupling • Coupling • Modules with low coupling are independent of one another • Modules shouldn’t affect other modules when changed. • Low coupling increases Cohesion.

  6. Seven Key Issues in Programming • Modularity • Style • Modifiability • Ease of Use • Fail-safe programming • Debugging • Testing

  7. 1) Modularity • Modularity has a favorable impact on • Constructing programs • Debugging programs • Reading programs • Modifying programs • Eliminating redundant code • Reuse of code

  8. 2) Style Programming Style can enhance code with: • Use of private data members • Proper use of reference arguments • Proper use of functions • Avoidance of global variables in modules • Error handling • Readability • Documentation

  9. 3) Modifiability • Modifiability is easier through the use of • Named constants • The typedefstatement

  10. 4) Ease of Use • The easier a program is to use, the more impressed users will be with it. • In an interactive environment, the program should prompt the user for input in a clear manner • A program should always echo its input • The output should be well labeled and easy to read

  11. 5) Fail-Safe Programming • Fail-safe programs will perform reasonably no matter how anyone uses them • Test for invalid input data and program logic errors • Check invariants • Enforce preconditions • Check argument values

  12. 6) Debugging • Programmers must systematically check a program’s logic to find and correct errors • Tools to use while debugging: – Single-stepping – Watches – Breakpoints – cout statements – Dump functions

  13. 7) Testing • Levels • Unit testing: Test functions, then modules • Integration testing: Test interactions among modules • System testing: Test entire program • Acceptance testing: Show that system complies with requirements

  14. Development Methods, Waterfall • One simple but somewhat outdated method is the Waterfall Method. • Though it can be used modularly, this design method requires each preceding stage to be complete before progressing to the next stage. In practice, this leads to inflexibility and a constant state of incompleteness.

  15. Development Methods, Iterative • Newer methods are iterative. • Many short, fixed-length iterations • Each iteration builds on the previous iteration until a complete solution is achieved • Each iteration cycles through analysis, design, implementation, testing, and integration of a small portion of the problem domain • Early iterations create the core of the system; further iterations build on that core

  16. Development Methods, Iterative • Features of Iterative methods: • The partial system at the end of each iteration should be functional and completely tested • Each iteration makes relatively few changes to the previous iteration • End users can provide feedback at the end of each iteration One specific iterative method is the Rational Unified Process (RUP)

  17. Object-Oriented Programming • The most modern approach to designing modules is the Object-Oriented approach. • Instead of creating groups of functions, create classes. • Classes are combinations of data sets and methods (functions that operate on the data set) • Classes are combined and caused to interact to create solutions.

  18. Principles of Object-Oriented Programming (OOP) • Object-oriented languages enable us to build classes that can be used to instantiate (create) objects • A class combines • Attributes (characteristics) of objects of a single type • Typically data • Called data members • Behaviors (operations) • Typically operate on the data • Called methods or member functions • An object is an instance of a class. Class: Objects:

  19. Principles of Object-Oriented Programming • Three principles of object-oriented programming • Encapsulation • Objects combine data and operations • Hides inner details • Inheritance • Classes can inherit properties from other classes • Existing classes can be reused • Polymorphism • Objects can determine appropriate operations at execution time

  20. Object-Oriented Analysis and Design • Object-Oriented Analysis (OOA) • Coming up with the classes that can be used to define the problem. • Emphasis on what a solution must do. • Object-Oriented Design (OOD) • Understanding how the classes can interact and what they can do alone or together.

  21. Applying the UML to OOA/D • UML (Unified Modeling Language) is very often used in OOA/D to define classes and their interactions. A UML class definition: A UML interaction diagram:

More Related