Bc. Matej Kováč Vedúci projektu: prof. Ing. Pavol Návrat, PhD.

Slides:



Advertisements
Similar presentations
Java Language Quick-Reference Guide B. Oracle10g: Java Programming B - 2 Console Output Java applications and applets can output simple messages to the.
Advertisements

Object-Oriented Programming. 2 An object, similar to a real-world object, is an entity with certain properties, and with the ability to react in certain.
1 Drawing C Sc 335 Object-Oriented Programming and Design Rick Mercer.
Object Oriented Programming in Java. Object Oriented Programming Concepts in Java Object oriented Programming is a paradigm or organizing principle for.
Object-Oriented Design Patterns Composite Singleton State Observer … Autumn 2012UCN Technology: IT/Computer Science1.
Visual Basic: An Object Oriented Approach 11 – Patterns in object oriented programming.
March R McFadyen1 GoF (Gang of Four): Gamma, Johnson, Helm & Vlissides Book: Design Patterns: Elements of Reusable Object-Oriented Software.
CS221 - Computer Science II Polymorphism 1 Inheritance "Question: What is the object oriented way of getting rich? Answer: Inheritance.“ “Inheritance is.
CH1 – A 1 st Program Using C#. Program Set of instructions which tell a computer what to do. Machine Language Basic language computers use to control.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. The Factory Method Design Pattern (1) –A creational design.
Design Patterns and Principles of Object Oriented Application Development “design patterns are proven techniques used by experienced developers to tackle.
Maintenance Refactoring and Code Smells. Where are we? Over the semester we have talked about Software Engineering. The overall goal of software engineering.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
1 Identifiers  Identifiers are the words a programmer uses in a program  An identifier can be made up of letters, digits, the underscore character (
Implementing Design Patterns Using Java St. Louis Java Special Interest Group Eric M. Burke Object Computing, Inc. Presented on July 9, 1998 (updated July.
1 Abstraction  Identify important aspects and ignore the details  Permeates software development programming languages are abstractions built on hardware.
Ex3 Preview, Swing tutorial Ex1 review Amit Shabtay.
Recitation 4 Abstract classes, Interfaces. A Little More Geometry! Abstract Classes Shape x ____ y ____ Triangle area() base____ height ____ Circle area()
Computer Science Design Patterns Spring TR 9:30-10:45 AM - EB 0011 Instructor: Bill White Engineering Building 3041 (618)
1 Software Maintenance and Evolution CSSE 575: Session 3, Part 1 Simplifying Conditionals Steve Chenoweth Office Phone: (812) Cell: (937)
Refactoring1 Improving the structure of existing code.
Advanced Programming in Java
Mohammed Al-Dhelaan CSci 253 Object Oriented Design Instructor: Brad Taylor 06/02/2009 Factory Method Pattern.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Assessment of the Quality of Refactoring.
Date : 02/03/2014 Web Technology Solutions Class: OOP PHP, Design Patterns and CRUD.
Department of Computer Science, Graduate School of Information Science & Technology, Osaka University 1 Towards an Investigation of Opportunities for Refactoring.
Refactoring 101 William C. Wake
Programming Paradigms Lecturer Hamza Azeem. What is PP ? Revision of Programming concepts learned in CPLB Learning how to perform “Object-Oriented Programming”
Object Oriented Programming with Java 03 - Introduction to Classes and Objects.
9 - Class & Method Design Model Enhancement Design to Code Proposal Presentation.
Design Patterns Software Engineering CS 561. Last Time Introduced design patterns Abstraction-Occurrence General Hierarchy Player-Role.
DESIGN PATTERNS -CREATIONAL PATTERNS WATTANAPON G SUTTAPAK Software Engineering, School of Information Communication Technology, University of PHAYAO 1.
Design Patterns Introduction
Scott Cate CloudDB.com Session Code: DPR401.
CS251 – Software Engineering Lectures 18: Intro to DP Slides by Rick Mercer, Christian Ratliff, Oscar Nierstrasz and others 1 و ابتغ فيما آتاك الله الدار.
Composition When one class contains an instance variable whose type is another class, this is called composition. Instead of inheritance, which is based.
CSSE 375 Organizing Data – Part 2 Shawn and Steve Continue the same quiz!
Refactoring1 Improving the structure of existing code.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
Class Relationships Lecture Oo08 Polymorphism. References n Booch, et al, The Unified Modeling Language User Guide, Chapt 10 p.125 n Fowler & Scott, UML.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
Csci 490 / Engr 596 Special Topics / Special Projects Software Design and Scala Programming Spring Semester 2010 Lecture Notes.
UML2-1 UML Exercise A "draw" utility program lets users draw several geometric objects on a diagram. A geometric object may be a Circle, Rectangle, Square.
CSC 205 Programming II Lecture 4 Abstract Class. The abstract keyword indicate that a class is not instantiable Defining a type which will be specialized.
Abstract Classes. Recall We have the ability to create hierarchies of classes. Good design practice suggests that we move common methods as high as possible.
Interfaces CMSC 202. Public Interfaces Objects define their interaction with the outside world through the their public interface. A class' public interface.
Theory *OOP Charachteristic*
CSCI 104 C++11 Features Design Patterns
Modern Programming Tools And Techniques-I
Web Design & Development Lecture 9
Abstraction, Interface, Inheritance, Polymorphism, Override / Overload
Web Technology Solutions
MPCS – Advanced java Programming
CS 302 Week 11 Jim Williams, PhD.
Objectives Describe polymorphism
null, true, and false are also reserved.
Introduction to Java Programming
Reusability 11/29/2018© 2006 ITT Educational Services Inc.
Improving the structure of existing code
Java Lesson 36 Mr. Kalmes.
SOEN 343 Software Design Computer Science and Software Engineering Department Concordia University Fall 2005 Instructor: Patrice Chalin.
Objects First with Java A Practical Introduction using BlueJ
Session 2: Introduction to Object Oriented Programming
Chapter 14 Abstract Classes and Interfaces
Objects First with Java A Practical Introduction using BlueJ
Instructor: Alexander Stoytchev
OOP Aga private institute for computer science 5th grade
Object Oriented Programming.
Making a copy of an object: shallow and deep copy
Presentation transcript:

Bc. Matej Kováč Vedúci projektu: prof. Ing. Pavol Návrat, PhD. Refaktorizácia softvérových systémov s podporou kontextového odporúčania Bc. Matej Kováč Vedúci projektu: prof. Ing. Pavol Návrat, PhD.

Refaktorizácia a návrhové vzory GoF, Design Patterns: Elements of Reusable Object-Oriented Software M. Fowler, Refactoring: Improving the design of existing code J. Kerievsky, Refactoring to Patterns

Ciele práce Vytvorenie prístupu pre identifikáciu nedostatkov v návrhu existujúcich systémov, ktoré je možné odstrániť zavedením návrhových vzorov Zakomponovanie prístupu do existujúceho vývojového prostredia

JDeodorant: Refaktorizácia so vnášaním polymorfizmu N. Tsantalis and A. Chatzigeorgiou, Identification of refactoring opportunities introducing polymorphism, Elsevier, 2009.

public class Square extends Shape { private double side; public double calculateArea() { return side * side; }

public class CarStore { public Car createCar(EquipmentClass equipmentClass) { // deklarácie premenných a pod. switch (equipmentClass) { case COMFORT: engine = new DieselEngine(); seat = new FabricSeat(); transmission = new ManualTransmission(); break; case SPORT: engine = new PetrolEngine(); seat = new SportSeat(); transmission = new DualClutchTransmission(); case LUXURY: engine = new HybridEngine(); seat = new LeatherSeat(); transmission = new AutomaticTransmission(); } return new Car(engine, seat, transmission); aaa}

public class CarStore { public Car createCar(EquipmentClass equipmentClass) { // deklarácie premenných a pod. switch (equipmentClass) { case COMFORT: engine = new DieselEngine(); seat = new FabricSeat(); transmission = new ManualTransmission(); break; case SPORT: engine = new PetrolEngine(); seat = new SportSeat(); transmission = new DualClutchTransmission(); case LUXURY: engine = new HybridEngine(); seat = new LeatherSeat(); transmission = new AutomaticTransmission(); } return new Car(engine, seat, transmission); aaa}

Abstract Factory

Abstract Factory Factory Method Engine Seat Transmission COMFORT 1 switch (equipmentClass) { case COMFORT: engine = new DieselEngine(); seat = new FabricSeat(); transmission = new ManualTransmission(); break; case SPORT: engine = new PetrolEngine(); transmission = new DualTransmission(); case LUXURY: engine = new HybridEngine(); seat = new LeatherSeat(); transmission = new AutomaticTransmission(); } switch (equipmentClass) { case COMFORT: engine = new DieselEngine(); seat = new FabricSeat(); break; case SPORT: engine = new PetrolEngine(); case LUXURY: engine = new HybridEngine(); something = new SomethingElse(); } Engine Seat Transmission COMFORT 1 SPORT LUXURY Engine Seat COMFORT 1 SPORT LUXURY Abstract Factory Factory Method

Builder public class Car { private String model; // povinný atribút private String brand; // povinný atribút private Color color; // nepovinný atribút private EquipmentClass equipment; // nepovinný atribút public Car(String model, String brand) { this(model, brand, null); } public Car(String model, String brand, Color color) { this(model, brand, color, null); public Car(String model, String brand, Color color, EquipmentClass equipment) { this.model = model; this.brand = brand; this.color = color; this.equipment = equipment;

Builder public class CarSeller { private Car car; public void prepareCar() { Car car = new Car(); car.setColor(new Color(255,255,255)); car.setBrand("Audi"); car.setModel("A3"); car.setId(1L); car.setWheels(4); } Joshua Bloch. Effective Java. Java Series. Pearson Education, 2008.

Mediator

Plán Podpora pre nasadenie inštancií odporúčaných vzorov Overenie riešenia

Zhrnutie Odporúčané vzory: Odporúčania na úrovni: Abstract Factory Builder Factory Method Mediator Odporúčania na úrovni: Kompilačných jednotiek (.java súbor) Balíkov Projektov