Martin Q. Zhao 9/20/2013.  Dao De Jing (Tao-Te Ching) & Lao Zi (Lao Tzu)  Dao of Programing  Building the Virtual World  OOAD Principles in Dao De.

Slides:



Advertisements
Similar presentations
ARCH-05 Application Prophecy UML 101 Peter Varhol Principal Product Manager.
Advertisements

Template, Command, Iterator and Composite CSE 111 5/9/20151Copyright W. Howden.
Chapter 1 Object Oriented Analysis and Design. UML, Patterns, and Object-Oriented Analysis and Design  The essential skills for the creation of well-designed,
Page 1 Building Reliable Component-based Systems Chapter 7 - Role-Based Component Engineering Chapter 7 Role-Based Component Engineering.
Introduction To System Analysis and Design
1 Software Testing and Quality Assurance Lecture 12 - The Testing Perspective (Chapter 2, A Practical Guide to Testing Object-Oriented Software)
1 SWE Introduction to Software Engineering Lecture 23 – Architectural Design (Chapter 13)
Object Oriented System Development with VB .NET
© 2005 Prentice Hall8-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Feb. 23, 2004CS WPI1 CS 509 Design of Software Systems Lecture #5 Monday, Feb. 23, 2004.
Itntroduction to UML, page 1 Introduction to UML.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
3/15/05H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
UML and Object Oriented Concepts
Introduction To System Analysis and design
Object Oriented Software Development
Table-Driven Acceptance Testing Mario Aquino Principal Software Engineer Object Computing, Inc.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
GRASP Principles. How to Design Objects The hard step: moving from analysis to design How to do it? –Design principles (Larman: “patterns”) – an attempt.
Martin Q. Zhao 11/13/2013.  Intro  Dao De Jing (Tao-Te Ching) & Lao Zi (Lao Tzu)  Taoism and Lao Tzu in Chinese History  Dao in Ten Words  Q&A.
Software Design Refinement Using Design Patterns Instructor: Dr. Hany H. Ammar Dept. of Computer Science and Electrical Engineering, WVU.
05 - Patterns Intro.CSC4071 Design Patterns Designing good and reusable OO software is hard. –Mix of specific + general –Impossible to get it right the.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Architecture GRASP Realization of use cases in interaction diagrams Design class diagram Design ( how )
Introduction To System Analysis and Design
Design Patterns. Patterns “Each pattern describes a problem which occurs over and over again in our environment, and then describes the core of the solution.
Y2 eProjects Session 4 – Advanced Topics. Objectives  Dynamic Models  Design Patterns (Optional)  Software testing (for S4) ACCP i7.1\Sem3_4\eProject\T4.
Object-Oriented Design Principles and Patterns. © 2005, James R. Vallino2 How Do You Design? What principles guide you when you create a design? What.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 14 Slide 1 Object-oriented Design.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Chapter 38 Persistence Framework with Patterns 1CS6359 Fall 2011 John Cole.
Design Principle & Patterns by A.Surasit Samaisut Copyrights : All Rights Reserved.
ECE450S – Software Engineering II
Object-Oriented Modeling: Static Models. Object-Oriented Modeling Model the system as interacting objects Model the system as interacting objects Match.
Summing Up Object Oriented Design. Four Major Components: Abstraction modeling real-life entities by essential information only Encapsulation clustering.
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Salman Marvasti Sharif University of Technology Winter 2015.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
9 - Class & Method Design Model Enhancement Design to Code Proposal Presentation.
Design Patterns Introduction
The Strategy Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Object-Oriented Design Concepts University of Sunderland.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
Object Design More Design Patterns Object Constraint Language Object Design Specifying Interfaces Review Exam 2 CEN 4010 Class 18 – 11/03.
3/1/01H-1 © 2001 T. Horton CS 494 Object-Oriented Analysis & Design Evaluating Class Diagrams Topics include: Cohesion, Coupling Law of Demeter (handout)
Lecture 2 Intro. To Software Engineering and Object-Oriented Programming (1/2)
Sadegh Aliakbary Sharif University of Technology Fall 2010.
GRASP – Designing Objects with Responsibilities
Design Patterns: MORE Examples
Software Design Refinement Using Design Patterns
Design Patterns: Brief Examples
Chapter 12: Collaboration Diagram - PART2
Conception OBJET GRASP Patterns
Chapter 11 Object-Oriented Design
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
Instructor: Dr. Hany H. Ammar
The Dao of Object-Orientation
Software Engineering Lecture 7 - Design Patterns
Informatics 122 Software Design II
Slides by Steve Armstrong LeTourneau University Longview, TX
Review CSE116 2/21/2019 B.Ramamurthy.
CMPE 135 Object-Oriented Analysis and Design March 21 Class Meeting
What Is Good Software(Program)?
Informatics 122 Software Design II
Chapter 8, Design Patterns Introduction
Agenda Software development (SD) & Software development methodologies (SDM) Orthogonal views of the software OOSD Methodology Why an Object Orientation?
Presentation transcript:

