Publicité
Publicité

Contenu connexe

Publicité
Publicité

SE_Lec 06_Object Oriented Analysis and Design

  1. 1
  2. 2  System development refers to all activities that go into producing information system solution.  System development activities consist of system analysis, modeling, design, implementation, testing and maintenance.  Object-Oriented (OO) systems development is a way to develop software by building self-contained modules that can be more easily:  Replaced  Modified  and Reused.
  3. 3  A software system is a set of mechanism for performing certain action on certain data. Algorithm + Data structure = Program
  4. 4  The code is subdivided into modules  Each module is made of procedures and data structures  Procedures operate on data, e.g. modifying them  e.g. the “C” programming language  There is no strong connection between procedures  Every procedure may possibly access any data and modify it and data
  5. 5  OO approach is more like creating a lot of helpers that take on an active role, a spirit, that form a community whose interactions become the application.  Models the problem to be solved as a set of interacting objects, each carrying its own state and exhibiting its own behavior  By separating concerns, this approach has proved to be robust and useful to solve more complex programming problems.
  6. 6  The physical world is made of a set of objects that can interact  Each of them presents  An identity (objects can be recognized)  A state (objects remember their history)  A behavior (objects react to external stimuli in a predictable way)
  7. 7  Faster development,  Increased quality  Raising the level of abstraction.  It adapts to  Changing requirements  Easier to maintain  More robust  Promote greater design  Code reuse
  8. 8  Goals:  Define Objects and classes  Describe objects‘ methods, attributes and how objects respond to messages,  Define Polymorphism, Inheritance, data abstraction, encapsulation, and protocol,  Describe objects relationships,  Describe object persistence.  Understand meta-classes.
  9. 9  The term object was first formally utilized in the Similar language to simulate some aspect of reality.  An object is an entity.  It knows things (has attributes)  It does things (provides services or has methods)  Note:  Attributes or properties represented by data type and describe object‘s state (data)  Methods define objects behavior and specify the way in which an Object‘s data are manipulated.
  10. 10  It Knows things (attributes)  I am an Employee.  I know my name, social security number and my address.  Attributes  I am a Car.  I know my color,  manufacturer, cost,  owner and model.  It does things (methods)  I know how to compute my payroll.
  11. 11  In an object-oriented system, everything is an object: numbers, arrays, records, fields, files, forms, an invoice, etc.  An Object is anything, real or abstract, about which we store data and those methods that manipulate the data.  Conceptually, each object is responsible for itself.  A window object is responsible for things like opening, sizing, and closing itself.
  12. 12  When developing an O-O application, two basic questions always arise.  What objects does the application need?  What functionality should those objects have?
  13. 13  Simple Name (written as UpperCase-first Noun)  Path Name
  14. 14  Represent named properties of a UML class  UML class can have many attributes of different names  Attribute name is generally a short noun or a noun phrase written in lowerCase-first text  Attribute declaration may include visibility, type and initial value: +attributeName : type = initial-value
  15. 15  Represent named services provided by a UML class  UML class can have many operations of different names  Operation name is generally a short verb or a verb phrase written in lowerCase-first text  Operation may include visibility, parameters, and return type: +opName(param1 : type = initial_value) : return-type
  16. 16  Three levels of class, attribute and operation visibility: • private (-), available only to the current class • protected (#), available to the current and inherited classes • public (+), available to the current and other classes
  17. 17  Each class represents a set of objects that share the same attributes, operations, relationships, and semantics  For each of the class attributes, objects can have specific attribute values  For each of the class operations, objects may have different implementations
  18. 18  Represent a relation between a parent (a more abstract class) and a child (a more specific class)  Generally referred to as a “is-a-kind-of” relationship  Child objects may be used instead of parent objects since they share attributes and operations; the opposite is not true
  19. 19  An object-oriented system organizes classes into subclass-super hierarchy.  At the top of the hierarchy are the most general classes and at the bottom are the most specific  A subclass inherits all of the properties and methods (procedures) defined in its super class.
  20. 20  Inheritance is a relationship between classes where one class is the parent class of another (derived) class.  Inheritance allows classes to share and reuse behaviors and attributes.  The real advantage of inheritance is that we can build upon what we already have and,  Reuse what we already have.
  21. 21
  22. 22
  23. 23  OO systems permit a class to inherit from more than one superclass.
  24. 24  Information hiding is a principle of hiding internal data and procedures of an object.  By providing an interface to each object in such a way as to reveal as little as possible about its inner workings.  Encapsulation protects the data from corruption.
  25. 25  Objects perform operations in response to messages. For example, you may communicate with your computer by sending it a message from hand-help controller.
  26. 26  Consider a payroll program that processes employee records at a small manufacturing firm. This company has three types of employees:  Managers: Receive a regular salary.  Office Workers: Receive an hourly wage and are eligible for overtime after 40 hours.  Production Workers: Are paid according to a piece rate.
  27. 27  Structured Approach FOR EVERY EMPLOYEE DO BEGIN IF employee = manager THEN CALL computeManagerSalary IF employee = office worker THEN CALL computeOfficeWorkerSalary IF employee = production worker THEN CALL computeProductionWorkerSalary END
  28. 28  OO Approach
  29. 29  OO Approach FOR EVERY EMPLOYEE DO BEGIN employee computePayroll END
  30. 30  Polymorphism means that the same operation may behave differently on different classes.  Example: computePayroll
  31. 31  Link: model of logical or physical link between objects
  32. 32  Relationship: descriptor of links
  33. 33  Multiplicity: constraint on the min/max number of links connected to an object
  34. 34  The concept of association represents relationships between objects and classes. For example a pilot can fly planes  Association can be binary, between two classes, or n- ary, among more than two classes  Can include association name, direction, role names, multiplicity, and aggregation type
  35. 35  Represent a specific, whole/part structural relationship between class objects  Composition [is entirely made of]: (closed diamond) represents exclusive relationship between two class objects (e.g., a faculty cannot exist without nor be a part of more than one university)  Aggregation [is part of]: (open diamond) represents nonexclusive relationship between two class objects (e.g., a student is a part of one or more faculties)
  36. 36  Objects have a lifetime. An object can persist beyond application session boundaries, during which the object is stored in a file or a database, in some file or database form.
  37. 37  Everything is an object.  How about a class?  Is a class an object?  Yes, a class is an object! So, if it is an object, it must belong to a class.  Indeed, class belongs to a class called a Meta-Class or a class' class.  Meta-class used by the compiler. For example, the meta-classes handle messages to classes, such as constructors and "new.“
  38. 38
Publicité