Object orientation is a paradigm that interacts with objects having logic and data by themselves. Object in a real world is similar to the object in programming. The objects have their unique identity. One object might contain other objects but cannot actually replace an object. Multiple attributes are present in an object. Identity sepatate from others. Data to describe it’s current states. Class is a blueprint of the house and house is a object. It can be used to create these objects. Objects are defined as type: methods and attributes Objects are the instances of a class and they are known as instantiation. Existig classes like i/o networking strings dates arrays etc.

Amazing words: a. Abstraction: Nothing specific of an attribute and focus on the essentials. Think of a chair. You can think it anyway . Black Red Small Big or anything . That is known as abstraction : defining the abstract group having similar identity so that the necessary attributes can be added later. Ignores the irrelevant and ignores the unimportant. Similar items will have a same class and under the circumstances and current conditions.

b. Encapsulation: Bundling attributes and methods together in a boundary not just in case but for the protection of the content inside it. Restrict working and sharing of the unnecessary or the inner working of a class when required it gives access to whatever is essential only so that the content is hidden and protected. We can use methods to do a certain task from other part of the application but we restrict in changing the attributes of the object directly without getting inside the object. Black boxing Use the keypad to call dont care about the working of a telephone. Reducing dependencies of the program’s objects and use the encapsulation as much as you can .

c. Inheritance: Code reuse Customer is a person so can do directly customer inherits from the person and add new method or the attributes to be added in the child class. Multiple inheritence can be done in a way that a child class can have more than one parent class from which it inherits it’s attributes and methods. It’s more useful in the sense that it helps us use polymorphism.

d. Polymorphism:

  • sign can be used to added

it can be used to the classes and they can have the different type of + sign overriding the method of the parentClass It wouldn’t know where it shares it’s attributes in the parent class.

Object oriented design: Gather requirement Describe the application Identify main objects Describe the interactions Create a class diagram

What must the app do? Capabilities and features Legal or some type of requirements Performance requirements Support Security of the app

Half a feature is not necessary: instead the must part of an app Non functional req: Responding time 2 sec Help desk available Comply with the solution

FURPS+ Functional Usability Reliabilty Performance Supportability

Design requirements: Interface Physical requirements Implementation req: Programming lang and the way it’s going to do

What is must: Make a small and the must works of a program Describing the application in a bit more detail is the essence of this whole process.

UML: Unified Modeling Language Classic class diagram: Name , Attributes and methods Child and the parent classes and objects interacting from the same method of a class Only just a communication tool

Understanding use cases: Statements of work Classes we need Must do this How does user use our app and understand it to solve his problem? Main: title what’s the goal? actor: who desires it ? scenario: how is it accomplished? use the language that can be undersstood by a normal user

Title: Short phrase active verb Register new member Travel idea Create new page

Actor: Any external entity that acts on the system User Costumer A computer system

Scenario: Paragrapph Short succint to be understood by the user Else the points can be made from the paragraph.

Extensions: Specific details about a scenario Precondition: Stakeholders: Technology list: … … Requiring formal multipage templates is worthless in smaller of the cases. in bigger implementations the formal and pdf like docs are also fine to be worked with.

Actors: Very differnet goals with like in web framework like payroll admin, employee, foreign sys etc. External systems and organizations Roles or Security groups Job titles and adminstrators If difference in actors who take part for different operations , make them divide into primary and secondary actor Sometimes actors suggest goals and sometimes goals suggest the actors required.

Scenario: Log into application User focused goals are not logging into the system Focus on the user’s one encounters to succesful scenario Sunny day scenario and also the case of the not sunny day typical situations to be handled. Ease of creation than formality. Active voice a user readable code. Focus on the user’s intention on doing this.

Use case prompts: What happens if the system fails? Who manages the necessary conditions for a certain scenario?

Diagramming use cases: Overview of actors, actors and scenarios. To understand that the certain user uses the certain cases to make it obvious to understand. If external system is a actor , how will it act at a particualr use case.

User Story: SIngle user scenario and what they do and why they do it. Commonly written in index card Format: As a (user type) I want(goal) so that (reason): focused on one specific problem solving for the user for a certain reason It’s specific and not about how it is done but only the intent to do it. At the start of project and hold a place for deeper conversations.

Conceptual model for a system: IDentifying the most important object of the system Product, Item , Payrolls etc… Associations and Connections of one object with the other objects. Few hours is enough to identify the necessary objects required.

A. Let’s identify the classes: Written descriptions : noun need to be highlight first. The list of nouns is the list of available classes. Find duplicates and get rid of duplicates. Same classe’s functions can be removed.

Conceptual object model: Names of these objects in boxes to make associations Can add notes to clarify the associations; like user uses shopping cart and so on. :D One shopping cart contains many items: use symbols to 1 * meaning one to many.

Identifying class responsibilities: Methods of objects Verbes of the use cases to find the method required. Some need to be combined and some need to be modified. Who’s responsibility is it? Order object must contain check order fuction rather than in the customer.

System to be responsible: To control the program it;s not good to make master objects to edit everything.

CRC Cards: Class Responsibilty Collaboration One class Class name underlined Responsibilities and collaborator columns What this class need to take care of and which class is it going to collaborate with Move CRC cards together to understand the objects. If Doesn’t fit into CRC card, make other class and that’s better.

