SlideShare une entreprise Scribd logo
1  sur  42
   Object Oriented Development Principles and their uses
   Standard(?) Design Patterns and their roles
   Patterns in Java and their uses
   Overview of Spring Framework
   Evolution of Java EE 6 – All the goodies are now in
    official package
   A brief introduction to JUnit – Test Driven Development in
    Java
   The special three –

    • Encapsulation – hiding the concrete implementations
    • Polymorphism – objects has more than one form
    • Inheritance – reusing functionalities


   And some of their derived form/application –

    • Program to an interface, not to an implementation
    • Favor object composition over inheritance


and much more, most notably, Design Patterns……………
   Single Responsibility Principle

   Open-Close Principle

   Liskov Substitution Principle

   Interface Segregation Principle

   Dependency Inversion Principle
   A defining characteristics of a framework

   It’s all about moving away the flow of controls to the
    frameworks.
   Let us consider a program that perform some simple
    command line query –


        puts 'What is your name?'
        name = gets
        process_name(name)
        puts 'What is your quest?'
        quest = gets
        process_quest(quest)
   However, in a window system, I would write something
    like this –


        require 'tk'
        root = TkRoot.new()
        name_label = TkLabel.new() {text "What is Your Name?"}
        name_label.pack
        name = TkEntry.new(root).pack
        name.bind("FocusOut") {process_name(name)}
        quest_label = TkLabel.new() {text "What is Your Quest?"}
        quest_label.pack
        quest = TkEntry.new(root).pack
        quest.bind("FocusOut") {process_quest(quest)}
        Tk.mainloop()
   The control of execution has been handed over to the
    windowing system.

   The control is Inverted, the framework calls the code
    rather than rather than the code calling the framework.

   This principle is also known as Hollywood Principle.
   Let us write a software component that provides a list of
    movies directed by a particular director –
    class MovieLister...
       public Movie[] moviesDirectedBy(String arg) {
         List allMovies = finder.findAll();
         for (Iterator it = allMovies.iterator(); it.hasNext();) {
         Movie movie = (Movie) it.next();
                    if (!movie.getDirector().equals(arg))
                               it.remove();
         }

          return (Movie[]) allMovies.toArray(new
                   Movie[allMovies.size()]);
      }
   moviesDirectedBy is dependent on the implementation of
    the finder object.

   Let’s make this method completely independent of how
    all the movies are being stored. So all the method does
    is refer to a finder, and all that finder does is know how to
    respond to the findAll method.
   It can be done easily by defining an interface –


        public interface MovieFinder {
                 List findAll();
        }
   Let’s provide a concrete implementation of MovieFinder -

    class MovieLister...
          private MovieFinder finder;
          public MovieLister() {
                  finder = new
                           ColonDelimitedMovieFinder("movies1.txt");
          }
   Now we have a new problem – how to get an instance of
    the right finder implementation into place
   The implementation class for the finder isn't linked into
    the program at compile time. Instead we want this lister
    to work with any implementation, and for that
    implementation to be plugged in at some later point.

   The problem is how that link could be made so that lister
    class is ignorant of the implementation class, but can still
    talk to an instance to do its work.
   The basic idea of the Dependency Injection is to have a
    separate object, an assembler, that populates a field in
    the lister class with an appropriate implementation for the
    finder interface.
   Type 1 IoC - Interface Injection

   Type 2 IoC - Setter Injection

   Type 3 IoC - Constructor Injection
   Define a setter method for populating finder –

         class MovieLister...
                 private MovieFinder finder;
        public void setFinder(MovieFinder finder) {
                 this.finder = finder;
                 }
   Similarly let us define a setter for the filename -

        class ColonMovieFinder...
                public void setFilename(String filename) {
                                 this.filename = filename;
                }
   The third step is to set up the configuration for the files.
    Spring supports configuration through XML files and
    also through code, but XML is the expected way to do
    it –
    <beans>
         <bean id="MovieLister" class="spring.MovieLister">
                 <property name="finder">
                         <ref local="MovieFinder"/>
                 </property>
         </bean>
         <bean id="MovieFinder" class="spring.ColonMovieFinder">
                 <property name="filename">
                         <value>movies1.txt</value>
                 </property>
         </bean>
    </beans>
   And then the test –

    public void testWithSpring() throws Exception{
          ApplicationContext ctx = new
                  FileSystemXmlApplicationContext("spring.xml");
          MovieLister lister = (MovieLister)ctx.getBean("MovieLister");
          Movie[] movies = lister.moviesDirectedBy("Sergio Leone");
          assertEquals("Once Upon a Time in the West",
                                   movies[0].getTitle());

    }
          WHERE DID THE new GO ?!
   Spring

   Google Guice – created by Google

   Pico Container

   Avalon

   Context and Dependency Injection – official Sun Java DI
    Container

   Seasar
   Assume you have a graphical class with many set...()
    methods. After each set method, the data of the graphics
    changed, thus the graphics changed and thus the
    graphics need to be updated on screen.


   Assume to repaint the graphics you must call
    Display.update().
   The classical approach is to solve this by adding more
    code. At the end of each set method you write –


        void set...(...) {
                 :
                 :
                 Display.update();
        }
   What will happen if there are 20-30 of these set methods
    ?


   Also whenever a new set-method is added, developers
    must be sure to not forget adding this to the end,
    otherwise they just created a bug.
   AOP solves this without adding tons of code, instead you
    add an aspect -

        after() : set() {
                  Display.update();
        }

         after running any method that is a set   pointcut,
    run the following code.
   And you define a point cut –


        pointcut set() : execution(* set*(*) ) &&
                                  this(MyGraphicsClass) &&
                                  within(com.company.*);

   If a method is named set* (* means any name might
follow after set), regardless of what the method returns
(first asterisk) or what parameters it takes (third asterisk)
and it is a method of MyGraphicsClass and this class is
part of the package com.company.*, then this is a set()
pointcut.
   This example also shows one of the big downsides of
    AOP. It is actually doing something that many
    programmers consider an Anti-Pattern. The exact pattern
    is called Action at a distance.


   Action at a distance is an anti-pattern (a recognized
    common error) in which behavior in one part of a
    program varies wildly based on difficult or impossible to
    identify operations in another part of the program.
   AspectJ

   Spring

   Seasar
   Object-relational mapping is a programming technique
    for converting data between incompatible type systems in
    relational databases and object-oriented programming
    languages.

   This creates, in effect, a virtual object database that can
    be used from within the programming language.

   It's good for abstracting the datastore out in order to
    provide an interface that can be used in your code.
   Without ORM, we write code like this –

           String sql = "SELECT ... FROM persons WHERE id = 10";
           DbCommand cmd = new DbCommand(connection, sql);
           Result res = cmd.Execute();
           String name = res[0]["FIRST_NAME"];

   With the help of ORM tools, we can do –

           Person p = repository.GetPerson(10);
           String name = p.FirstName;
    Or -
           Person p = Person.Get(Person.Properties.Id == 10);
   The SQL is hidden away from logic code. This has the
    benefit of allowing developers to more easily support
    more database engines.


   Developers can focus on writing the logic, instead of
    getting all the SQL right. The code will typically be more
    readable as well.
   Object-relational mapping is the Vietnam of our industry
    – Ted Neward.


   Developers are struggling for years with the huge
    mismatch between relational database models and
    traditional object models.
   Granularity – more classes than the number of
    corresponding tables.

   Subtyping

   Identity – primary key vs. object identity and object
    equality

   Associations – unidirectional in OOP vs. foreign keys.

   Data Navigation – walking the object graph vs. SQL joins
   Hibernate – the highly popular ORM tool for Java, has a
    corresponding .NET version too (NHibernate). Uses
    HQL.


   Java Persistence API – official sun java specification for
    managing persistence.
   Seam Framework – AJAX + JSF + JPA + EJB 3.0 + BPM

   Log4J – logging framework for Java

   JUnit – Test Driven Development in Java

   Maven – actually not a framework, more of a build
    system, but still………
   Wikipedia

   Personal Website of Martin Fowler

   Stackoverflow

   Official Spring Documentation

   Coding Horror

   Official Java EE 6 Tutorial
