300 likes | 440 Views
CSE311 – Object Oriented Design and Implementation . Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009. What is Object-Orientation?. Alan Kay* Everything is an object Objects communicate by sending and receiving messages (in terms of objects)
E N D
CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009
What is Object-Orientation? • Alan Kay* • Everything is an object • Objects communicate by sending and receiving messages (in terms of objects) • Objects have their own memory (in terms of objects) • Every object is an instance of a class (which must be an object) • The class holds the shared behavior for its instances *The Early History of Smalltalk, ACM, 1993
Why Object Oriented? • Why not “Modern Software Development”? • because most software these days is OO • Top 10 languages (cwjobs.co.uk): 1. SQL (6328) 6. XML (4070) 2. C# (4012) 7. VB (1913) 3. C++ (3537) 8. HTML (1604) 4= C (3139) 9. JavaScript (1356) 4= Java (3011) 10. UML (907)
Further Analysis • Java is the top programming language • and C# was less popular than VB • As C# has climbed, Java has fallen back • these languages compete, many similarities • Similarly, C++ competes with C • real-time and embedded systems • “legacy” Windows applications
History of OO Languages • Simula 67: • Dahl & Nygaard, Oslo, simulation • Smalltalk 76: • Kay & Goldberg, Xerox PARC, education • C++, 1986: • Stroustrup, AT&T, OO superset of C • Java, 1995: • Gosling, Sun, smart appliances & the web • C#, 2003: • Hejlsberg, Microsoft, web & windows development
History of OO A&D • 1980s & 1990s: OO A & D emerges • Rumbaugh OMT 1991/6 • Jacobson OOSE 1992/5 • Booch OO A&D 1994/6 • and many others • 1994: OMG propose standardisation • 1995: Three amigos are all at Rational • 1995: Three amigos publish their UML • 1997: OMG standardise UML 1.0 • 2002: IBM buy Rational • 2005: OMG standardise UML 2.0
Why is OO So Popular? • Structured: readable, reasonable code • Modular: good for large-scale programs • Type-checked: avoiding (or trapping) common programming errors • Garbage-collected: simplifies dynamic memory allocation (fewer memory leaks) • Inheritance: simplifies (eg) GUI programs • Interfaces: for components & libraries • Also: re-use, natural syntax, polymorphism
Mega-Languages Usually Fail • Two early examples of large languages • PL/I, IBM, 1960s • Ada, US DoD, 1980s • C++ is another one (still popular) • 48 keywords (C has only 32) • 450 page annotated reference manual • it’s a hybrid, not a pure OO language • many traps [see books by Oualline, Riel] • Little languages are also out of favour at present
Modern OO Languages • Java & C# elegantly synthesise many programming language concepts • earlier OO languages: collections, objects • scripting languages: iterators, maps • functional programming: recursive methods, data types, exceptions, and templates • parallel programming: threads • component-oriented: interfaces (as in CORBA/COM) • symbolic languages: reflection • GUI & system programming: high & low level libraries • Which style of programming is still missing here?
Possible Answers • Database programming (eg SQL) • Declarative programming (eg Prolog) • Real-time programming (but see JRTS) • Large-scale distributed programming • Aspects or generative programming • So there is still scope for programming language research and development
Modern OO A&D • Like C# and Java, UML also synthesises earlier OO A&D techniques • use cases: from Jacobson’s OOSE • class diagrams: ERD (Chen) + inheritance • state diagrams: FSMs + Harel’s statecharts • activity diagrams: flowcharts + Petri nets • sequence diagrams: ITU standard (MSC) • CRC cards: not part of UML, but popular
Why Now? • OOP was invented around the same time as structured programming (1967/68) • Yet structured programming, design, and analysis were adopted much more quickly • Why did OO only go mainstream in the 1990s? • memory constraints small scale issues dominated • C provided a simple way to program a portable CLI • Simple and portable GUI programming only became important in the 1990s (Windows 3.1 & 95) • PCs are only now able to support a secure language (garbage collected, sandboxed)
Agile Methods • OO development often uses agile methods • see http://www.agilealliance.com • Some popular agile methods are • Evo: evolutionary design and development • DSDM: timebox, joint application development • XP: test-driven development, pair programming, refactoring • Crystal Clear: co-location, reflective workshop • Scrum: daily stand-up status meeting
OO: a Scandinavian conspiracy? • Can you name five OO pioneers from Scandinavia? • Dahl, Nygaard, Stroustrup, Jacobson, Hejlsberg • Several others have names suggesting Germanic origins: • Gamma, Goldberg, Strom
Course Structure • Current Plan • Design Patterns • Modern OO A&D (UML, Patterns) • modern CASE tools • Agile Methods (Test-driven, Refactoring) • Traditional and Unified approaches • Current OO Research ( ?? ) • Other topics (please tell me what you want) • Lots of quizzes and homeworks
Text and Reference Books • Bernd Bruegge and Allen H Dutoit, Object Oriented Software Engineering, Using UML Patterns and Java, Pearson-Prentice Hall. • Erich Gamma, Richard Helm, Ralph Johnson, John Vlissides, Design Patterns, Addison Wesley. • Craig Larmen, Applying UML and Patterns, Pearson Education • Pree, Wolfgang, Design Patterns for Object-Oriented Software Development, Addison Wesley. • Various WWW sources
Project • A MEGA project to be assigned to the whole class (> 40KLOC) • Project Specifications and task division will be announced in 2nd week • Class to be divided into small teams with their assigned tasks • Convergence Workshops to be arranged in the last month
Assessment Strategy • Mid-terms 30% (15+15) • Final terms 40% • Quizzes 10% • Project 20%
Modeling • S/W Engg is a modeling activity • Complex Systems • Solving complexity through modeling • Focusing relevant details • A model is an abstract representation of a system that enables us to answer questions about the system • OODD and Modeling!
The amateur software engineer is always in search of magic, some sensational method or tool whose application promises to render software development trivial. It is the mark of the professional software engineer to know that no such panacea exists Grady Booch
Problem Solving • OODD Approach • Requirement Elicitation • Analysis • System Design • Object Design • Implementation Engg Approach • Formulation • Analysis • Search for possible solutions • Deciding appropriate solution • Specifying solution
Knowledge Acquisition • Non – linear • Waterfall model is based on bucket theory • Addition of new knowledge may invalidate all knowledge that has been acquired earlier • 80-20 problem • Risk based development process • Difficult to manage
Rationale • Assumptions change constantly • Causes of change • New technology • Misunderstanding Requirements • Design and Implementation Challenges
Is OODD the savior? • Not exactly, but better then procedural • Better design • Has proper Notations and Methods • Objects and Classes are Re-usable • Management is easy • Better tools • Easy Testing
Reusability • A good software design solves a specific problem but is general enough to address future problems (for example, changing requirements) • Experts do not solve every problem from first principles • They reuse solutions that have worked for them in the past • Goal for the software engineer: • Design the software to be reusable across application domains and designs • How? • Use design patterns and frameworks whenever possible
Design Patterns and Frameworks • Design Pattern: • A small set of classes that provide a template solution to a recurring design problem • Reusable design knowledge on a higher level than datastructures (link lists, binary trees, etc) • Framework: • A moderately large set of classes that collaborate to carry out a set of responsibilities in an application domain. • Examples: User Interface Builder • Provide architectural guidance during the design phase • Provide a foundation for software components industry
Chess Master: Openings Middle games End games Writer Tragically Flawed Hero (Macbeth, Hamlet) Romantic Novel User Manual Architect Office Building Commercial Building Private Home Software Engineer Composite Pattern: A collection of objects needs to be treated like a single object Adapter Pattern (Wrapper): Interface to an existing system Bridge Pattern: Interface to an existing system, but allow it to be extensible Patterns are used by many people
Summary • Software engineering is a problem solving activity • Developing quality software for a complex problem within a limited time while things are changing • There are many ways to deal with complexity • Modeling, decomposition, abstraction, hierarchy • Issue models: Show the negotiation aspects • System models: Show the technical aspects • Task models: Show the project management aspects • Use Patterns: Reduce complexity even further • Many ways to do deal with change • Tailor the software lifecycle to deal with changing project conditions • Use a nonlinear software lifecycle to deal with changing requirements or changing technology • Provide configuration management to deal with changing entities
Something to keep you busy! • What is purpose of modeling? • Consider a task that you are note familiar with, such as designing a zero-emissions car. How would you attack the problem? • A passenger aircraft is composed of several millions of parts and requires thousands of persons to assemble. A four-lane highway bridge is another example of complexity. The first version of Windows Word by Microsoft was released in 1989, required 55 person years, resulted into 249,000 lines of code, and was 4 years late. Aircraft and highway bridges are usually delivered on time and within budget, whereas software is often not. Discuss what are, in your opinion, the differences between developing an aircraft, a bridge and a word processor that would cause this situation.