COM 379 Exam Revision Lecture - PowerPoint PPT Presentation

1 / 24
About This Presentation
Title:

COM 379 Exam Revision Lecture

Description:

Anonymous class. Example Questions. What is an iterator ... Proxy. MVC. Iterator. Observer. Example Questions. How might you gather and analyze requirements? ... – PowerPoint PPT presentation

Number of Views:238
Avg rating:3.0/5.0
Slides: 25
Provided by: cs086
Category:

less

Transcript and Presenter's Notes

Title: COM 379 Exam Revision Lecture


1
COM 379Exam Revision Lecture
  • james.malone_at_sunderland.ac.uk

2
Exam Format
  • Thursday, 27th January
  • 600-900
  • RV113
  • 14 Question in total, Three sections
  • OO Programming
  • OO Theory
  • OO Practice
  • Answer TEN questions, with at least TWO from each
    section

3
Exam Topics
  • Primitive Types
  • Reference Types (including Object class)
  • Access Modifiers
  • Inner Classes
  • Iterators
  • Interfaces
  • Threads
  • Exceptions
  • Constructors Constructor Chaining

4
Exam Topics
  • Interface Segregation Principle (ISP)
  • Meyers Design By Contract
  • Open-Closed Principle (OCP)
  • Liskov Substitution Principle (LSP)
  • Dependency Inversion Principle (DIP)
  • Single-Responsibility Principle (SRP)
  • Bad Software Design (When software smells)
  • Encapsulation, Inheritance, Subtype-Polymorphism
    Abstraction

5
Exam Topics
  • UML (eg Class diagrams, state charts, use cases,
    interaction diagrams, etc.)
  • Design Patterns
  • Modelling Classes
  • Requirements Analysis
  • Software Maintainability

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

7
Example Questions
  • Name four 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

8
Example Questions
  • Describe 4 access modifiers
  • Remember table!

Accessible to Public Protected Package Private
Defining Class Yes Yes Yes Yes
Class in same package Yes Yes Yes No
Subclass in different package Yes Yes No No
Non-sublcass different package Yes No No No
9
Example Questions
  • What is an inner class?
  • Class within a class
  • Static Member class
  • Member class
  • Local class
  • Anonymous class

10
Example Questions
  • What is an iterator
  • Allow processing (step through) of each element
    of a collection
  • Sample code might be asked for!
  • Iterator myIterator myCollection.iterator()
  • while(myIterator.hasNext())
  • Object myObject myIterator.next()
  • //do something with myObject possibly cast

11
Example Questions
  • 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

12
Example Questions
  • 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 an
    erroneous condition) occurs
  • Java try, catch, throw, finally

13
Example Questions
  • 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

14
Example Questions
  • 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

15
Example Questions
  • 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, dont modify
    existing code.

16
Example Questions
  • 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.

17
Example Questions
  • 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.

18
Example Questions
  • Meyers Design By Contract
  • class method must satisfy two rules
  • There are only two ways a routine call may
    terminate either it fulfills its contract or it
    fails to fulfill it.
  • If a routine fails to fulfill its contract, the
    current execution of the caller also fails to
    fulfill its own contract.

19
Example Questions
  • Describe symptoms of bad software design (think
    when software smells)
  • The system is rigidhard to change because
    everything has to change at once.
  • The system is fragilechanges cause the system to
    break in the strangest of places.
  • The system is immobilenot reusable.
  • The system is viscousdoing things right is hard.
  • The system is needlessly complex.
  • The system contains needless repetition.
  • The system is opaquehard to understand

20
Example Questions
  • 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.

21
Example Questions
  • How is abstraction achieved in Java?
  • Various ways Abstract (keyword) classes,
    interfaces and inhertiance
  • Describe a State chart / Use Case Diagram / Class
    Diagram / Interaction Diagram
  • Diagram essential key is to remember all
    elements of the diagram

22
Example Questions
  • Describe one of the following patterns
  • Factory Method
  • Singleton
  • Adapter
  • Flyweight
  • Proxy
  • MVC
  • Iterator
  • Observer

23
Example Questions
  • 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

24
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!!!
Write a Comment
User Comments (0)
About PowerShow.com