150 likes | 360 Views
History of Object Orientation. What is Object-Orientation?. Programming is one of the most complicated and difficult of human activities . It helps a great deal with developed a real world solution to the problem. requirements are easier to understand,
E N D
What is Object-Orientation? • Programming is one of the most complicated and difficult of human activities. • It helps a great deal with developed a real world solution to the problem. • requirements are easier to understand, • more realism in the expectations of others, • debugging eased by access to the real world solution. • This informal approach—the design of the programme reflects objects and their behaviour in the real world—is called “object-oriented programming” • First adopted by simulation programmers ca. 1960.
Strengths and Weaknesses of Object-Orientation • Strengths: • the underlying objects are usually well-defined and unchanging • the structure of the solution is the thing that changes. • Weaknesses: • It is often very hard to grasp the behaviour of the system as a whole, and • There is no ‘best’ object decomposition for a system of any size.
Start with Objects • So we start with objects. • Correspond to real things, having state and behaviour. • Computation performed by objects communicating with each other (“message passing”). • Objects have memory (“state”), consisting of other objects. • Each object belongs to a class, which defines the behaviour for objects in that class. • Classes inherit behaviour from other, more general classes, forming a hierarchy. • Alan Kay (1993) identified these characteristics as fundamental to object-oriented programming.
Too Simple? • Now this is clearly too simple. • Consider a bat colony—the objects are bats, which communicate and have memory. • Much of their behaviour is general for bats, rather than specific to an individual bat, but it is also clear that bats are individuals and do internal computation, so an object-oriented model of a bat colony misses a lot. • Also, bats change their behaviour (‘class’) with age. • However, a model of the bat colony that fails to deal the bats as individual behaving objects will miss a lot. • An object-oriented model is in the right direction.
A Definition • Object-oriented design and programming is an approach to defining a solution to a problem that uses the system's natural structure as a system of interacting, behaving objects to provide a programming solution. • Although it will still miss some of the constraints that would apply to a real-world solution, it provides an approach to design that promises to reduce the space of alternative designs enough that the programmer is no longer working with abstract thought.
Ancestry of Object-Oriented Programming • The ancestry of the object-oriented programming can be found in imperative and applicative languages. (Languages that define processing instead of state and relations.) • The object-oriented paradigm emerged into the general software community from the simulation community in the early 1970s.
Simulation Objects • Simulation programmers have always viewed the world as objects and semantic relationships, and this led to a natural programming model consisting of objects with • Identity (object names or references) • Behaviour (attributes or methods) and • State (internal data).
ALGOL • ALGOL 58 and 60 were early languages designed to express the constructs of structured programming in a fashion that could be reasoned about effectively. • Ancestors of many languages, including Pascal, C, C++, C#, Java, Ada, and the simulation language, Simula.
SIMULA • SIMULA 1 and 67 were defined by Nygaard and Dahl as object-oriented extensions of ALGOL. • Given that object orientation did not exist at the time, it is probably more accurate to describe it as a simulation language based on ALGOL 60 that incorporated much of what later would become known as object-orientation. • In addition to the features most of us would recognize, it incorporated something elegant called the ‘coroutine’. • This is an instantiation of a subroutine with storage for input and local data that could interact as an object with other coroutines. • The corresponding concept in C++ and Java is the functor.
SmallTalk • SmallTalk (Goldberg and Robson, 1982) was a consistent attempt to define computation as objects interfacing by message passing. • Everything, including primitive types, was an object, and all function calls were implemented using messages. • This included primitive arithmetic operations! • Smalltalk is slow (at least ten times slower than C++) but is easy to write in if you can understand the model of computation. • I developed a major simulation for NASA in Smalltalk about 1990, and found it a delightful language.
C++ • C++—Bjarne Stroustrup (Stroustrup, various) designed C++ as ‘C with classes’ to support his simulation work. • This language has become remarkably popular, and is, with Java, one of the two major OO languages. • The 1995 version is remarkably powerful. • My primary O-O expertise is in C++—I’m a simulation modeller—and I’ve been involved in the standards definition for the current version.
Java • Java—A language deliberately designed for object-oriented programming in embedded environments. This module uses Java 5. • Popular for web and cross-platform independent applications. • Evolving towards C++.
Ada • Ada 95 (AARM, 1995) is the latest generation of Ada. • Originally designed (on the basis of Pascal) to be a high-reliability language for embedded systems, but soon accumulated features to support almost any US Department of Defense application. • Not designed to be object-oriented, but during the 1980s-90s, support for object-oriented programming was added to the wish-list. • Named after Augusta Ada Byron, Lady Lovelace, a daughter of Lord Byron and the first computer programmer.