Questions?

Contenu connexe

Tendances

Asp.net MVC training session
Asp.net MVC training sessionAsp.net MVC training session
Asp.net MVC training sessionHrichi Mohamed
 
Impactos no Design utilizando programação funcional Light Talk
Impactos no Design utilizando programação funcional Light TalkImpactos no Design utilizando programação funcional Light Talk
Impactos no Design utilizando programação funcional Light TalkLuiz Costa
 
Spring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trendsSpring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trendsArawn Park
 
MVC for Desktop Application - Part 3
MVC for Desktop Application - Part 3MVC for Desktop Application - Part 3
MVC for Desktop Application - Part 3晟 沈
 
Grails 2.0 vs asp.net mvc 4
Grails 2.0 vs asp.net mvc 4Grails 2.0 vs asp.net mvc 4
Grails 2.0 vs asp.net mvc 4Umar Ali
 
MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1晟 沈
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگوrailsbootcamp
 
Journey Through The Javascript MVC Jungle
Journey Through The Javascript MVC JungleJourney Through The Javascript MVC Jungle
Journey Through The Javascript MVC JungleBaris Aydinoglu
 
MV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaMV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaYi-Shou Chen
 
Building Large Scale Javascript Application
Building Large Scale Javascript ApplicationBuilding Large Scale Javascript Application
Building Large Scale Javascript ApplicationAnis Ahmad
 
