On Object Oriented modeling in Java (Why - PowerPoint PPT Presentation

About This Presentation
Title:

On Object Oriented modeling in Java (Why

Description:

On Object Oriented modeling in Java (Why & How) Ana Madevska Bogdanova Institute of informatics Faculty of Natural Sciences and Mathematics Skopje, Macedonia – PowerPoint PPT presentation

Number of Views:123
Avg rating:3.0/5.0
Slides: 27
Provided by: C547
Category:

less

Transcript and Presenter's Notes

Title: On Object Oriented modeling in Java (Why


1
On Object Oriented modeling in Java (Why
How)Ana Madevska BogdanovaInstitute of
informaticsFaculty of Natural Sciences and
MathematicsSkopje, Macedonia
2
Agenda
  • The motivation
  • The need of introducing design patterns in the
    first year of studies
  • Incorporation in the concepts of the existing OOP
    course
  • Expected results

3
The motivation
  • To start earlier with Java (DSA will improve)
  • To introduce design patterns in OOP

4
The motivation
  • The first two courses
  • Structured programming
  • Object oriented and visual programming
  • C is the represent of a OOP language
  • The second course
  • Encaptulation
  • Inheritance
  • Polymorphism

5
Where is Java in the curriculum?
  • Java is in the course Data Structures and
    Algorithms
  • Third semester
  • The course is too much
  • Introductory level of Java while listening to the
    theory about Data structures
  • Discrepancy between programming the data
    structures and the theory
  • Solution?

6
The solution
  • We will introduce Java in the second semester
    within the course OO programming
  • The students are ready to start to program data
    structures immediately within the course DSA
  • No discrepancy

7
Agenda
  • The motivation
  • The need of introducing design patterns in the
    first year of studies
  • Incorporation in the concepts of the existing OOP
    course
  • Expected results

8
Another existing problem
  • Thinking in the design pattern level
  • Introduced in the course of software engineering
    in the 5th semester
  • Software design and architecture
  • In the first two programming courses the students
    mind is focused only on technical clarity in
    developing the OO system

9
Idea introduce design patterns in the first
semester
  • In the OO programming course we can introduce
    some problems and discuss them with the students
  • How to create OO model to go through the
    process OO modeling

10
Why do that?
  • Till now
  • We give them ready OO model and ask the students
    to program it and use
  • Encaptulation
  • Polymorphism
  • Inheritance
  • New idea
  • Ask the students to BUILD the OO model for a
    given problem
  • To broaden their point of view for the proper
    programming
  • To be ready to learn more design patterns in the
    latter courses

11
The levels
  • 1. OO basics
  • encapsultion, polymorphism, inheritance
  • 2. OO principles
  • 3. OO patterns
  • 1. Strategy
  • Defines a family of algorithms, encapsulates each
    one, and makes them interchangable
  • - let the algorithm vary independently from
    clients that use it

12
Why design patterns?
  • This is what the students should learn in the
    first year of their studies.
  • Students learn that applying design patterns is
    like reusing experience. One can apply successful
    patterns to develop new software without
    reinventing new solution strategies.

13
How to do that?
  • Teach Java course
  • Encaptulation
  • Polymorphism
  • Inheritance
  • Go further
  • Introduce a design pattern
  • Give a problem
  • Start with straightforward model
  • Change something
  • Remodeling
  • solution would be one of the design patterns

14
Agenda
  • The motivation
  • The need of introducing design patterns in the
    first year of studies
  • Incorporation in the concepts of the existing OOP
    course
  • Expected results

15
  • The idea is to learn ONE design pattern
  • Starting from scratch
  • Choosing interesting problem
  • Discuss with the students every step of
    developing the model by putting different
    subproblems as new requirements for the model
  • The model must develop with the new requirements

16
1. The strategy pattern
  • The idea is to guide the student through the
    process of implemeting the right Pattern Design
    to create the right OO model for the given
    problem.
  • Along the way they will understand the main OO
    principles - why to develop the software in that
    particular way
  • 1. Encapsulate what varies
  • 2. Program to interfaces, not implementation
  • 3. Favor composition over inheritance

17
Simple problem
  • We chose a simple problem
  • To explain the students that the only thing that
    we can be certain about - is the change in every
    software development
  • No matter how well one designs an appliication,
    it must grow and develop over time
  • So, the first design pattern is about flexibility
    in the OO model

18
Inheritance?
  • To point the student that inheritance doesnt
    always work well
  • Request - the behavior keeps changing across the
    subclasses, and it is not appropriate every
    subclass to have that behavior.

19
The FIRST design principle
  • Part of code that changes
  • New requirements
  • It is a behavior that should be parted from the
    rest of the code
  • SO, the students should identify the aspects of
    the application that vary and separate them from
    the parts that dont change
  • encapsulate it so it wont affect the rest of
    the code
  • The result is
  • Less unintended consequences when changing the
    code
  • More flexibility in the system

20
The SECOND design principle
  • We introduce another design principle
  • Program to an interface, not the implementation
  • The different behaviors will live in a separate
    classes
  • That way, the classes wont need to know any of
    the implementation details for their own behaviors

21
The realization
  • We will use an interface to represent each
    behavior and each implementation of the behavior
    will implement one of those interfaces.
  • Program to an interface really means program to a
    supertype
  • The concept of interface must not to be mixed up
    with the JAVA construct interface .
  • You can program to an interface, withouth using
    the actual construct interface.
  • We want to exploit polymorphism

22
Another difference with the current OOP course
  • We also plan to extend the knowledge of the
    students about the class relations in order to
    build more flexible models
  • Discovering class relations
  • Association
  • Aggregation and Composition
  • Inheritance(revisited)

23
Has-A can be better that Is-A
  • The THIRD design principle
  • Instead of inheriting a certain behavior, the
    objects get their behavior by composing with the
    right behavior object.
  • The students learn the third design principle
  • favor composition over inheritance
  • creating systems using composition provides a
    great deal of flexibility.

24
Agenda
  • The motivation
  • To start earlier with Java (DSA will improve)
  • introducing design patterns
  • The need of introducing design patterns in the
    first year of studies
  • Incorporation in the concepts of the existing OOP
    course
  • Expected results

25
Expected results of introducing JAVA and design
patterns in JAVA
  • As mentioned in the motivation part
  • More prepared students to embrace the higher
    level of producing OO modeling early - in their
    first OO course
  • They will be ready to learn more OO design
    patterns in the latter courses
  • Ready to develop OO models on their own in the
    different courses in the latter semesters.
  • learning JAVA in this course will make DSA
    course more comprehendible in the third semester
  • Students wouldn't have to learn the basics of
    JAVA, they will use it for simulating data
    structures covered with the course

26
  • Thank you for your attention
Write a Comment
User Comments (0)
About PowerShow.com