Martin Q. Zhao 9/20/2013

 Dao De Jing (Tao-Te Ching) & Lao Zi (Lao Tzu)  Dao of Programing  Building the Virtual World  OOAD Principles in Dao De Jing

The Tao Name, concept Nothingness, emptiness Existence 10,000 things, objects Subtlety Heaven & earth, the world Beginning The Tao that can be expressed in words is not the true and eternal Tao… (Tao:1)

M & T Books (December 1990) Info Books (September 1986) Patrick Burns (December 16, 2012) Addison-Wesley Professional; 1 edition (July 22, 2004) Hayden Books; 2 Pap/Dskt edition (July 1994)

 The discipline of computing is …  Computer programs: sets of instructions written in programming languages that automate Real World information transformation processes  Develop a software system is like building a “Virtual World” the systematic study of algorithmic processes that describe and transform information: their theory, analysis, design, efficiency, implementation, and application. The fundamental question underlying all of computing is, ‘What can be (efficiently) automated?’

 Software systems can be boiled down to  Systems: the solution as a whole (virtual worlds)  Programs: organizational units of code (or the VW)  Procedures: sequences of instructions as a unit  Statements: instructions  Expressions: meaningful combo of tokens  Tokens: variables, constants, operators, punctuations

 Procedural approach, aka Structured Programming ( mid-1960’s )  OO approach ( since 1980’s )  Data and algorithms go together (in an object)  No “top” unit Data Procedures Or ways to process data top

 Real World (aka Problem Domain)  Consists of objects (or entities)  Virtual World (aka Solution Domain)  Specs of classes  Objects created at runtime (when VW is alive) Name Address Payment method Brand Category Price Employee ID Name Phone

 Now let’s focus on the Virtual World  Building the VW involves defining the classes that will be used to create objects at runtime 有物混成,先天地生。 寂兮寥兮,独立而不改。 周行而不殆,可以为天地母。 吾不知其名,强字之为道 , 强为之名曰大 。 There is a thing integratedly formed And born earlier than Heaven and Earth. Silent and empty, it relies on nothing, Moving around forever. We may regard it as the mother of all things I don’t know its name, so I name it as Tao, And further name it as Great. (Tao:25) Object(s) S/W System- VW

 What is the simplest Java class?  Can it be used to create any object?  But can this object be used?  What happens behind the scene?  Class Object is the “mother” of all Java classes class A {}class Dummy {} class DummyTest { public static void main (String[] x) { Dummy d = new Dummy(); } System.out.println(d); Add it here extends Object Add it here Inheritance

 An object has a type  Object : instance of a class, created at runtime  Class : template of all objects of the same type  An object has an identity  Two labs in CSB may look the same, but each is a unique entity  (Classes of) objects have their responsibilities: they need to  Know some information  perform some operations o:Order -orderId=101 -orderDate=1/1/11 +calOrderTotal() … Abstraction

 One easy choice  Just use one GOD CLASS, which  Knows everything and can do everything  But that is not OO, which tends to  Partition system into many classes around RW concepts, and  Distribute intelligence/behavior evenly among them 天地不仁,以万物为刍狗 … Heaven and Earth have no favorite, They deem all objects as equally common. (Tao:5) R. Martin (2003) Prentice Hall UML for Java Programmers

 Keep being simple in nature and mind ( 见素抱 朴 )  close to Tao  to avoid “an early end” ( 不道早已 :whatever goes against Tao will come to an early end )  Keeping classes’ responsibilities simple (or cohesive), helps reuse & improve system maintainability 五色令人目盲; 五音令人耳聋; 五味令人口爽; 驰聘畋猎,令人心发狂; 难得之货,令人行妨。 The five colors make man blind; The five sounds make man deaf; The five tastes make man lose his sense of taste; Riding and hunting make man wild w/ excitement; Rare goods goad man into stealing... (Tao:12)

 Instead of using all-purpose objects, objects with a single responsibility are preferred R. Martin (2002) Prentice Hall Agile Software Development Maintainability

 Focus on the three types of objects 道生一, 一生二, 二生三, 三生万物。 Tao begets the One; The One consists of Two in opposition (the Yin and Yang); The two begets the Three; All things connote the Yin and Yang. (Te:42) Tao begets the One; The One begets the Two; The Two begets the Three; The Three begets 10,000 things. (Te:42) (Cont’d on next slide)

Customer SalesRep CustomerForm SalesRepForm OrderFulfillControl OrderControl CustomerEntity OrderEntity ProductEntity System Boundary Actors

Entity classes usually represent a domain-specific situation or RW object Need to be saved between sessions Control classes represent a workflow, control, or calculation process Boundary classes are used to model interaction between the system and its actors. Jacobson, Booch, & Rambaugh (1999) Addison-Wesley The Unified Software Development Process

 Each object can do only one thing  To fulfill its responsibility, an object can ask for help from (aka collaborate with) another object  Object collaboration is done by message passing  A message has  A recipient  An operation requested  Additional information to carry out the operation changeGears(5) me:Rider myBike:Bike Java online tutorials: What Is an Object?

Delegation objectA objectB client  One way to get help is to delegate  The client object will “do nothing” ( 无为 ) itself  It delegates reuses the service from the “server” object that implements it  The client and server roles are specific for each episode server client (Take) no action Choose to (take) no action

 The Design by Contract approach prescribes  software designers should define formal, precise and verifiable interface specifications for software components (i.e. classes), including  Services/operations to provide, and  For each operation, to specify  Preconditions: need to be true before it’s carried out; Preconditions  Postconditions: need to be true after it’s completed, and Postconditions  Invariants: need to hold true during the object’s life time Invariants  These specifications are referred to as "contracts". Encapsulation Mitchell & McKim (2002) Addison-Wesley Design by Contract, by example

Thirty spokes share one hub. It is just the space (the Nothingness) between them that makes a cart function as a cart. (Tao:11)

Reusability  An abstract class may have some operations not implemented (in another word, left empty)  An interface is a purely abstract class in which no operations may be implemented  Interfaces and abstract classes are commonly used in design patterns [A design] pattern describes a problem that occurs over and over again in our environment, and then describes the core of the solution to that problem, in such a way that you can use this solution a million times over, without ever doing it the same way twice. Alexander, Christopher (1977) Oxford University Press. A Pattern Language: Towns, Buildings, Construction.

Composite pattern Client

Façade pattern Client

Abs. Factory pattern

E1T1TankFactory +createTank():E1T1Tank +createShell():E1T1TankShell E1T1Tank E1T1TankShell

Command pattern A hook method in the Java AWT API > KeyListener +keyPressed(e:KeyEvent) +keyReleased(e:KeyEvent) +keyTyped(e:KeyEvent) KeyHandler +keyPressed(e:KeyEvent) +keyReleased(e:KeyEvent) +keyTyped(e:KeyEvent) AbstractTank MyGamePanel MyGameFrame

 Another way to reuse is to use frameworks  A framework provides collections of interfaces, abstract classes, and concrete classes  Sample frameworks in Java  Swing, AWT: from GUI (boundary objects)  JDBC/IO/NIO: for saving entity objects to DB or files  Collections: for managing entity objects

天下之至柔,驰骋天下之至坚。 The most supple in the world, Can go through the hardest in the world. (Te:43) The perfect goodness is like water. (Tao:8) 天下莫柔弱于水,而攻坚强者莫 之能胜,以其无以易之。 Nothing in the world is more supple than water, Yet nothing is more powerful than water In attacking hard and strong. (Te:78)

 Favor flexibility over rigidity 人之生也柔弱,其死也坚强。 万物草木之生也柔脆,其死也枯槁。 故坚强者死之徒,柔弱者生之徒。 …… 强大处下,柔弱处上。 While alive, a person’s body is supple; when dead, it becomes rigid. While alive, grass and trees are supple; when dead, they become dry and stiff. Thus the hard and strong is of the dying sort; the supple and weak is of the living sort. … … Thus the strong and big is inferior to the weak and supple. (Te:76)

 Rigidity  Fragility  Immobility  Viscosity  Needless complexity  Needless repetition  Opacity R. Martin (2003) Prentice Hall UML for Java Programmers