170 likes | 259 Views
Advanced Object Oriented Systems. (CM0318) Introductory Lecture (Last modified: 28th January 2002). Suggested linked list implementation. 2 classes: MyLinkedList and MyLink (NB actually Java provides a class LinkedList). MyLinkedList. instance variables: MyLink first MyLink last int size
E N D
Advanced Object Oriented Systems (CM0318) Introductory Lecture (Last modified: 28th January 2002)
Suggested linked list implementation • 2 classes: MyLinkedList and MyLink(NB actually Java provides a class LinkedList)
MyLinkedList • instance variables: • MyLink first • MyLink last • int size • methods: • MyLinkedList() • void add(Object element) • Enumeration elements() • int size() • ...
MyLink • Instance variables • MyLink next; • Object element;
Suggested Deptl. Info. System implementation • Classes include: • Lecturer • Student • Module • (Department)
Lecturer • instance variables: • String name (or could be split up into parts) • Vector modules_given • methods: • void add_module(Module m) • Enumeration all_modules() (or Vector?) • (optionally things to set the name, etc., which could then be made private)
Student • instance variables • String name (or could be split up into parts) • int student_number (or should it be a String?) • Vector modules_taken • methods • things to add a module, etc., similar to Lecturer
Module • instance variables • String module_code • String module_title • methods • accessors (set code, etc.)
Department • instance variables • Vector lecturers • Vector students • Vector available_modules • methods • Vector lecturer_names() (or Enumeration?) • Vector all_students()
Note Well • Always more than one way to model a problem! • Because of Java’s type system, collections like Vectors are horrible to use - but better than nothing! E.g. to iterate through the lecturers’ names you’ll need code like this: Enumeration e = lecturers.elements(); while (e.hasMoreElements()) { do_something_with( ((Lecturer) e.nextElement()).name);}
Topics • Why OO? • intuitive • modelling • software quality • reuse • Features of OO that give these qualities
Java • Using the libraries • Modelling non-trivial problems
Design • ACJ: • Design by contract • AIA: • Methodologies • Communicating design • CRC Cards • UML • Design patterns
Other OO languages • Dynamically typed languages • Smalltalk • Self (classless!!) • Statically typed languages • C++ • Eiffel (NB supports design by contract)
Building systems interactively • ACJ: • The Smalltalk programming environment approach • AIA: • The CASE approach
Distributed objects - CORBA • Language & platform independence • Wrapping legacy applications
Implementation of OO languages • Memory management • Virtual machines • Bottlenecks & clever ideas!!