oop in java

18
OOP in Java OOP in Java Introduction to the world of software Introduction to the world of software engineering, object-oriented engineering, object-oriented programming and Java programming and Java Thomas Wiradikusuma [email protected] www.wiradikusuma.com Presentation to the 18 th Java User Group Meet Up (JaMU), January 14, 2006

Upload: wiradikusuma

Post on 01-Dec-2014

5.311 views

Category:

Technology


13 download

DESCRIPTION

 

TRANSCRIPT

Page 1: OOP in Java

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

Page 2: OOP in Java

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

Page 3: OOP 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.

Page 4: OOP in Java

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

Page 5: OOP in Java

Joys and Woes of Joys and Woes of ProgrammingProgramming

The joysThe joys The woesThe woes

Page 6: OOP in Java

Program EvolutionProgram Evolution

ProgramProgram ProgramminProgramming Systemg System

ProgramminProgramming Productg Product

ProgramminProgramming Systems g Systems ProductProduct

Page 7: OOP in Java

Common PitfallsCommon Pitfalls

Schedule slippageSchedule slippage Project objectives slippageProject objectives slippage Unrealistic budgetUnrealistic budget Lack of documentationLack of documentation Hard to extendHard to extend

Page 8: OOP in Java

Essence of Modern Essence of Modern SystemsSystems

ComplexityComplexity ConformityConformity ChangeabilityChangeability InvisibilityInvisibility

Page 9: OOP in Java

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 ……

Page 10: OOP in Java

Object-oriented Object-oriented ProgrammingProgramming

Essence: AbstractionEssence: Abstraction Principals:Principals:

EncapsulationEncapsulation InheritanceInheritance PolymorphismPolymorphism

Page 11: OOP in Java

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)

Page 12: OOP in Java

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

Page 13: OOP in Java

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

Page 14: OOP in Java

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

Page 15: OOP in Java

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

Page 16: OOP in Java

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

Page 17: OOP in Java

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

Page 18: OOP in Java

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) ……