CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A....

26
CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009

Transcript of CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A....

Page 1: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

CSE311 – Object Oriented Design and Implementation

Lecture 1Introduction to Course

Shakeel A. KhojaSept 2009

Page 2: 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

Page 3: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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)

Page 4: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 5: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 6: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 7: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 8: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 9: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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?

Page 10: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 11: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 12: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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)

Page 13: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 14: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 15: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

Design Patterns

Page 16: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 17: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 18: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 19: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

Assessment Strategy

• Mid-terms 30% (15+15)• Final terms 40%• Quizzes 10% • Project 20%

Page 20: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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!

Page 21: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 22: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

Problem Solving

Engg Approach• Formulation• Analysis• Search for possible

solutions• Deciding

appropriate solution• Specifying solution

OODD Approach• Requirement

Elicitation• Analysis• System Design• Object Design• Implementation

Page 23: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 24: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

Rationale

• Assumptions change constantly• Causes of change– New technology– Misunderstanding Requirements– Design and Implementation Challenges

Page 25: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

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

Page 26: CSE311 – Object Oriented Design and Implementation Lecture 1 Introduction to Course Shakeel A. Khoja Sept 2009.

Something to keep you busy!1. What is purpose of modeling?

2. Consider a task that you are note familiar with, such as designing a zero-emissions car. How would you attack the problem?

3. 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.