The Common Sense of Object Oriented Programming

The Common Sense of Object Oriented Programming

The Common Sense of Object Oriented Programming Trygve Reenskaug Department of Informatics, University of Oslo, Norway Home: http://folk.uio.no/trygver E-mail: Abstract. The essence of object orientation is that networks of collaborating objects work together to achieve a common goal. Surely, the common sense of object oriented programming should reflect this essence with code that specifies how the objects collaborate. Our industry has, unfortunately, chosen differently and code is commonly written in terms of classes. A class tells us everything about the properties of the individual objects that are its instances. It does not tell us how these instances work together to achieve the system behavior. The result is that our code does not reveal everything about how a system will work. This is clearly not satisfactory, and we need a new paradigm as the foundation for more expressive code. We propose that DCI (Data-Context-Interaction) is such a paradigm. DCI separates a program into different perspectives where each perspective focuses on certain system properties. Code in the Data perspective specifies the representation of stand-alone objects. Code in the Context perspective specifies runtime networks of interconnected objects. Code in the Interaction perspective specifies how the networked objects collaborate to achieve the system behavior. BabyIDE is an interactive development environment that supports the DCI paradigm with specialized browsers for each perspective. These browsers are placed in overlays within a common window so that the programmer can switch quickly between them. DCI with BabyIDE marks a new departure for object oriented programming technology. It opens up a vista of new and interesting product opportunities and research challenges. Some of these challenges and opportunities are touched upon in a final chapter of this report. Keywords. Object-oriented programming – Object oriented methods – Static object structures – Dynamic object structures – late binding – collaboration – role model – IDE – BabyUML – BabyIDE The BabyIDE home page is at http://heim.ifi.uio.no/~trygver/themes/babyide ©2009 Trygve Reenskaug, Oslo, Norway. Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that the copies are not made for profit or commercial advantage and that copies bear this notice and full citation on the first page. Version of April 13, 2009 3:51 pm Page 1 BabyUML - 005-FirstPage.fm The Common Sense of Object Oriented Programming Table of Contents 1 Introduction and summary............................................................................... 4 2 Roles and Interactions: Visualizing a simple process .................................. 9 3 BabyIDE1, an Environment for true Object-Oriented Programming.......... 15 3. 1 The BB1ClassBrowser ............................................................................. 16 3. 2 The BB1InteractionBrowser ...................................................................... 17 4 BB5Bank: A Simple Money Transfer Program According to DCI .............. 20 4. 1 Money Transfer in the Interaction Perspective ......................................... 20 4. 2 Money Transfer in the ATM Perspective .................................................. 21 4. 3 Money Transfer in the Data Perspective .................................................. 22 4. 4 Money Transfer in the Context Perspective ............................................. 23 4. 5 Testing the Money Transfer application ................................................... 23 5 MVC and DCI - Two paradigms for readable code....................................... 25 5. 1 MVC: the Model-View-Controller paradigm .............................................. 26 5. 2 DCI: the Data-Context-Interaction paradigm ............................................ 27 5. 2. 1 The Data perspective ...................................................................................27 5. 2. 2 System behavior: The Context and Interaction perspectives .......................28 6 The BB2Shapes Process Visualization Program......................................... 31 6. 1 The BB2Shapes program seen in the Data perspective .......................... 31 6. 2 The BB2Shapes program seen in the Window perspective ..................... 32 6. 2. 1 The BabyShapes2 ArrowsAnimation System Operation ..............................34 ArrowsAnimation in the Context perspective ...........................................................34 ArrowsAnimation in the Interaction perspective ......................................................35 6. 2. 2 The ShapesAnimation use case ...................................................................36 ShapesAnimation in the Context perspective ..........................................................37 ShapesAnimation in the Interaction perspective .....................................................37 7 BB4bPlan: An Activity Network Planning Program with DCI ..................... 39 7. 1 The BB4b Data perspective ...................................................................... 40 The BB4bModel class .............................................................................................41 The BB4bActivity class ............................................................................................41 The BB4bDependency class ...................................................................................42 7. 2 The BB4b Controller perspective .............................................................. 42 7. 3 The BB4b>>frontload System Operation .................................................. 43 7. 3. 1 BB4b frontload in the Interaction perspective ...............................................44 7. 3. 2 BB4b frontload in the Context perspective ...................................................45 7. 4 The BB4b View perspective ..................................................................... 46 BB4bActivityView ....................................................................................................46 BB4bDependencyView ............................................................................................47 BB4bGanttView .......................................................................................................47 7. 5 The BB4DependencyView>>refresh System Operation .......................... 48 7. 5. 1 BB4bDependencyView>>refresh in the Interaction perspective ..................48 7. 5. 2 BB4bDependencyView>>refresh in the Context perspective .......................49 7. 6 The BB4bGanttView>>refresh operation .................................................. 50 7. 6. 1 BB4bGanttView>>reset in the Interaction perspective .................................51 7. 6. 2 BB4bGanttView>>refresh in the Context perspective ..................................52 8 BB4aPlan: A Conventional Activity Network Planning Program ............... 53 8. 1 BB4a Data classes ................................................................................... 53 Activity .....................................................................................................................53 Dependency ............................................................................................................53 Model .......................................................................................................................53 Version of April 13, 2009 3:51 pm Page 2 BabyUML - 900-BBTOC.fm 8. 2 The BB4a Controller class ........................................................................ 55 8. 3 The BB4a View classes ............................................................................ 55 ActivityView .............................................................................................................55 DependencyView ....................................................................................................55 GanttView ................................................................................................................56 9 Support for Programming with Roles in Squeak ......................................... 57 9. 1 The BB1Context class .............................................................................. 58 9. 1. 1 Binding Roles to objects at runtime ..............................................................58 9. 2 Finding the Context instance .................................................................... 59 9. 3 Use Role names in code .......................................................................... 61 9. 4 ........................................................................................ Methodful Roles 62 10 The BabyIDE1 implementation .................................................................... 64 11 Conclusion .................................................................................................... 64 12 Further work.................................................................................................. 67 13 Acknowledgements ...................................................................................... 67 14 References..................................................................................................... 69 Appendix 1: Baby Terminology.......................................................... 71 Version of April 13, 2009 3:51 pm Page 3 BabyUML - 900-BBTOC.fm 1 Introduction and summary In his 1991 Turing Award Lecture, Tony Hoare succinctly stated the

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    74 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us