OO Crash Course NVCFUG March 2015 Presented by Denard Springle.

Slides:



Advertisements
Similar presentations
Uncoupling Java Applications O’Reilly Conference on Java Brett McLaughlin.
Advertisements

Apache Struts Technology
Fast Track to ColdFusion 9. Getting Started with ColdFusion Understanding Dynamic Web Pages ColdFusion Benchmark Introducing the ColdFusion Language Introducing.
Design Patterns CS is not simply about programming
Satzinger, Jackson, and Burd Object-Orieneted Analysis & Design
Structure of a web application1 Dr Jim Briggs. MVC Structure of a web application2.
Design Patterns academy.zariba.com 1. Lecture Content 1.What are Design Patterns? 2.Creational 3.Structural 4.Behavioral 5.Architectural 6.Design Patterns.
Data Persistence and Object-Relational Mapping Slides by James Brucker, used with his permission 1.
UNIT-V The MVC architecture and Struts Framework.
Dependency Injection and Model-View-Controller. Overview Inversion of Control Model-View-Controller.
Java Frameworks Indy Java Users Group January 29, 2003.
JDBC Session 5 Tonight: Data Access Patterns 1.J2EE Architecture & Design Patterns 2.The Data Access Tier 3.Data Access Patterns –DataAccessObject (DAO)
Systems Analysis and Design in a Changing World, Fifth Edition
Configuration Management and Server Administration Mohan Bang Endeca Server.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Copyright © 2012 Accenture All Rights Reserved.Copyright © 2012 Accenture All Rights Reserved. Accenture, its logo, and High Performance Delivered are.
An Introduction to Software Architecture
Design Patterns Phil Smith 28 th November Design Patterns There are many ways to produce content via Servlets and JSPs Understanding the good, the.
Data File Access API : Under the Hood Simon Horwith CTO Etrilogy Ltd.
COMP 365 Android Development.  Manages access from a central database  Allows multiple applications to access the same data.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
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.
Architecture styles Pipes and filters Object-oriented design Implicit invocation Layering Repositories.
1 Another group of Patterns Architectural Patterns.
CHEF II / Sakai Architecture. CHEF II Changes uPortal replaces Jetspeed –jsr 168 portlet, servlet compliant Spring replaces Turbine component framework.
Pemrograman Web MVC Programming and Design Pattern in PHP 5.
Introduction of PRO WG activities Group Name: TP Source: Shingo Fujimoto, FUJITSU, Meeting Date: Agenda Item:
Data Design and Implementation. Definitions of Java TYPES Atomic or primitive type A data type whose elements are single, non-decomposable data items.
Java Web Development with NetBeans IDE -- Kai Qian Chapter 5 JavaServer Faces (JSF) Technology.
Architectural Patterns Support Lecture. Software Architecture l Architecture is OVERLOADED System architecture Application architecture l Architecture.
1 Mapping to Relational Databases Presented by Ramona Su.
OBJECT-ORIENTED PROGRAMMING (OOP) WITH C++ Instructor: Dr. Hany H. Ammar Dept. of Electrical and Computer Engineering, WVU.
CSSE501 Object-Oriented Development. Chapter 4: Classes and Methods  Chapters 4 and 5 present two sides of OOP: Chapter 4 discusses the static, compile.
Google App Engine Data Store ae-10-datastore
Efficient RDF Storage and Retrieval in Jena2 Written by: Kevin Wilkinson, Craig Sayers, Harumi Kuno, Dave Reynolds Presented by: Umer Fareed 파리드.
Struts Framework Anna Paščenko. What is Struts?  An open source framework for building Java web applications.
Presentation & Business Tier Design Patterns Pearce.
Model View Controller MVC Web Software Architecture.
Abstraction ADTs, Information Hiding and Encapsulation.
Java Beans. Definitions A reusable software component that can be manipulated visually in a ‘builder tool’. (from JavaBean Specification) The JavaBeans.
Review Class Inheritance, Abstract, Interfaces, Polymorphism, GUI (MVC)
Java EE Patterns Dan Bugariu.  What is Java EE ?  What is a Pattern ?
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool The problem fixed by ORM Advantage Hibernate Hibernate Basic –Hibernate sessionFactory –Hibernate Session.
Object-Oriented Programming © 2013 Goodrich, Tamassia, Goldwasser1Object-Oriented Programming.
© FPT SOFTWARE – TRAINING MATERIAL – Internal use 04e-BM/NS/HDCV/FSOFT v2/3 JSP Application Models.
RESTful Web Services What is RESTful?
Implementation Basics in C# code Minimal C++ code Application logic in Java code.
Data Design and Implementation. Definitions Atomic or primitive type A data type whose elements are single, non-decomposable data items Composite type.
SEA Side – Extreme Programming 1 SEA Side Software Engineering Annotations Architectural Patterns Professor Sara Stoecklin Director of Software Engineering-
Chapter 9 Web Application Design. Objectives Describe the MVC design pattern as used with Web applications Explain the role and responsibilities of each.
Topic : Hibernate 1 Kaster Nurmukan. An ORM tool Used in data layer of applications Implements JPA.
Spring JDBC Dima Ionut Daniel. Contents What is Spring JDBC? Overview Spring JDBC Core SQL Exceptions Database Connection Batch Operations Handling BLOB/CLOB.
Mach-II Primer Ben Edwards An Introduction to Mach-II: An event-based, implicit invocation web-application framework.
Java Programming: Advanced Topics 1 Building Web Applications Chapter 13.
ASP.NET MVC An Introduction. What is MVC The Model-View-Controller (MVC) is an architectural pattern separates an application into three main components:
EJB. Introduction Enterprise Java Beans is a specification for creating server- side scalable, transactional, multi-user secure enterprise-level applications.
Leveraging ColdSpring to build a robust Flex applications Chris Scott, Cynergy Systems.
Structure of a web application
Field of Dreams An Online Sporting Goods Marketplace
MPCS – Advanced java Programming
Software Design and Architecture
Entity Framework By: Casey Griffin.
Top Reasons to Choose Angular. Angular is well known for developing robust and adaptable Single Page Applications (SPA). The Application structure is.
…and web frameworks in general
The Model Layer What is Model?
An Introduction to Software Architecture
…and web frameworks in general
Leveraging ColdSpring To Make Better Applications
Software Design Lecture : 35.
CS4961 Software Design Laboratory Understand Aquila Backend
Presentation transcript:

OO Crash Course NVCFUG March 2015 Presented by Denard Springle

What is an Object? Die – Sides Dots (or number, or image, etc.) – Color – Shape *Properties*

What can be done with an object? A die can be: – Thrown – the result of the throw being the die lands on one side, with the other side facing (the result) – Combined – with other die throws, the result of which can be manipulated (added, multiplied, divided, etc.) depending on the [business] logic desired – Saved – the die could be placed on a shelf in the last thrown configuration – Retrieved – the die could be taken off the shelf in the last thrown configuration – Discarded – the die and it’s last thrown configuration can be thrown away – Rethrown – the result of the rethrow overwriting the previous result – Etc. *Methods*

Bean (aka Data Model) ‘Bean’ is a Java term for ‘Object’ (loosely). Data Model (or more simply, ‘model’) is the modern term for ‘Object’ (loosely). Model’s are used to instantiate an Object – they return a single instance of a single Object. Can instantiate the same model multiple times, each with it’s own Object instance.

Data Access Object (DAO) Manages all CRUD methods for working with a single model (bean, object). Expects and returns Objects (models, beans). All other code interacts with the DAO so that data access occurs from the same location in code.

Gateways Manages all data when working with multiple rows (e.g. in a query). Expects [filter] parameters and returns a query (or array). All other code which reads multiple rows interacts with the gateway so that queries occur from the same location in code.

Service Layer A combination of: Data Access Object (DAO) for working with a single instance of a model. Gateway for working with multiple rows of data (filter, cache, search, etc.). Utility methods that manipulate the data in other ways (convert from query to array, return a JSON or XML representation of a model instance, etc.) – this is often done in a baseService.cfc which other service layers extend (inherit).

Why models and services? Maintainability – changes only need to occur in a handful of places within a few files (depending on implementation). Abstraction – the application only needs to know what data to pass and receive to the service(s). Ease of implementation – services can be injected by a factory, convention over configuration architecture can be employed, etc. Ease of understanding – other developers can readily understand the functions derived from using standard OO methodologies.

Centralized Data Management Using models and services centralizes data management for the rest of the application. Services can be invoked from handlers/controllers, passing data to views or being passed the data from forms, etc. Services can be invoked from API’s, scheduled tasks, gateways, etc. while always using the same functions and expectations as any other part of the application.

OO begets MVC (FW/1, ColdBox) The ‘model’ in Model-View-Controller frameworks refers to the beans and services used for data management and manipulation. Without OO fundamentals, MVC is not feasible (though technically possible, but ugly and defeats the purpose). Services do the heavy lifting - *not* controllers and *not* views – controllers should pass and return data between the model and the view – no more, no less. – This view is being requested – this data should be retrieved from the service and handed off to the view. – This [form] data is being received – this data should be handed off to the service and the service will hand me back data to hand off to (the/another) view.

Utility Functions Are Services, Too! Day to day programming involves many aspects of security and validation that are well handled by services. – Authentication, Access Control, Session Management – Form [API, etc.] validation and cleansing – Encryption/Decryption – Any function not specific to an individual object used by multiple parts of an application

Composition A die is composed of multiple sides – Each side of each die can contain different information (e.g. number of dots, numeric representation (1, 2, 3, etc.), images/icons/graphics (cow, dog, bird, etc.) – ‘sides’ would be a separate table, related to the ‘die’ id for each side, and would be comprised of information about that side – ‘side’ could be a model, and each die would have X number of ‘sides’ – ‘sides’ can be also be composed into the ‘die’ model as a property. The service layer(s) would then have to handle CRUD for both tables based on the data in the model (optimally, you would call a ‘sides’ service from the ‘die’ service)

Inheritance Provides the extending component access to (and ability to override) the parent components methods (functions) All frameworks work by extending your Application.cfc from the framework’s own CFC – thereby giving your application access to all of the frameworks methods (functions) baseModel.cfc and baseService.cfc – used to store generic model and service related utility functions common to all models and services (e.g. getMemento() for models, queryToArray() for services) – all other models and services extend their base model or service, respectively.

Other Design Patterns Factory method – abstracts the instantiation of objects (models and services). Dependency Injection – injects instantiated models and services from the factory on an as-needed basis. Façade – Inheritance based pattern that allows implementation and overwriting of parent methods in an abstracted fashion Modern frameworks (FW/1, ColdBox, etc.) make use of design patterns to abstract the complexity away and provide you with a consistent, reliable method of building MVC applications. They are steeped in OO methodologies and work best when utilized in that expected capacity.

Resources Gang of Four Design Patterns Kevan Stannard (dated but relevant) - Adam Tuttle (and friends) - Matt Gifford (dated but relevant) - Adrian J. Moreno (dated but relevant)