A Taste of Java ME
A Taste of Java MEA Taste of Java ME
A Taste of Java MEwiradikusuma
 

Tendances (20)

Asp.net MVC training session
Asp.net MVC training sessionAsp.net MVC training session
Asp.net MVC training session
 
Jsf presentation
Jsf presentationJsf presentation
Jsf presentation
 
Impactos no Design utilizando programação funcional Light Talk
Impactos no Design utilizando programação funcional Light TalkImpactos no Design utilizando programação funcional Light Talk
Impactos no Design utilizando programação funcional Light Talk
 
Spring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trendsSpring framework 3.2 > 4.0 — themes and trends
Spring framework 3.2 > 4.0 — themes and trends
 
Java server faces
Java server facesJava server faces
Java server faces
 
JavaEE6 my way
JavaEE6 my wayJavaEE6 my way
JavaEE6 my way
 
MVC for Desktop Application - Part 3
MVC for Desktop Application - Part 3MVC for Desktop Application - Part 3
MVC for Desktop Application - Part 3
 
Jsf 2.0 Overview
Jsf 2.0 OverviewJsf 2.0 Overview
Jsf 2.0 Overview
 
ASP .net MVC
ASP .net MVCASP .net MVC
ASP .net MVC
 
Grails 2.0 vs asp.net mvc 4
Grails 2.0 vs asp.net mvc 4Grails 2.0 vs asp.net mvc 4
Grails 2.0 vs asp.net mvc 4
 
MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1MVC for Desktop Application - Part 1
MVC for Desktop Application - Part 1
 
بررسی چارچوب جنگو
بررسی چارچوب جنگوبررسی چارچوب جنگو
بررسی چارچوب جنگو
 
ASP.NET MVC 3
ASP.NET MVC 3ASP.NET MVC 3
ASP.NET MVC 3
 
Journey Through The Javascript MVC Jungle
Journey Through The Javascript MVC JungleJourney Through The Javascript MVC Jungle
Journey Through The Javascript MVC Jungle
 
Asp.Net MVC3 - Basics
Asp.Net MVC3 - BasicsAsp.Net MVC3 - Basics
Asp.Net MVC3 - Basics
 
MV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoaMV(C, mvvm) in iOS and ReactiveCocoa
MV(C, mvvm) in iOS and ReactiveCocoa
 
Building Large Scale Javascript Application
Building Large Scale Javascript ApplicationBuilding Large Scale Javascript Application
Building Large Scale Javascript Application
 
A Taste of Java ME
A Taste of Java MEA Taste of Java ME
A Taste of Java ME
 
MVVM Lights
MVVM LightsMVVM Lights
MVVM Lights
 
Spring and DWR
Spring and DWRSpring and DWR
Spring and DWR
 

Similaire à A brief overview of java frameworks

Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Oliver Gierke
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJiayun Zhou
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller ColumnsJonathan Fine
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNicole Gomez
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Steven Smith
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of PatternsChris Eargle
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?Oliver Gierke
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Svetlin Nakov
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshowilias ahmed
 
Java design patterns
Java design patternsJava design patterns
Java design patternsShawn Brito
 
Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder paramisoft
 
Javascript internals
Javascript internalsJavascript internals
Javascript internalsNir Noy
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsJeff Durta
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application FrameworkJady Yang
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from InstagramJay Ren
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAVINASH KUMAR
 

Similaire à A brief overview of java frameworks (20)

