1 / 25

CSE 301 Exam Revision Lecture

CSE 301 Exam Revision Lecture. harry.erwin@sunderland.ac.uk james.malone@sunderland.ac.uk. Exam Format. Wednesday, 18 May 9:30-12:30 Seaburn Centre 14 Questions in total, Three sections; OO Programming (6 questions) OO Theory (4 questions) OO Practice (4 questions)

Download Presentation

CSE 301 Exam Revision Lecture

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CSE 301Exam Revision Lecture harry.erwin@sunderland.ac.uk james.malone@sunderland.ac.uk

  2. Exam Format • Wednesday, 18 May • 9:30-12:30 • Seaburn Centre • 14 Questions in total, Three sections; • OO Programming (6 questions) • OO Theory (4 questions) • OO Practice (4 questions) • Answer TEN questions, with at least TWO from each section

  3. Specific Advice • Know your Java syntax (ch 2-3, JiaN) • Know how to use the Collection classes • Know the basic patterns from the Pattern book • Know how Java implements the concepts of OO programming • Know the concepts, principles and theory of OO • Know how to use UML • Know the risks and practices discussed in the text • Understand the practices of XP

  4. Basic Programming Topics • Java Operators and Syntax • Primitive Types (definitions and conversion) • Reference Types (including the Object class) • Access Modifiers • Inner Classes • Iterators • Interfaces • Constructors & Constructor Chaining

  5. Intermediate and Advanced Programming Topics • Input/Output • Exception Handling • Collection Classes • Threads and Semaphores • Swing and AWT • Interfacing to the Internet, Serialization, and RMI • Patterns • Garbage Collection

  6. Theory Topics • Definitions (Object, System, etc.) • Interface Segregation Principle (ISP) • Open-Closed Principle (OCP) • Liskov Substitution Principle (LSP) • Dependency Inversion Principle (DIP) • Single-Responsibility Principle (SRP) • Meyer’s Design By Contract • Encapsulation, Inheritance, Subtype-Polymorphism & Abstraction

  7. Practice Topics • UML (eg Class diagrams, state charts, use cases, interaction diagrams, etc.) • Bad Software Design (when software smells) • Design Patterns • Modelling Classes • Requirements Analysis • Software Maintainability • The Text in General • Refactoring, TDD, XP

  8. Questions from the Past • Name and describe the 8 primitive types • Boolean, char, etc. • How is a type conversion done? • When is it suitable (think data loss)? • Wrapper classes • Describe the three categories of reference data types (that inherit from Object). • Class instance, array, interface

  9. Questions from the Past • Name the methods Object class provides • toString(), clone(), getClass(), equals(), etc. • How is a class instantiated? • Simple code: • public Balance currentBalance = new Balance(); • What is a static method? • Method not associated with an instance – but rather at class level

  10. Questions from the Past • Describe 4 access modifiers • Remember table!

  11. Questions from the Past • What is an inner class and how is it used? • Class within a class • Static Member class • Member class • Local class • Anonymous class

  12. Questions from the Past • What is an iterator • Allow processing (step through) of each element of a collection • Sample code has been asked for! • Iterator myIterator= myCollection.iterator(); while(myIterator.hasNext()){ Object myObject = myIterator.next(); //do something with myObject – possibly cast }

  13. Questions from the Past • What is an interface? • a collection of method definitions and constant values that define a behaviour • Replace multiple inheritance – more than one interface can be inherited. • Does not implement methods however • What is a thread? • a separate stream of execution that takes place simultaneously with and independently of everything else – remember Thread class and Runnable interface

  14. Questions from the Past • What is an Exception? How is it dealt with in Java? • An Exception is an object created and thrown when an exceptional circumstance (usually caused by an erroneous condition) occurs • Java – try, catch, throw, throws, finally • Know the different types of Exceptions and how the compiler enforces them.

  15. Questions from the Past • What is a constructor? • General description, code example might help • What is constructor chaining? • A child object constructor always first needs to construct its parent (which in turn calls its parent constructor.). Can also be ‘manufactured’ by enforcing other constructors to be called within the same or parent classes • Use of this, this(), super, and super()

  16. Questions from the Past • Describe the Interface Segregation Principle (ISP)? • Many client specific interfaces (narrow) are better than one general purpose interface • Fat interfaces lead to inadvertent coupling • Describe the Liskov Substitution Principle (LSP)? • Subclasses should be suitable for their base classes • The contract of the base class must be honoured by the derived class

  17. Questions from the Past • What is the Open-Closed Principle (OCP)? • A module (class) should be open for extension but closed for modification (originally by Bertrand Meyer). • Classes should be written so that they can be extended without requiring the classes to be modified. • To extend the behavior of a system (in response to a requested change) add new code, don’t modify existing code.

  18. Questions from the Past • Describe the Dependency Inversion Principle (DIP) • Depend upon abstractions. Do not depend upon concrete implementations • High level classes should not depend on low level classes. • Abstractions should not depend upon the details. • If the high level abstractions depend on the low level implementation details, then the dependency is inverted from what it should be.

  19. Questions from the Past • Describe the Single-Responsibility Principle (SRP) • A class should have only one reason to change • A responsibility is “a reason for change.” • The responsibilities of a class are axes of change. If it has two responsibilities, they are coupled in the design, and so have to change together.

  20. Questions from the Past • Meyer’s Design By Contract (later version) • A contract consists of the preconditions a method expects and the post-conditions it guarantees if it returns successfully. • If the method doesn’t return successfully, it throws an exception. • The contract is associated with the public methods of a class or interface.

  21. Questions from the Past • Describe symptoms of bad software design (think when software smells) • The system is rigid—hard to change because everything has to change at once. • The system is fragile—changes cause the system to break in the strangest of places. • The system is immobile—not reusable. • The system is viscous—doing things right is hard. • The system is needlessly complex. • The system contains needless repetition. • The system is opaque—hard to understand

  22. Questions from the Past • Describe what is meant by encapsulation • Diagram might help • Describe what is meant by inheritance • Keywords may also help (extends) • Describe what is meant by subtype-polymorphism • The ability of an object or operator to refer to instances of different classes at run time.

  23. Questions from the Past • How is abstraction achieved in Java? • Various ways – Abstract (keyword) classes, interfaces and inheritance • Describe a State chart / Use Case Diagram / Class Diagram / Interaction Diagram • Diagram essential – key is to remember all elements of the diagram • Know what they’re used for.

  24. Questions from the Past • How might you gather and analyze requirements? Compare and contrast the approaches. • Brainstorming, Observation etc. • Discuss and criticize the design principles the authors claim lead to maintainable software • Design and conquer • Increase cohesion where possible • Reduce coupling where possible • Keep the level of abstraction as high as possible • Increase reusability where possible • Reuse existing designs and code where possible • Anticipate obsolescence • Design for portability • Design for testability • Design defensively

  25. General Advice • Read through whole paper once – work out which questions you answer best. • With 3 hours you have ~18 minutes per question Good luck!!!

More Related