Moving to OOD
Transcript of Moving to OOD
![Page 1: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/1.jpg)
Moving to OO DevelopmentSean McSharry
![Page 2: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/2.jpg)
Who is this jerk?
Author on Actionscript 3.0 for Flash and Flex
Prerelease tester on many Adobe products
Organize and run PokerCoder
Run Flashcoder blog
Senior Partner at Logic Bureau
![Page 3: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/3.jpg)
Why, What and How
![Page 4: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/4.jpg)
Why?
![Page 5: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/5.jpg)
Why OO?
OO vs. Procedural
![Page 6: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/6.jpg)
Why OO?
OO vs. Procedural
The best things take time
![Page 7: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/7.jpg)
Why OO?
OO vs. Procedural
The best things take time
Be Pragmatic
![Page 8: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/8.jpg)
What?
![Page 9: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/9.jpg)
A programming paradigm
It does what it says on the tin
Objects are represented as classes
Not difficult
What is OO?
![Page 10: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/10.jpg)
Modularity
OO Core Concepts
![Page 11: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/11.jpg)
Modularity
Inheritance
OO Core Concepts
![Page 12: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/12.jpg)
Modularity
Inheritance
OO Core Concepts
![Page 13: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/13.jpg)
Modularity
Inheritance
Encapsulation
OO Core Concepts
![Page 14: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/14.jpg)
Modularity
Inheritance
Encapsulation
OO Core Concepts
classA.count=1;
classA.setCount(1);
![Page 15: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/15.jpg)
Modularity
Inheritance
Encapsulation
Abstraction
OO Core Concepts
![Page 16: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/16.jpg)
Modularity
Inheritance
Encapsulation
Abstraction
Polymorphism & Interfaces
OO Core Concepts
![Page 17: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/17.jpg)
Patterns
State
Command
Decorator
Memento
MVC
Singleton
Factory
Proxy
![Page 18: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/18.jpg)
UMLUnified Modeling Language
What is UML?
UML is used to specify, visualize, modify, construct and document the artifacts of an object oriented software intensive system
![Page 19: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/19.jpg)
UMLUnified Modeling Language
Why is UML useful?
![Page 20: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/20.jpg)
UML
Use Case
Activity
Class
Sequence
Collaboration
State
Component
More...
Unified Modeling Language - Diagrams
![Page 21: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/21.jpg)
UMLUnified Modeling Language - Diagrams
![Page 22: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/22.jpg)
UMLUnified Modeling Language
DiagramsUse Case
![Page 23: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/23.jpg)
UMLUnified Modeling Language - DiagramsClass
![Page 24: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/24.jpg)
UMLUnified Modeling Language - DiagramsClass
![Page 25: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/25.jpg)
UML
UML modeling tools
gModeler
More info:
http://www.uml.org
Unified Modeling Language - Diagrams
![Page 26: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/26.jpg)
How?
![Page 27: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/27.jpg)
Anatomy of a Class
Package definition
Class definition
Class Constructor
Class Instantiation
Variable definition
Access modifiers (Public, Private, Protected & Internal)
![Page 28: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/28.jpg)
Anatomy of a Class Package definition
package com.earth.animals{
}
![Page 29: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/29.jpg)
Anatomy of a Class Class definition
package com.earth.animals{public class Mammal extends Animal{}}
![Page 30: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/30.jpg)
Anatomy of a Class Class Constructor
package com.earth.animals{public class Mammal extends Animal{
public function Mammal(){}
}}
![Page 31: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/31.jpg)
Anatomy of a Class Class Imports and Variable definitions
package com.earth.animals{import com.earth.animals.Dog
public class Mammal extends Animal{private var myDog:Dog;
public function Mammal(){
}}}
![Page 32: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/32.jpg)
Anatomy of a Class Class Instantiation
package com.earth.animals{import com.earth.animals.Dog
public class Mammal extends Animal{private var myDog:Dog;
public function Mammal(){myDog = New Dog();
}}}
![Page 33: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/33.jpg)
Anatomy of a Class Access Modifiers (Public, Private, Protected & Internal)
![Page 34: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/34.jpg)
Anatomy of a Class Access Modifiers (Public, Private, Protected & Internal)
Public: The public modifier provides access for external classes i.e. those who are not a part of same package or same class, to modify or invoke public members.
![Page 35: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/35.jpg)
Anatomy of a Class Access Modifiers (Public, Private, Protected & Internal)
Private: The private modifier is very much private for the owner class where the private members can only be called/modified by the owner class itself. The privatemembers are not exposed to external, instances or extended classes.
![Page 36: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/36.jpg)
Anatomy of a Class Access Modifiers (Public, Private, Protected & Internal)
Protected: You can call the Protected method/members in a subclass i.e. the class which is inheriting from the class having protected members.
![Page 37: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/37.jpg)
Anatomy of a Class Access Modifiers (Public, Private, Protected & Internal)
Internal: The internal methods or properties are built to be shared across a common package.
![Page 38: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/38.jpg)
Anatomy of an Interface
Packages
Classes
Instantiation
![Page 39: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/39.jpg)
What methods areavailable
What parameters thosemethods accept
What, if any, types arereturned by those methods
Polymorphism & Interfaces
An Interface indicates and dictates :
![Page 40: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/40.jpg)
Polymorphism & Interfacespackage package {public interface IAnimal {
function procreate(parameter:Type)ReturnType;function set noOfLegs(value:Type):void;function get noOfLegs():ReturnType;}}
![Page 41: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/41.jpg)
Polymorphism & Interfacespublic class Mammal implements IAnimal
public class Reptile implements IAnimal
![Page 42: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/42.jpg)
FinallyBe pragmatic
Read up on UML, Patterns and OO
Don’t pretend to see the Emperor’s new clothes
Don’t strictly enforce Patterns - they are guidelines
Don’t over engineer
Think about maintenance but only when it will be maintained
![Page 43: Moving to OOD](https://reader038.fdocuments.net/reader038/viewer/2022102816/55cad8a3bb61ebfe198b45a1/html5/thumbnails/43.jpg)
Thank you. Now where’s my beer?
www.pokercoder.com
www.flashcoder.net/blog
blog.logicbureau.com
Adobe User Group
Apress User Group