B. UML class diagram: Primary attributes will be named in singular First will be capital letter The datas required or used in this must be specified and also their names are at utmost importance. The data types are to obe specified as well to operate them in correct order. Operations section: Naming of lowercase first and Uppercase then get and set operations to use the common functions parameters to be set to the methods and also on the return type of the methods visibility control by using minus sign to denote that the datas or methods are private also plus sign for public

Data structures without proper objects create the wrong initial focus

C. Class Diagrams to code: D. Object lifetime: Instantiation: start of a new object using keyword new and asterisk for a object address Constructor is a special method to call when the object is made. It makes a space. Constructor is made inside the class by setting a method same as the class name inside the class so by setting the values to the constructor method; a new object when instantiated will have the params from the constructor hence by setting overloaded constructors will be great to perform various instantiations in valid states

IN UML: Spaceship() Spaceship(String)

Finalizer or Destroyer Deallocation or release of memory Connection to database may be stopped by destroyer

E. Static or shared members across all objects in the class: Instantiation of multiple objects to the same class wil have same from the class. By making the new data in a class as static set; one copy is shared across all the classes. static variable can be accesed by classname.staticVariable static methods are used static members in UML are written as with underline

F. Identifying inheritance situations: a car is a vehicle. Subclass or the child class is here to inherit data from the parent class. We may change the implementation of the method from the parent class by overriding. Dont stare at classes to create inheritence upto very high level. After all classes are made, we can choose commonality from the bottom up approach. Framework Inheritance example: File Dialog to Dialog to Window to Container to Component to Object

G. Calling a method in the super or parent or the base class: multiple inheritance : NameBaseClass::doSth();

H. Using of the abstract class: During the process of writing account , the class cannot be instantiated as it is only there to be inherited by the smaller or sub classes. abstract or MustInherit keyword may be used to make a class so that it cannot be instantiated but only be inherited.

I. Interfaces: Interface are to be implemented. We are promising to create methods inside the classes. Going forward many classes can work over the same interfaces. (className instanceOf Interface_name) to check For in UML file: Dotted line as like in inheritance “Program to an interface not an implementation.”

J. Aggregation and composition: One object can be built of the other objects. “Has a” relationship: not is a relation Can be used in UML by: Diamond arrow indicated to show that one class can contain many of those classes. Classroom Diamond Arrow Student

Composition: Implies ownership Filled diamond Deleting the mainClass cannot delete the member classes.

Creating sequence diagrams: COnceptual or static models : UML These diagrams don’t describe the interaction of these objects. One particular scenario where the interaction between the instantiated classes. Dotted lines to make timelines of interactions. Solid arrows for a direct call Activation or the method call boxes : rect boxes on timelines For a call to be many times, make a rectangle over the call to be repeated and and say loop the dotted line can be understood to return the interaction to the correct class a new object can be created from the return of the specific call to a method in any class dynamic situations are to be created for the complex problems the class so created can be deleted and return the result to an existing class.

UML diagrams and UML tools: gliffy.com IDE based : Visual Studio and Eclipse with UML tools

Object oriented design patterns: Observer design pattern Singleton design pattern: Only one object of the class One way to access the class Create a class : all normal stuff Add a constructor as private and create a static variable that holds singleton object make static Instance and check if the static variable is null or not : so it cannot be instantiated if once it is created. className.getInstance();

Memento Design pattern: Undo in an object Doesn’t voilate encapsulation Originator, Caretaker and Memento Caretaker first asks the originator to save the state caretaker saves the memento from originator. if we want to undo the changes the memento is sent back to the originator.

General development principles:

DRY: Dont ever repeat yourself One place to take care of a simple problem YAGNI: you aint gonna need it Solve the problem and dont add anything that’s not necessary. Code Smells: Long methods (Identifiers) Pointless comments God object Feature envy : the class that doesn’t do anything except call upon the classes.

5 solid principles of Of Object Design: S: Single Responsibility : Only one primary reason to exit and it must be encapsulated. No god object. O: Open/Closed principles :Open for extension but closed to modification , write new code but do not change code L: LISKOV Substitutuion: Derived classes must be substititutable for their base classes I: Interface Segregation Principle: Idea of having list of methods that a class can choose to implement No class needs to support long interfaces D: Dependency INversion Principle : Not tying the concrete classes together but use abstract classes for their dependencies. Abstract layer to remove dependency of the concrete classes to the main class. Allows substitution and execution of the code.

GRASP principle: General Responsibility Assignment Software Pattern Creator, Controller,

Expert or INfo Expert: Class must have reponsibility to any class. Creator: WHo is responsible for creation of any object? how they come into being? Does one object comprise or associates to another object. Low coupling : low dependencies between objecta so should be made low. High cohesion : the level that a class contains focused , related beahviours. Controller: Dont connect UI elements directly to the business objects. Pure fabrication: Whena behaviur doesn’t belong to an existing class , let’s fabricate a new class. Indirection: Reduce coupling by create a indirection object Protected variations: Protect the system from chanfes and variations: the data encapsulation, data hiding are also to support the system to create the objects more privately.