Car Rental DB Explained. RHS – 2009 2 Car Rental DB Explained The application demonstrates the Model- View-Controller (MVC) pattern The user can –Add.

Slides:



Advertisements
Similar presentations
Software Engineering 2003 Jyrki Nummenmaa 1 OBJECT ARCHITECTURE DESIGN These slides continue with our example application, based on the simplified.
Advertisements

Animation Mrs. C. Furman. Animation  We can animate our crab by switching the image between two pictures.  crab.png and crab2.png.
Introduction to Input and Output. Layers (or Tiers) of an Application  Software in the real world normally takes the form of a number of independent.
CS 206 Introduction to Computer Science II 01 / 21 / 2009 Instructor: Michael Eckmann.
L ocal I nformation S ervice By: Uri Gold & Kadan Haba Supervisors: Lev Rechnik & Alexander Arlievsky.
Object-Oriented Analysis and Design
Objectives Explain the purpose and objectives of object- oriented design Develop design class diagrams Develop interaction diagrams based on the principles.
Structure of a web application1 Dr Jim Briggs. MVC Structure of a web application2.
Week 4-5 Java Programming. Loops What is a loop? Loop is code that repeats itself a certain number of times There are two types of loops: For loop Used.
From BlueJ to NetBeans SWC 2.semester.
MVC pattern and implementation in java
Systems Analysis and Design in a Changing World, Fifth Edition
System Calls 1.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Data Objects (revisited) Recall that values are stored in data objects, and that each data object holds one value of a particular type. Data objects may.
Chapter 6 Understanding the Structure of an Application: Procedures, Modules, and Classes.
© The McGraw-Hill Companies, 2006 Chapter 4 Implementing methods.
Session 08: Architecture Controllers or Managers Graphical User Interface (GUI) FEN AK - IT Softwarekonstruktion.
Programming in Java Unit 2. Class and variable declaration A class is best thought of as a template from which objects are created. You can create many.
12 Systems Analysis and Design in a Changing World, Fifth Edition.
Architectures Classic Client/Server Architecture Classic Web Architecture N-tier (multi-tier) Architecture FEN Databaser og Modellering.
1 ITEC 3010 “Systems Analysis and Design, I” LECTURE 10: Use Case Realizations [Prof. Peter Khaiter]
Object Oriented Design Jerry KotubaSYST Object Oriented Methodologies1.
Tot 15 LTPDA Graphic User Interface summary and status N. Tateo 26/06/2007.
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Question of the Day  On a game show you’re given the choice of three doors: Behind one door is a car; behind the others, goats. After you pick a door,
Lab 10: Project and Code Organization User Interface Lab: GUI Lab Oct. 18 th, 2014.
Sample Application Multi Layered Architecture (n-tier): –Graphical User Interface (GUI): Forms, components, controls The Visual Designer in Visual Studio.
JDBC Java and Databases. RHS – SOC 2 JDBC JDBC – Java DataBase Connectivity An API (i.e. a set of classes and methods), for working with databases in.
Simulated Pointers Limitations Of Java Pointers May be used for internal data structures only. Data structure backup requires serialization and deserialization.
MVC Model 2 Architecture & AddressBook case study
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
An Introduction to Programming and Object Oriented Design using Java 3 rd Edition. Dec 2007 Jaime Niño Frederick Hosch Chapter 18 Integrating user interface.
Topic 1 Object Oriented Programming. 1-2 Objectives To review the concepts and terminology of object-oriented programming To discuss some features of.
Refactoring 2. Admin Blackboard Quiz Acknowledgements Material in this presentation was drawn from Martin Fowler, Refactoring: Improving the Design of.
Chapter Three The UNIX Editors.
Computer Programming and Basic Software Engineering 9 Building Graphical User Interface Creating a Multiple-Form Interface.
Programming with Java © 2002 The McGraw-Hill Companies, Inc. All rights reserved. 1 McGraw-Hill/Irwin Chapter 5 Creating Classes.
Chapter 15 Linked Data Structures Slides prepared by Rose Williams, Binghamton University Kenrick Mock University of Alaska Anchorage Copyright © 2008.
AP Computer Science A – Healdsburg High School 1 Unit 9 - Why Use Classes - Anatomy of a Class.
ANDROID AND MODEL / VIEW / CONTROLLER. Slide 2 Design Patters Common solutions to programming problems are called design patterns Design patterns are.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
M1G Introduction to Programming 2 3. Creating Classes: Room and Item.
1 CSE 331 Model/View Separation and Observer Pattern slides created by Marty Stepp based on materials by M. Ernst, S. Reges, D. Notkin, R. Mercer, Wikipedia.
Architecture Multi Layered Architecture (n-tier): Application: Model Controllers Database Access Graphical User Interface (GUI): Forms, components, controls.
Creating a GUI Class An example of class design using inheritance and interfaces.
L10: Model-View-Controller General application structure. User Interface: Role, Requirements, Problems Design patterns: Model – View – Controller, Observer/Observable.
Mr. Justin “JET” Turner CSCI 3000 – Fall 2015 CRN Section A – TR 9:30-10:45 CRN – Section B – TR 5:30-6:45.
Be “GUI ready” developing in RPG by Robert Arce from PrismaTech. Be “GUI ready” developing in RPG-ILE Presented by: Robert Arce.
Proxy. PBA WEB – BEWP 2 The Proxy pattern What is a Proxy? A Proxy is a ”placeholder” for a different object, to which we will not allow direct access.
This In Java, the keyword this allows an object to refer to itself. Or, in other words, this refers to the current object – the object whose method or.
Creating Java Applications (Software Development Life Cycle) 1. specify the problem requirements - clarify 2. analyze the problem - Input? Processes? Output.
Module 9: Operator overloading #1 2000/01Scientific Computing in OOCourse code 3C59 Module 9: Operator Overloading In this module we will cover Overloading.
Object-Oriented Application Development Using VB.NET 1 Chapter 15 Assembling a Three-Tier Windows Application.
Imposing MVC design sample in.NET. Design patterns are very useful to solve complex design issues if used well. The primary concept of the Model View.
Business rules.
INF230 Basics in C# Programming
3 Introduction to Classes and Objects.
Delegates and Events 14: Delegates and Events
Un</br>able’s MySecretSecrets
PRG 421 MART Higher Education / prg421mart.com
PRG 421 MART Education for Service-- prg421mart.com.
Developing a Model-View-Controller Component for Joomla Part 3
LTPDA Graphic User Interface summary and status
Lecture Set 11 Creating and Using Classes
Data Structures & Algorithms
Designing For Testability
Review: libraries and packages
SPL – PS13 Persistence Layer.
Threads and concurrency / Safety
Presentation transcript:

Car Rental DB Explained

RHS – Car Rental DB Explained The application demonstrates the Model- View-Controller (MVC) pattern The user can –Add a car to a car catalog –View the car catalog –Use a database to save/load car data

RHS – Car Rental DB Explained Application design: –Follows MVC pattern, but with a few compromises –Uses interface classes for main parts of the functionality –Database functionality is isolated to the model implementation

RHS – Car Rental DB Explained CarRentalView CarRentalViewInterface CarRentalCarListDialogCarRentalAddCarDialog CarRentalApp CarRentalControllerInterface CarRentalController CarRentalModelInterface CarRentalDBModel Car CarCatalog Auto-generated classes (but we modify the View class a bit) Interface classes View Controller Model

RHS – Car Rental DB Explained Dependencies – View layer –View classes (the dialog classes) know the controller, but only through an interface –View classes know the model, but only through an interface –View classes know the domain model (the Car class) – this is not quite in agreement with the pure MVC pattern!

RHS – Car Rental DB Explained Dependencies – Controller layer –Controller class knows the model, but only through an interface –Controller class knows all current view objects, but only through an interface. This enables the controller to notify all view objects of changes to the model

RHS – Car Rental DB Explained Dependencies – Model layer –Model class does not have any dependencies to other classes –All references to the database are isolated to the implementation of the model interface –This is why we can easily change from using a file to using a database, since we only have to change the model implementation

RHS – Car Rental DB Explained Start-up –When starting the application, we must choose a specific implementation of the controller and model – this is done in the CarRentalView constructor –Since no dialogs are open at the start-up, we do not create any view objects

RHS – Car Rental DB Explained // Code from CarRentalView.java if (controllerInterface == null) { controllerInterface = new CarRentalController(); controllerInterface.setModel( new CarRentalDBModel()); } Choosing a specific controller implementation Choosing a specific model implementation

RHS – Car Rental DB Explained Opening a dialog –Create the actual dialog object –Call addView on the controller, so the controller is aware of the dialog object, i.e. a view implementation –Make the dialog visible

RHS – Car Rental DB Explained // Code from CarRentalView.java private void jMenuAddCarActionPerformed(…) { CarRentalAddCarDialog dlg = new CarRentalAddCarDialog(null, false); controllerInterface.addView(dlg); dlg.setVisible(true); } Now the controller knows that this dialog is open

RHS – Car Rental DB Explained Opening a dialog (continued) –Note that in addView, the view object is assigned a reference to both the model and the controller –Any view object can therefore communicate with both the controller and the model

RHS – Car Rental DB Explained // Code from CarRentalController.java public void addView( CarRentalViewInterface viewInterface) { viewInterface.setModel(modelInterface); viewInterface.setController(this); viewList.add(viewInterface); }

RHS – Car Rental DB Explained Adding a Car – dialog part –Extract the data for Car from the fields in the dialog (standard GUI code) –Call addCar on the controller interface –Clear the fields in the dialog, to make it ready for the next input

RHS – Car Rental DB Explained // Code from CarRentalAddCarDialog.java public void jButtonAddActionPerformed(…) { Car aCar = extractCarInfo(); controllerInterface.addCar(aCar); clearDialog(); }

RHS – Car Rental DB Explained Adding a Car – controller part –Just forwards the call of addCar to the model –Also notifies other views that the model is to be changed – this may prompt the other views to get new data from the model

RHS – Car Rental DB Explained Deviations from ”pure” MVC design –The Car object is created in the view class, meaning the view class knows about a domain model object –Alternatively, the addCar method should be replaced with a method containing the data itself as parameters, not the Car object –The Car object can then be created in the controller or model layer instead

RHS – Car Rental DB Explained Adding a Car – model part –The new Car object is added to the car catalog, which is stored in memory –Note that the Car object is not put into the database immediately –Data is only saved to the database when the user wants it, by choosing ”save”