Creative Commons Attribution- ShareAlike 2.5 License Sakai Programmer's Café Sakai Oxford Tetra ELF Workshop Sakai Development Practices, Best, and otherwise.

Slides:



Advertisements
Similar presentations
Chapter 8 Technicalities: Functions, etc. Bjarne Stroustrup
Advertisements

Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Tool Naming Tips Aaron Zeckoski
CS0007: Introduction to Computer Programming Introduction to Classes and Objects.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Sakai NWU Workshop, South Africa Recap of Sakai Services Antranig.
Inheritance Inheritance Reserved word protected Reserved word super
Component Patterns – Architecture and Applications with EJB copyright © 2001, MATHEMA AG Component Patterns Architecture and Applications with EJB JavaForum.
1 Frameworks. 2 Framework Set of cooperating classes/interfaces –Structure essential mechanisms of a problem domain –Programmer can extend framework classes,
Inheritance. Extending Classes It’s possible to create a class by using another as a starting point  i.e. Start with the original class then add methods,
CS 106 Introduction to Computer Science I 03 / 21 / 2008 Instructor: Michael Eckmann.
June 1, 2000 Object Oriented Programming in Java (95-707) Java Language Basics 1 Lecture 3 Object Oriented Programming in Java Language Basics Classes,
Aalborg Media Lab 23-Jun-15 Inheritance Lecture 10 Chapter 8.
1 Build a Web Application on J2EE. 2 J2EE Scenario Client – Web Server – EIS Resources Client – Web Server – EIS Resources Client – Application Server.
© 2005, Cornell University. Rapid Application Development using the Kuali Architecture (Struts, Spring and OJB) A Case Study Bryan Hutchinson
1/31 CS 426 Senior Projects Chapter 1: What is UML? Chapter 2: What is UP? [Arlow and Neustadt, 2005] January 22, 2009.
29-Jun-15 Recursion. 2 Definitions I A recursive definition is a definition in which the thing being defined occurs as part of its own definition Example:
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Struts 2.0 an Overview ( )
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Sakai NWU Workshop, South Africa Introduction to Sakai and Sakai.
1 Design and Integration: Part 1 Nuggets about Design vs Project Management.
Spring Overview, Application demo -Midhila Paineni 09/23/2011 Spring Overview, Application demo9/8/20151.
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
Introduction to Databases A line manager asks, “If data unorganized is like matter unorganized and God created the heavens and earth in six days, how come.
95-843: Service Oriented Architecture 1 Master of Information System Management Service Oriented Architecture Lecture 10: Service Component Architecture.
1 CS6320 – Deployment and Context L. Grewe 2 The Servlet Container Servlets run in a container sometimes called the Servlet engine. Servlets run in a.
CDM Developer Workshop. TDWG Andreas Kohlbecker Taxonomic Workflow in the EDIT Platform for Cybertaxonomy Purpose What do you want from this workshop?
SOFTWARE REUSE 28 March 2013 William W. McMillan.
EJB Framework.  As we know, EJB is the center of the J2EE architecture that provides a sturdy framework for building enterprise applications. The major.
|Tecnologie Web L-A Anno Accademico Laboratorio di Tecnologie Web Introduzione ad Eclipse e Tomcat
Chapter 8 Script-free pages. Problem with scripting in JSP When you use scripting (declaration, scriplet, expressions) in your JSP, you actually put Java.
1 CSC 221: Computer Programming I Spring 2010 interaction & design  modular design: roulette game  constants, static fields  % operator, string equals.
Spring Framework. Spring Overview Spring is an open source layered Java/J2EE application framework Created by Rod Johnson Based on book “Expert one-on-one.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmers’ Café Introduction to Sakai and Sakai Services Aaron Zeckoski
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai Montreal CRIM Workshop Introduction to Spring Framework,
Introduction to Web Dimitar Nenchev Ivan Nakov
Software Engineering Prof. Ing. Ivo Vondrak, CSc. Dept. of Computer Science Technical University of Ostrava
Objects & Dynamic Dispatch CSE 413 Autumn Plan We’ve learned a great deal about functional and object-oriented programming Now,  Look at semantics.
Week 2, Day 2: The Factory Method Pattern Other good design principles Cohesion vs. Coupling Implementing the Strategy Pattern Changing strategies (behaviors)
Object Oriented Software Development
Team S07. Agenda Scope of project Global use case diagram Analysis use cases High Level design (Software Architecture) Prototype challenges faced and.
Creative Commons Attribution- NonCommercial-ShareAlike 2.5 License Sakai Programmer's Café Sakai development and app/tool tips Aaron Zeckoski
INTEGRATION OF BACKBONE.JS WITH SPRING 3.1. Agenda New Features and Enhancements in Spring 3.1 What is Backbone.js and why I should use it Spring 3.1.
8. Inheritance “Is-a” Relationship. Topics Creating Subclasses Overriding Methods Class Hierarchies Abstract Class Inheritance and GUIs The Timer Class.
Inheritance. Inheritance is a fundamental object-oriented design technique used to create and organize reusable classes Chapter 8 focuses on: deriving.
Sakai WebApp Structure
Inheritance CSI 1101 Nour El Kadri. OOP  We have seen that object-oriented programming (OOP) helps organizing and maintaining large software systems.
Winter 2011SEG Chapter 11 Chapter 1 (Part 1) Review from previous courses Subject 1: The Software Development Process.
1 Inheritance Reserved word protected Reserved word super Overriding methods Class Hierarchies Reading for this lecture: L&L 9.1 – 9.4.
Kansas City Java User’s Group Jason W. Bedell July 12, 2006
CS2102: Lecture on Abstract Classes and Inheritance Kathi Fisler.
Introduction to business component technologies. Component definitions Szyperski: A software component is a unit of composition with contractually specified.
1 SYS366 Week 1 - Lecture 1 Introduction to Systems.
Chapter 4 Request and Response. Servlets are controlled by the container.
M1G Introduction to Programming 2 2. Creating Classes: Game and Player.
DBC NOTES. Design By Contract l A contract carries mutual obligations and benefits. l The client should only call a routine when the routine’s pre-condition.
Duke CPS Programming Heuristics l Identify the aspects of your application that vary and separate them from what stays the same ä Take what varies.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Outline Creating Subclasses Overriding Methods Class Hierarchies Inheritance.
Comp1004: Building Better Objects II Encapsulation and Constructors.
1 M206 Chapter 31: An Overview of Software Development 1.Defining the problem 2.Analyzing the requirement – constructing initial structural model 3.Analyzing.
A service Oriented Architecture & Web Service Technology.
LOGIC, PHILOSOPHY AND HUMAN EXISTENCE
Creative Commons Attribution- ShareAlike 2.5 License Sakai Programmer's Café Sakai Oxford Tetra ELF Workshop Comparative Display Technologies in Sakai.
More Sophisticated Behavior
Inheritance ITI1121 Nour El Kadri.
The Systems Engineering Context
Sakai WebApp Structure
Introduction to Sakai and Sakai Services
The super Reference Constructors cannot be used in child classes, even though they have public visibility Yet we often want to use the parent's constructor.
Recursion 2-Dec-18.
Tuesday Brown Bag Inversion of Control with Howard Abrams
Review of Previous Lesson
Presentation transcript:

Creative Commons Attribution- ShareAlike 2.5 License Sakai Programmer's Café Sakai Oxford Tetra ELF Workshop Sakai Development Practices, Best, and otherwise Antranig Basman

2 Sakai Tool/Component Architecture It would be useful at this stage to review some of the reasons/thinking that have made the Sakai Architecture the way it is today. “Modular” framework where artefacts can be both consumers and producers of “services” Innovative/cheap use of Spring as an “Enterprise” Service Locator Spring is the key enabling technology of the 2000s New philosophy of “dependency management” allows arbitrarily scale-free designs, allows former O-O “philosophy” to be assessed in more fundamental terms (keep the good, throw out the bad)

3 Spring and its Meaning The whole purpose of the dependency management movement (starting with Lakos in 1996) was that code artefacts form a Tree of Knowledge A “depends on” B or “knows about” B if there is any visible mention of B in its definition (arguments, base classes, return types, imports – also now, *annotations*) Becomes a relation A~B, with respect to which code should be a tree Now it is a tree, have to worry about how it gets constructed. It’s own construction must continue to follow the tree rules – so must be constructed top-down! Natural result is a “Clapham Junction” effect at the top of your design Spring lets you offload this task to someone else. Code is now finally “scale-free” and correct.

4 A Spring Bean package myPackage; public class MyBean { private Dependency myDependency; public void setMyDependency(Dependency myDependency) { this.myDependency = myDependency; } In Code: In XML: The “final” form of “Inversion of Control” framework Sometimes called “non-interface-based” injection, since the target does not need to implement any particular interface (that was “Type I IOC”) This example is “Type II IoC” (setter-based). Spring also supports Type III = Constructor- based, but due to the way the Java language treates constructors (crummy, no named parameters) this is not really a good idea.

5 Spring and Circularity Need to distinguish between circularity of code knowledge and circularity of resulting object graph The first is obviously terrible The second *can* happen “legally”, so long as the code dependency is broken by an interface (e.g. one Object may have many “hats”) However, this creates the risk of construct-time circles, which *is* an error Need to distinguish between use made of a dependency during initialization, between use made of it post-construction Since Spring 1.2.2, construct-time circles have been *allowed*!!!! Cause of many subtle problems already in Sakai In Spring 2.0 (released this week) there is at least a per-Factory “flag” that forbids circular construction references Sakai is still at Spring 1.2.8, and the flag is hard to access In the meantime, don’t do this! Correct solution is based on ProxyFactoryBean and LazyInitTargetSource (ask for details, or consult sakai-dev archives!)

6 “ Enterprise ” When I say “Enterprise” I mean “cross- ClassLoader” Perhaps not the typical definition but at least it is precise This capability is typically associated only with $$$ commercial containers (EJBs, JBoss, WebLogic &co.) Note that Spring is planning integration with OSGi shortly, but amazingly OSGi is itself $$$! Sakai solution while slightly “ad hoc” is pretty straightforward and effective

7 ClassLoaders ClassLoaders are the key means for code insulation and dynamism in Java Most other environments don’t have anything like them ClassLoader rules are poorly understood, even by Sun Unfortunately a working understanding is key to successful Sakai development

8 ClassLoaders in Tomcat (J2EE) Java ClassLoaders are (meant to) form a tree This is the standard layout for a Servlet container Note that Webapp ClassLoaders are slightly “odd” in that unlike all others, they will look *locally* to resolve non- System classes first, rather than looking in parent first This can be the cause of various “hilarious” errors/difficulties in Sakai

9 ClassLoaders in Sakai Sakai introduces new citizens into the ClassLoader ecology “Component” environments are just like Servlets (webapps) in many ways –Use URLClassLoader –Parent is Shared Unlike them in some others –Only components.xml, no web.xml –Respond only to function calls, not to Servlet dispatches! –Do not reload (currently – actually they really should) Component1Component2

10 Recap of Aaron’s Structure Diagram URL: Webapps Components Shared Logic-impl (business logic) Tool (presentation) Dao-impl (data access) Public-api (service) Logic-api (business logic) Dao-api (data access) Model Each coloured area in the structure diagram is actually a ClassLoader (type) Components were invented so that the lifetimes of services were more controllable Keeping only interfaces in Shared aids truly independent evolution of implementations Classes from “foreign” = “sibling” Classloaders simply cannot be resolved Although component INSTANCES all come from component ClassLoaders, they are held in a SINGLE Spring context at the shared level. Tools and Components alike contain “Child Spring Contexts” which have the shared context as a parent. Component1Component2

11 Some current component “issues” Hibernate is a really BAD ClassLoader citizen and will not cooperate with instances of itself in different ClassLoaders Also will NOT allow itself or any of its definitions to be reloaded Therefore Hibernate itself, along with any POJOs from the model, must be stored in Shared. Due to the current ComponentManager implementation, Spring itself is currently in shared. –Parent/child contexts are established by a slick “direct” connection that is just a bit “too” slick Therefore apps may NOT deploy their own versions of Spring or Hibernate, whether they agree in version or not (your instances of Spring interfaces will become unrecognizable and cause startup failure) All service references are bound directly to objects, no component may be reloaded

12 Another look at the diagram – Domain Objects in the Web Tier This arrow here is a subject of constant debates, e.g. on the “Spring Architecture Forum” Some consider the presence of “Domain Objects in the Web Tier” as the work of the Devil Note that “our” diagram is somewhat distorted by being *forced* to put Model in Shared for ClassLoader reasons – in some models, it would stay in “Components”. Webapps Components Shared Logic-impl (business logic) Tool (presentation) Dao-impl (data access) Public-api (service) Logic-api (business logic) Dao-api (data access) Model This is also related to the debate of “Rich Domain Model” vs “Anaemic Domain Model” (i.e. one with only state, no behaviour) A lot is determined by the sheer *width* of your domain model. Some are wide and flat, others narrow and deep. Personally I feel a lot of the antipathy to Model in View stems from unruly Web frameworks that can’t be trusted not to randomly trash the model (More on OTP later)

13 Questions?