React native
React nativeReact native
React native
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Whoops! Where did my architecture go?
Whoops! Where did my architecture go?Whoops! Where did my architecture go?
Whoops! Where did my architecture go?
 
Java EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSFJava EE 6 CDI Integrates with Spring & JSF
Java EE 6 CDI Integrates with Spring & JSF
 
L09 Frameworks
L09 FrameworksL09 Frameworks
L09 Frameworks
 
JavaScript Miller Columns
JavaScript Miller ColumnsJavaScript Miller Columns
JavaScript Miller Columns
 
Nt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language AnalysisNt1310 Unit 3 Language Analysis
Nt1310 Unit 3 Language Analysis
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
 
Evolution of Patterns
Evolution of PatternsEvolution of Patterns
Evolution of Patterns
 
Whoops! where did my architecture go?
Whoops! where did my architecture go?Whoops! where did my architecture go?
Whoops! where did my architecture go?
 
Group111
Group111Group111
Group111
 
Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015Entity Framework: Nakov @ BFU Hackhaton 2015
Entity Framework: Nakov @ BFU Hackhaton 2015
 
Oop features java presentationshow
Oop features java presentationshowOop features java presentationshow
Oop features java presentationshow
 
Java design patterns
Java design patternsJava design patterns
Java design patterns
 
Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder Desing pattern prototype-Factory Method, Prototype and Builder
Desing pattern prototype-Factory Method, Prototype and Builder
 
Javascript internals
Javascript internalsJavascript internals
Javascript internals
 
Adding a modern twist to legacy web applications
Adding a modern twist to legacy web applicationsAdding a modern twist to legacy web applications
Adding a modern twist to legacy web applications
 
Xopus Application Framework
Xopus Application FrameworkXopus Application Framework
Xopus Application Framework
 
Fabric - a server management tool from Instagram
Fabric - a server management tool from InstagramFabric - a server management tool from Instagram
Fabric - a server management tool from Instagram
 
Advanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sirAdvanced java jee material by KV Rao sir
Advanced java jee material by KV Rao sir
 

Plus de MD Sayem Ahmed

Distributed systems - A Primer
Distributed systems - A PrimerDistributed systems - A Primer
Distributed systems - A PrimerMD Sayem Ahmed
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method PatternMD Sayem Ahmed
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1MD Sayem Ahmed
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascriptMD Sayem Ahmed
 

Plus de MD Sayem Ahmed (6)

Distributed systems - A Primer
Distributed systems - A PrimerDistributed systems - A Primer
Distributed systems - A Primer
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method Pattern
 
An Introduction to Maven Part 1
An Introduction to Maven Part 1An Introduction to Maven Part 1
An Introduction to Maven Part 1
 
Restful web services
Restful web servicesRestful web services
Restful web services
 
An introduction to javascript
An introduction to javascriptAn introduction to javascript
An introduction to javascript
 
01. design pattern
01. design pattern01. design pattern
01. design pattern
 

Dernier

ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...JojoEDelaCruz
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmStan Meyer
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)lakshayb543
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operationalssuser3e220a
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEaurabinda banchhor
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfErwinPantujan2
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataBabyAnnMotar
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsRommel Regala
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Celine George
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfVanessa Camilleri
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxJanEmmanBrigoli
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSMae Pangan
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designMIPLM
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 

Dernier (20)

ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
ENG 5 Q4 WEEk 1 DAY 1 Restate sentences heard in one’s own words. Use appropr...
 
Oppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and FilmOppenheimer Film Discussion for Philosophy and Film
Oppenheimer Film Discussion for Philosophy and Film
 
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
Visit to a blind student's school🧑‍🦯🧑‍🦯(community medicine)
 
Expanded definition: technical and operational
Expanded definition: technical and operationalExpanded definition: technical and operational
Expanded definition: technical and operational
 
Dust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSEDust Of Snow By Robert Frost Class-X English CBSE
Dust Of Snow By Robert Frost Class-X English CBSE
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdfVirtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
Virtual-Orientation-on-the-Administration-of-NATG12-NATG6-and-ELLNA.pdf
 
Measures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped dataMeasures of Position DECILES for ungrouped data
Measures of Position DECILES for ungrouped data
 
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptxLEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
LEFT_ON_C'N_ PRELIMS_EL_DORADO_2024.pptx
 
Paradigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTAParadigm shift in nursing research by RS MEHTA
Paradigm shift in nursing research by RS MEHTA
 
The Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World PoliticsThe Contemporary World: The Globalization of World Politics
The Contemporary World: The Globalization of World Politics
 
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
Incoming and Outgoing Shipments in 3 STEPS Using Odoo 17
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
ICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdfICS2208 Lecture6 Notes for SL spaces.pdf
ICS2208 Lecture6 Notes for SL spaces.pdf
 
Millenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptxMillenials and Fillennials (Ethical Challenge and Responses).pptx
Millenials and Fillennials (Ethical Challenge and Responses).pptx
 
Textual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHSTextual Evidence in Reading and Writing of SHS
Textual Evidence in Reading and Writing of SHS
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
Keynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-designKeynote by Prof. Wurzer at Nordex about IP-design
Keynote by Prof. Wurzer at Nordex about IP-design
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptxYOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
YOUVE GOT EMAIL_FINALS_EL_DORADO_2024.pptx
 

A brief overview of java frameworks

  • 1.
  • 2. Object Oriented Development Principles and their uses  Standard(?) Design Patterns and their roles  Patterns in Java and their uses  Overview of Spring Framework  Evolution of Java EE 6 – All the goodies are now in official package  A brief introduction to JUnit – Test Driven Development in Java
  • 3. The special three – • Encapsulation – hiding the concrete implementations • Polymorphism – objects has more than one form • Inheritance – reusing functionalities  And some of their derived form/application – • Program to an interface, not to an implementation • Favor object composition over inheritance and much more, most notably, Design Patterns……………
  • 4. Single Responsibility Principle  Open-Close Principle  Liskov Substitution Principle  Interface Segregation Principle  Dependency Inversion Principle
  • 5. A defining characteristics of a framework  It’s all about moving away the flow of controls to the frameworks.
  • 6. Let us consider a program that perform some simple command line query – puts 'What is your name?' name = gets process_name(name) puts 'What is your quest?' quest = gets process_quest(quest)
  • 7. However, in a window system, I would write something like this – require 'tk' root = TkRoot.new() name_label = TkLabel.new() {text "What is Your Name?"} name_label.pack name = TkEntry.new(root).pack name.bind("FocusOut") {process_name(name)} quest_label = TkLabel.new() {text "What is Your Quest?"} quest_label.pack quest = TkEntry.new(root).pack quest.bind("FocusOut") {process_quest(quest)} Tk.mainloop()
  • 8. The control of execution has been handed over to the windowing system.  The control is Inverted, the framework calls the code rather than rather than the code calling the framework.  This principle is also known as Hollywood Principle.
  • 9. Let us write a software component that provides a list of movies directed by a particular director – class MovieLister... public Movie[] moviesDirectedBy(String arg) { List allMovies = finder.findAll(); for (Iterator it = allMovies.iterator(); it.hasNext();) { Movie movie = (Movie) it.next(); if (!movie.getDirector().equals(arg)) it.remove(); } return (Movie[]) allMovies.toArray(new Movie[allMovies.size()]); }
  • 10. moviesDirectedBy is dependent on the implementation of the finder object.  Let’s make this method completely independent of how all the movies are being stored. So all the method does is refer to a finder, and all that finder does is know how to respond to the findAll method.
  • 11. It can be done easily by defining an interface – public interface MovieFinder { List findAll(); }
  • 12. Let’s provide a concrete implementation of MovieFinder - class MovieLister... private MovieFinder finder; public MovieLister() { finder = new ColonDelimitedMovieFinder("movies1.txt"); }
  • 13. Now we have a new problem – how to get an instance of the right finder implementation into place
  • 14. The implementation class for the finder isn't linked into the program at compile time. Instead we want this lister to work with any implementation, and for that implementation to be plugged in at some later point.  The problem is how that link could be made so that lister class is ignorant of the implementation class, but can still talk to an instance to do its work.
  • 15. The basic idea of the Dependency Injection is to have a separate object, an assembler, that populates a field in the lister class with an appropriate implementation for the finder interface.
  • 16. Type 1 IoC - Interface Injection  Type 2 IoC - Setter Injection  Type 3 IoC - Constructor Injection
  • 17. Define a setter method for populating finder – class MovieLister... private MovieFinder finder; public void setFinder(MovieFinder finder) { this.finder = finder; }
  • 18. Similarly let us define a setter for the filename - class ColonMovieFinder... public void setFilename(String filename) { this.filename = filename; }
  • 19. The third step is to set up the configuration for the files. Spring supports configuration through XML files and also through code, but XML is the expected way to do it – <beans> <bean id="MovieLister" class="spring.MovieLister"> <property name="finder"> <ref local="MovieFinder"/> </property> </bean> <bean id="MovieFinder" class="spring.ColonMovieFinder"> <property name="filename"> <value>movies1.txt</value> </property> </bean> </beans>
  • 20. And then the test – public void testWithSpring() throws Exception{ ApplicationContext ctx = new FileSystemXmlApplicationContext("spring.xml"); MovieLister lister = (MovieLister)ctx.getBean("MovieLister"); Movie[] movies = lister.moviesDirectedBy("Sergio Leone"); assertEquals("Once Upon a Time in the West", movies[0].getTitle()); } WHERE DID THE new GO ?!
  • 21.
  • 22. Spring  Google Guice – created by Google  Pico Container  Avalon  Context and Dependency Injection – official Sun Java DI Container  Seasar
  • 23. Assume you have a graphical class with many set...() methods. After each set method, the data of the graphics changed, thus the graphics changed and thus the graphics need to be updated on screen.  Assume to repaint the graphics you must call Display.update().
  • 24. The classical approach is to solve this by adding more code. At the end of each set method you write – void set...(...) { : : Display.update(); }
  • 25. What will happen if there are 20-30 of these set methods ?  Also whenever a new set-method is added, developers must be sure to not forget adding this to the end, otherwise they just created a bug.
  • 26. AOP solves this without adding tons of code, instead you add an aspect - after() : set() { Display.update(); } after running any method that is a set pointcut, run the following code.
  • 27. And you define a point cut – pointcut set() : execution(* set*(*) ) && this(MyGraphicsClass) && within(com.company.*); If a method is named set* (* means any name might follow after set), regardless of what the method returns (first asterisk) or what parameters it takes (third asterisk) and it is a method of MyGraphicsClass and this class is part of the package com.company.*, then this is a set() pointcut.
  • 28. This example also shows one of the big downsides of AOP. It is actually doing something that many programmers consider an Anti-Pattern. The exact pattern is called Action at a distance.  Action at a distance is an anti-pattern (a recognized common error) in which behavior in one part of a program varies wildly based on difficult or impossible to identify operations in another part of the program.
  • 29. AspectJ  Spring  Seasar
  • 30. Object-relational mapping is a programming technique for converting data between incompatible type systems in relational databases and object-oriented programming languages.  This creates, in effect, a virtual object database that can be used from within the programming language.  It's good for abstracting the datastore out in order to provide an interface that can be used in your code.
  • 31. Without ORM, we write code like this – String sql = "SELECT ... FROM persons WHERE id = 10"; DbCommand cmd = new DbCommand(connection, sql); Result res = cmd.Execute(); String name = res[0]["FIRST_NAME"];  With the help of ORM tools, we can do – Person p = repository.GetPerson(10); String name = p.FirstName; Or - Person p = Person.Get(Person.Properties.Id == 10);
  • 32. The SQL is hidden away from logic code. This has the benefit of allowing developers to more easily support more database engines.  Developers can focus on writing the logic, instead of getting all the SQL right. The code will typically be more readable as well.
  • 33. Object-relational mapping is the Vietnam of our industry – Ted Neward.  Developers are struggling for years with the huge mismatch between relational database models and traditional object models.
  • 34. Granularity – more classes than the number of corresponding tables.  Subtyping  Identity – primary key vs. object identity and object equality  Associations – unidirectional in OOP vs. foreign keys.  Data Navigation – walking the object graph vs. SQL joins
  • 35. Hibernate – the highly popular ORM tool for Java, has a corresponding .NET version too (NHibernate). Uses HQL.  Java Persistence API – official sun java specification for managing persistence.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40. Seam Framework – AJAX + JSF + JPA + EJB 3.0 + BPM  Log4J – logging framework for Java  JUnit – Test Driven Development in Java  Maven – actually not a framework, more of a build system, but still………
  • 41. Wikipedia  Personal Website of Martin Fowler  Stackoverflow  Official Spring Documentation  Coding Horror  Official Java EE 6 Tutorial