oop in java
DESCRIPTION
TRANSCRIPT
OOP in JavaOOP in JavaIntroduction to the world of software Introduction to the world of software
engineering, object-oriented programming engineering, object-oriented programming and Javaand Java
Thomas [email protected]
www.wiradikusuma.com
Presentation to the 18th Java User Group Meet Up (JaMU), January 14, 2006
AgendaAgenda
Quick tour on software Quick tour on software engineeringengineering
Object-oriented conceptObject-oriented concept Introduction to JavaIntroduction to Java OO approach in JavaOO approach in Java
ObjectiveObjective
To attract newcomers into the field To attract newcomers into the field of programming and software of programming and software development, practically using development, practically using
Java as their language of choice.Java as their language of choice.
Programming DefinedProgramming Defined
Algorithm and ProgramAlgorithm and Program Programming languageProgramming language A short tour into Software A short tour into Software
Development Lifecycle Development Lifecycle (SDLC), from Waterfall to (SDLC), from Waterfall to Iterative DevelopmentIterative Development
Joys and Woes of Joys and Woes of ProgrammingProgramming
The joysThe joys The woesThe woes
Program EvolutionProgram Evolution
ProgramProgram ProgramminProgramming Systemg System
ProgramminProgramming Productg Product
ProgramminProgramming Systems g Systems ProductProduct
Common PitfallsCommon Pitfalls
Schedule slippageSchedule slippage Project objectives slippageProject objectives slippage Unrealistic budgetUnrealistic budget Lack of documentationLack of documentation Hard to extendHard to extend
Essence of Modern Essence of Modern SystemsSystems
ComplexityComplexity ConformityConformity ChangeabilityChangeability InvisibilityInvisibility
Hope for Silver BulletsHope for Silver Bullets
High-level language advancementsHigh-level language advancements Object-oriented programmingObject-oriented programming Graphical programming (diagramming)Graphical programming (diagramming) Incremental and iterative developmentIncremental and iterative development Rapid prototypingRapid prototyping Great designersGreat designers ……
Object-oriented Object-oriented ProgrammingProgramming
Essence: AbstractionEssence: Abstraction Principals:Principals:
EncapsulationEncapsulation InheritanceInheritance PolymorphismPolymorphism
AbstractionAbstraction
Humans manage complexity through Humans manage complexity through abstractionabstraction
For example, people do not think a For example, people do not think a car as a set of tens of thousands of car as a set of tens of thousands of individual parts. They think of it as a individual parts. They think of it as a well-defined object with its own well-defined object with its own unique behaviorunique behavior
A powerful way to manage A powerful way to manage abstraction is through the use of abstraction is through the use of hierarchical classifications (layers)hierarchical classifications (layers)
EncapsulationEncapsulation
The mechanism that binds together code and The mechanism that binds together code and the data it manipulatesthe data it manipulates
Protective wrapper that prevents the code and Protective wrapper that prevents the code and data from being misused outside the wrapperdata from being misused outside the wrapper
Controlled through a well-defined interfaceControlled through a well-defined interface Allows migration of implementation without Allows migration of implementation without
breaking contract with users of that classbreaking contract with users of that class In Java, the basis of encapsulation is the classIn Java, the basis of encapsulation is the class
InheritanceInheritance The process by which one object The process by which one object
acquires the properties of another acquires the properties of another objectobject
Supports the concept of hierarchical Supports the concept of hierarchical classificationclassification
Using inheritance, object needs only Using inheritance, object needs only define qualities that make it unique. define qualities that make it unique. General attributes are inherited from its General attributes are inherited from its parentparent
The concept of super class and sub classThe concept of super class and sub class
PolymorphismPolymorphism
Feature that allows one interface to Feature that allows one interface to be used for a general class of be used for a general class of actions. The specific action is actions. The specific action is determined by the exact nature of determined by the exact nature of the situationthe situation
One interface, multiple methodsOne interface, multiple methods Allows creation of clean, sensible, Allows creation of clean, sensible,
readable and resilient codereadable and resilient code
Benefits of OO ApproachBenefits of OO Approach
Objects are more “real-world”Objects are more “real-world” Objects provide the flexibility and Objects provide the flexibility and
control necessary to deal with control necessary to deal with evolving requirementsevolving requirements
Object use facilitates collaborationObject use facilitates collaboration Objects help manage complexityObjects help manage complexity Reusability, maintainability and Reusability, maintainability and
extensibilityextensibility
Introducing JavaIntroducing Java
A little historyA little history Buzzwords: simple, object-oriented, Buzzwords: simple, object-oriented,
robust, multithreaded, architecture-robust, multithreaded, architecture-neutral, interpreted and high neutral, interpreted and high performance, distributed, dynamicperformance, distributed, dynamic
Java platforms: JavaME, JavaSE, Java platforms: JavaME, JavaSE, JavaEEJavaEE
Applied OOP in JavaApplied OOP in Java
Class as the unit of workClass as the unit of work Everything but primitive types are Everything but primitive types are
objectsobjects Encapsulation, inheritance and Encapsulation, inheritance and
polymorphism in actionpolymorphism in action InterfaceInterface Design patternsDesign patterns
Being a ProgrammerBeing a Programmer
Read literaturesRead literatures ExerciseExercise Take course in computer scienceTake course in computer science Get involved in actual projects (start Get involved in actual projects (start
from something simple and advancing!)from something simple and advancing!) Get involved in discussions/forums Get involved in discussions/forums
(such as Java User Groups)(such as Java User Groups) ……