Object Oriented Modeling and Design Agenda Software development

Object Oriented Modeling and Design Agenda • Software development (SD) & Software development methodologies (SDM) • Orthogonal views of the software • OOSD Methodology • Why an Object Orientation?

Object Oriented Modeling and Design Software development (SD) & Software development methodologies (SDM): ØSD refers to all activities that go into producing an information system ØSD is dynamic & always undergoing major changes ØMany tools and methodologies ØIt consists of system analysis, design, implementation, testing and maintenance ØSDM is a series of processes that , if followed, can lead to the development of an application ØIt describes how the work is to be carried out to achieve the original goal based on the system requirements ØIt consists of a number of steps and rules that should be performed during development

Object Oriented Modeling and Design Orthogonal views of the software: Ø Traditional development technique 1. Algorithmic centric Focus on algorithm (what is it doing) 2. Data centric Focus on data (what data is accessed) Ø Object Oriented System Development (OOSD) or Object Oriented Analysis and Design (OOAD) Focus on object (Algorithm & Data)

Object Oriented Modeling and Design OOSD Methodology: Ø It is a way to develop software by building self contained objects that can be easily replaced, modified and reused Ø In an O-O environment, software is a collection of discrete objects. Ø These objects encapsulate their data and functionalities to model real world "objects”.

Object Oriented Modeling and Design OOSD Methodology: Ø An object-oriented life cycle encourages a view of the world as a system of cooperative and collaborating agents. Ø In an OO system, everything is an object and each object is responsible for itself

Object Oriented Modeling and Design OOSD Methodology: • Example: » A window object is responsible for things like opening, sizing and closing itself. Class window { Data_type data; void close(. , . ) {……. . } int open(. , . ) {……. } float sizing(. , . ) {…. . } } Class chart { } Void draw(. , . ) {…. . }

Object Oriented Modeling and Design OOSD Methodology: Note: Rather than writing a lot of code to do all the things that have to be done, you tend to create a lot of helpers that take on an active role, a spirit and that become a community whose interaction becomes an application

Object Oriented Modeling and Design Why an Object Orientation? : Ø Higher level of abstraction: • Supports abstraction at object level • The development can proceed at the object level & ignore rest of the system for as long as necessary • This makes system development much simpler Ø Seamless transition among different phases of SD: • • Easy to move from one language to another Analysis & design is not language centric Reduces the level of the complexity & redundancy More robust system development

Object Oriented Modeling and Design Why an Object Orientation? : Ø Encouragement of good programming techniques: • Functions and data held together • Objects are independent in a system » Object change has no impact on other • System achieves the benefits of an object orientation • Easier to produce more modular & reusable code Ø Promotion of reusability: • Objects are reusable • Each object stands by itself or within a small circle of peers • Powerful Inheritance technique » Only differences & enhancements between classes (super & sub-class) need to be designed

Object Oriented Modeling and Design Agenda • • • Object basics Objects responds to messages Classes Meta-Class

Object Oriented Modeling and Design Object basics: Motivating factor behind OOAD: Make software development easier & more natural by raising the level of abstraction to the point where applications can be implemented Object: ØIt was first formally utilized in the simula language to simulate some aspect of reality ØA real world entity, identifiable separate from its surroundings ØA combination of data and logic that represents some real world entity ØIt is associated with v. Properties v. Procedures v. Identity vpersistence

Object Oriented Modeling and Design Object basics: Object properties (Attributes): Ø Describe the state of an object Ø It refers to description rather than how they are represented in a particular programming language I am an Employee. Ø Example I know my name, social security number and my address.

Object Oriented Modeling and Design Object basics: Object properties (Attributes): Ø Example I am a Car. I know my color, manufacturer, cost, owner and model.

Object Oriented Modeling and Design Object basics: Object procedures (Methods): Ø Methods or procedures define its behavior Ø Behavior denotes the collection of methods that abstractly describes what an object is capable of doing Ø Method encapsulate the behavior of an object, provide interface to the object Ø The use of methods to exclusively access or update properties Ø Object take responsibility for their own behavior. It simplifies application development & maintenance

Object Oriented Modeling and Design Object basics: Object procedures (Methods): ØExample I know how to Compute my payroll. It does things

Object Oriented Modeling and Design Object basics: Object procedures (Methods): ØExample I know how to stop.

Object Oriented Modeling and Design Object basics: Object Identity (OID): Ø Every object has its own unique & immutable identity Ø It comes into being when the object is created & continue to represent that object from then on Ø This identity never confused with another object, even if the original object has been deleted. It never reused Ø The identity name never changes even if all the properties of the object change Ø OID’s help to establish relationships/communication among objects Ø OID’s help to implement object references during implementation Ø Example : Employee Id, stud_Reg_Number

Object Oriented Modeling and Design Object basics: Object persistence: Ø Object have life time Ø They are explicitly created & can exist for a period of time (usually the duration of the process in which they were created) Ø An object can persist beyond application session, this characteristics is called object persistence Ø A file or database provides longer lifeline Ø The lifetime of an object can be explicitly terminated. After an object is deleted

Object Oriented Modeling and Design Object basics: Objects responds to messages: ØMessages essentially are non specific function calls ØObjects respond to messages according to methods defined in its class ØDifferent objects can respond to same message in different ways ØPolymorphism is the main difference between a message and a subroutine call ØDraw message can be sent to many objects like triangle, circle or line & each object could act differently

Object Oriented Modeling and Design Object basics: Objects responds to messages (con’t): ØMessage is the instruction & Method is the implementation ØA message has a name just like method ØAn object understands a message when it can match the message to a method that has the same name as the message ØMessage says what to do & method says how to do something ØMessage so general, it can be used over & over again in many different contexts ØChanges to method has no impact on messages & system

Object Oriented Modeling and Design Object basics: Classes: Ø Classes are used to distinguish one type of object from another Ø Class is a set of objects that share a common structure & common behavior Ø A single object is simply an instance of a class Ø Every object of a given class has the same data format & responds to the same instructions Ø Can create unlimited instances (except for singleton) Ø Can use any of the predefined classes

Object Oriented Modeling and Design Object basics: Meta Class (con’t): Ø 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. Ø All classes are instances of a Metaclass

Object Oriented Modeling and Design Object basics: Meta Class: Ø Meta-class used by the compiler. For example, the meta-classes handle messages to classes, such as constructors , "new“ and static member data
- Slides: 23