Top Banner
Object Oriented Programming FILS 2014-2015 Andrei Vasilateanu, PhD

Object Oriented Programming FILS 2012-2013 fileBibliography The lectures are not enough, extra reading is necessary Romanian: •L.D.Serbanati, C.Bogdan, Programare orientata spre

Aug 29, 2019



Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
  • Object Oriented Programming FILS 2014-2015

    Andrei Vasilateanu, PhD

  • Administration

    Course Master:

    • Andrei Vasilateanu,

    Teaching Assistants: • Radu Ioanitescu,

    Grading: • Final exam 40%

    • Laboratory 60% • 2 Tests 30%

    • Attendance 10%

    • Homework + Activity 20%

    Course Policies:

    • Individual HW, >50% in exam, no late HW

  • Bibliography

    The lectures are not enough, extra reading is necessary


    • L.D.Serbanati, C.Bogdan, Programare orientata spre obiecte cu exemplificari in limbajul Java, vol 2


    • C. Horstmann, G. Cornell, “Core Java 2”

    • K.Mughal, R. Rasmussen, “Programmer's Guide to Java SCJP Certification”


    • J. Bloch, C. Persuati, “Effective Java”

    • S. McConnell, “Code Complete”

  • Overview of the course

    Revision of basic OOP concepts from PL


    Nested classes



    Graphical User Interfaces (AWT + Swing)

    Exception Handling



  • Revision Object Oriented Programming

    Programming paradigm

    • Data + functions

    • Code reuse

    • Object Oriented Analysis and Design


    O4 O3

    O2 m1



  • Concepts

    A concept is an idea or notion that we apply to entities in the real world or our imagination

    1. For us, concepts are a recognition device. The concepts may be: Tangible (person, car, table), Intangible (time, quality, company), Roles

    (doctor, patient, owner), Judgments (high pay, good example, productive job), Relational (marriage, partnership, ownership), Events (sale, purchase, market crash), Other types of concepts (string, number, icon, image, signal, process)

    2. For us concepts are also a test for reality: we can apply concepts to entities in our reality and discard concepts that no longer apply. Each concept is based on tests that determine when it applies.

    Person Employee






    Efficient Organization


    can be a can be a

    owns employs



    is an instance of





    lives in


    registered at


  • Concept We use concepts as units of knowledge in which each has an intension and

    an extension. There two sides of the same coin. • Intension (definition, understanding): the complete definition of the concept and

    the test that determines whether or not the concept applies to an entity. • Extension: the set of all entities to which the concept applies.

    A domain is a collection of entities in a selected area of interest. A domain specification is the collection of concepts that apply to a domain. An instance of a concept is an entity in the real world or our imagination to

    which a concept applies.

    { Extension }

    { Intension }

    A shared notion or idea that applies to certain objects in our awareness.

    Type (i.e. Concept)



    Event Type


    Order Item


    { Symbolizes }


  • Objects Objects in OOP programming are computer-oriented representations of

    concept instances. Each object in our programs should abstract a concept instance in the real

    world or our imagination. Three key characteristics of objects derived from characteristics of the real

    entities: • The object's behaviour - what can you do with this object, or what methods can

    you apply to it? The behaviour of an object is defined by the methods that you can call. The state of an object can influence its behaviour .

    • The object's state - how does the object react when you apply those methods? the object's state is all stored information about what it currently looks like. A change in the state of an object must be a consequence of method calls.

    • The object's identity - how is the object distinguished from others that may have the same behaviour and state? The state of an object does not completely describe it, since each object has a distinct identity.

    A class of objects is the description of a set of similar objects with the same state components and behaviour.

    Classification is the act or result of applying a concept (i.e. type) to one of its instances. Further we can define classification in the OOP programming:

    Class Object





    Classification Relationship

  • Relationships Between Classes

    The most common relationships between classes are: • Dependence ("uses–a"): a class depends on another class if its methods

    manipulate objects of that class. • Association ("knows–a"): A user-defined relationship. • Aggregation ("has–a"): the act or result of forming an object whole

    using other objects as its parts • Generalization ("is–a"): the act or result of distinguishing a concept (i.e.

    type) that completely includes or encompasses another.



    Item Account check for credit




  • Generalization Generalization is the act or result of distinguishing a concept (i.e. type) that

    completely includes or encompasses another. Generalization enables us to say that all instances of a specific type are also

    instances of more general type – but not necessarily the other way around. With generalization we can define hierarchies of types, forming more and

    more general types. The more general type is called supertype. The opposite of generalization is specialization. The specialized types are subtypes.

    Generalization in Java is expressed as class extension. In general, if class A extends class B, class A inherits variables and methods

    from class B, but has more capabilities.

  • Inheritance

    Code reuse in OO = create new classes that are built upon existing classes.

    Polymorphism = An object variable (such as the variable e) can

    refer to multiple actual types.

    Constructor inheritance

    Method overriding • Covariant return (only reference types)

    • Accesibility

    • @Override

    • Exception throwing

    Method and field hiding

  • Cohesion and Coupling

    Cohesion = inter-class measure of how well-structured and closely-related the functionality is in a class. => well-defined and related tasks

    Coupling = measure of intra-class dependencies.

    High cohesion and loose coupling => maintanability, reusability, extensibility and reliability