SlideShare a Scribd company logo
   M



public class Shape{
  protected int h,w;
  public void setWidth(int w){
           this.w = w;
  }
  public void setHeight(int h){
           this.h = h;                   →
  }
}
public class Rectangele extends Shape{
}

public class Square extends Rectangle{
  protected int h,w;
  public void setWidth(int w){
           this.w = w;                   →
           this.h = h;
  }
  public void setHeight(int h){
           this.w = w;
           this.h = h;
  }
}
LSP
public class Shape{
  protected int h,w;
                                         ArrayList<Rectangele> list
  public void setWidth(int w){                  = new ArrayList<Rectangele>();
           this.w = w;
  }
  public void setHeight(int h){          for(Rectangler r : list){
  }
           this.h = h;                          r.setWidth(20);
}                                               r.setHeight(10);
                                         }
public class Rectangele extends Shape{
}

public class Square extends Rectangle{
  protected int h,w;
  public void setWidth(int w){
           this.w = w;
           this.h = h;
  }                                      List        Square
  public void setHeight(int h){
           this.w = w;
           this.h = h;
  }
}
public class User{
   public void dosth(Shape s){                     public Interface Shape{
      s.dosth();                                      public void dosth();
   }                                               }
}


       public class Rectangle implements Shape{    public class Square implements Shape{
          public void dosth(){                        public void dosth(){
             System.out.println(“do something”);         System.out.println(“do something”);
          }                                           }
       }                                           }




                                  Light Weight
                   POJP          Plain Old Java Object


   Gof
   23        new



         →
   Temprate Method
   Strategy

   Factory Method

   Command
   State
   Null Object
Template Method
public abstract class DBInterface{                     public class OracleInterface extends DBInterface{
  public Date getData(){                                 protected void init(){
     init();                                                  //
     Data data = getData();
     exit();
     return data;                                          }
  }                                                        protected Data getData(){
   protected abstract void init();                             //
   protected abstract Data getData();                      }
   protected abstract void exit();                         protected void exit(){
}                                                              //


                                                         }
                                        extends        }ublic class FireBirdInterface extends DBInterface{
                                                       p
                                                          ////
                                                       }
                                   Data



                                                 DBInterface
             =
      =public
Strategy
    public Interface DBInterface{               public class OracleInterface implements DBInterface{
      public void init();                         public void init(){
      public Data getData();                           //
      public void exit();                           }
    }                                               public Data getData(){
                                                       //
                                                    }
                           implements               public void exit(){
                                                       //
                                                    }
                                                }


                                                public class FireBirdInterface implements DBInterface{
                                                   ////
                                                }

    Template



                                       DBInterface
Template Method                          Strategy
    public class TemlePrinter {                                     Template Method
      main(){
        DBInterface di = new OracleInterface();
        print(di.getData());                              uses
      }                                                                        getData()
    }


    public class StratPrinter {
      main(){                                                       Strategy
        DBInterface di = new OracleInterface();
        di.init()
        print(di.getData());                              uses       init()        getData()
        di.exit();
      }                                                              exit()
    }

    Template Method                                                               Strategy

                       =                         Template Method
                              Strategy
                        Strategy                                                              init
                                         DB                               Template Method
Factory Method
                                                                         public Interface Bond{
                public Interface BondFactory{           creates            public int getMaturity();
                  public Bond getBondInstance();
                                                                           public BigDecimal getFairValue();
                }
                                                                         }

                                  implements                                                implements

    public class TreasuryFactory implements BondFactory{             public class Treasury implements Bond{
       public Bond getBondInstance(){                                   ////
          return new Treasury();                                     }
       }
    }


    public class ConvertibleFactory implements BondFactory{         public class Convertible implements Bond{
       public Bond getBondInstance(){                                  ////
          return new Convertible();
                                                                    }
       }
    }






                     Bond                                    Strategy   Template
                      Factory                                                                     Factory
Command



 public class User{
    public void dosth(Tranzaction t,String id){
       t.do(id);                                             public Interface Tranzaction{
    }                                                           public void do(String id);
 }                                                           }



  public class addCommand implements Tranzaction{
     public void do(String id){
        //
      }
  }

                                                  public class removeCommand implements Tranzaction{
                                                     public void do(String id){
                                                        //
                                                      }
                                                  }
State



  public class User{
     State s = n;
     public void dosth(){                                 public Interface State{
        s.do();                                              public int do();
     }                                                    }
  }


   public class GoodState implements State{
      public void do(){
         System.ouit.println(“Good State”);
      }
   }

                                              public class BadState implements State{
                                                 public void do(){
                                                    System.ouit.println(“Good State”);
                                                 }
                                              }
Null Object

                 Null

 public class User{
    public void dosth(Tranzaction t,String id){   public Interface Tranzaction{
       t.do(id);                                     public void do(String id);
    }                                             }
 }




                              public class NullCommand implements Tranzaction{
                                 public void do(String id){
                                       //
                                   }
                              }
DI Dipendency Injection


 public class User{
    public void dosth(Tranzaction t,String id){
       t.do(id);                                             public Interface Tranzaction{
    }                                                           public void do(String id);
 }                                                           }




                DI

         Tranzaction

                                                  public class removeCommand implements Tranzaction{
                                                     public void do(String id){
                                                        //
                                                      }
                                                  }
DI
                new

     –


     –




   DI
     – Spring
     – Seaser2
     – EJB 3.0
Strategy/Temprate Method



DI
20070329 Object Oriented Programing Tips

More Related Content

What's hot

Design pattern part 2 - structural pattern
Design pattern part 2 - structural patternDesign pattern part 2 - structural pattern
Design pattern part 2 - structural pattern
Jieyi Wu
 
Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3
Jieyi Wu
 
11slide
11slide11slide
Wed 1630 greene_robert_color
Wed 1630 greene_robert_colorWed 1630 greene_robert_color
Wed 1630 greene_robert_color
DATAVERSITY
 
Awt
AwtAwt
Lecture21
Lecture21Lecture21
Lecture21
elearning_portal
 
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
ZendCon
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
Cheng Ta Yeh
 
Java Code for Sample Projects Inheritance
Java Code for Sample Projects InheritanceJava Code for Sample Projects Inheritance
Java Code for Sample Projects Inheritance
jwjablonski
 
10slide
10slide10slide
08slide
08slide08slide
11slide
11slide11slide
11slide
IIUM
 
Concurrencyproblem
ConcurrencyproblemConcurrencyproblem
Concurrencyproblem
Adriano Patrick Cunha
 
JNI - Java & C in the same project
JNI - Java & C in the same projectJNI - Java & C in the same project
JNI - Java & C in the same project
Karol Wrótniak
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
Carol McDonald
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
Juan Pablo
 
Treinamento Qt básico - aula II
Treinamento Qt básico - aula IITreinamento Qt básico - aula II
Treinamento Qt básico - aula II
Marcelo Barros de Almeida
 
Java Day-1
Java Day-1Java Day-1
Java Day-1
People Strategists
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
Oleksii Usyk
 
Java_practical_handbook
Java_practical_handbookJava_practical_handbook
Java_practical_handbook
Manusha Dilan
 

What's hot (20)

Design pattern part 2 - structural pattern
Design pattern part 2 - structural patternDesign pattern part 2 - structural pattern
Design pattern part 2 - structural pattern
 
Design pattern - part 3
Design pattern - part 3Design pattern - part 3
Design pattern - part 3
 
11slide
11slide11slide
11slide
 
Wed 1630 greene_robert_color
Wed 1630 greene_robert_colorWed 1630 greene_robert_color
Wed 1630 greene_robert_color
 
Awt
AwtAwt
Awt
 
Lecture21
Lecture21Lecture21
Lecture21
 
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
Architecting for PHP5 - Why "Runs on PHP5" is not "Written for PHP5"
 
Spring Data JPA
Spring Data JPASpring Data JPA
Spring Data JPA
 
Java Code for Sample Projects Inheritance
Java Code for Sample Projects InheritanceJava Code for Sample Projects Inheritance
Java Code for Sample Projects Inheritance
 
10slide
10slide10slide
10slide
 
08slide
08slide08slide
08slide
 
11slide
11slide11slide
11slide
 
Concurrencyproblem
ConcurrencyproblemConcurrencyproblem
Concurrencyproblem
 
JNI - Java & C in the same project
JNI - Java & C in the same projectJNI - Java & C in the same project
JNI - Java & C in the same project
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
 
Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#Lo Mejor Del Pdc2008 El Futrode C#
Lo Mejor Del Pdc2008 El Futrode C#
 
Treinamento Qt básico - aula II
Treinamento Qt básico - aula IITreinamento Qt básico - aula II
Treinamento Qt básico - aula II
 
Java Day-1
Java Day-1Java Day-1
Java Day-1
 
Spring data presentation
Spring data presentationSpring data presentation
Spring data presentation
 
Java_practical_handbook
Java_practical_handbookJava_practical_handbook
Java_practical_handbook
 

Viewers also liked

Principles of object oriented programing
Principles of object oriented programingPrinciples of object oriented programing
Principles of object oriented programing
Ahammed Alamin
 
Oops concept
Oops conceptOops concept
Basic concepts of oops
Basic concepts of oopsBasic concepts of oops
Basic concepts of oops
Chandrakiran Satdeve
 
concept of oops
concept of oopsconcept of oops
concept of oops
prince sharma
 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
Amritsinghmehra
 
Flip flops (ff)
Flip flops (ff)Flip flops (ff)
Flip flops (ff)
Arturo Guillén
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
Salahaddin University-Erbil
 
Flip flop
Flip flopFlip flop
Flip flop
hattieu16590
 
Flip flop’s state tables & diagrams
Flip flop’s state tables & diagramsFlip flop’s state tables & diagrams
Flip flop’s state tables & diagrams
Sunny Khatana
 
What are Flip Flops and Its types.
What are Flip Flops and Its types.What are Flip Flops and Its types.
What are Flip Flops and Its types.
Satya P. Joshi
 
Flipflop
FlipflopFlipflop
Flipflop
sohamdodia27
 
Oops ppt
Oops pptOops ppt
Oops ppt
abhayjuneja
 
Chapter 4 flip flop for students
Chapter 4 flip flop for studentsChapter 4 flip flop for students
Chapter 4 flip flop for students
CT Sabariah Salihin
 

Viewers also liked (13)

Principles of object oriented programing
Principles of object oriented programingPrinciples of object oriented programing
Principles of object oriented programing
 
Oops concept
Oops conceptOops concept
Oops concept
 
Basic concepts of oops
Basic concepts of oopsBasic concepts of oops
Basic concepts of oops
 
concept of oops
concept of oopsconcept of oops
concept of oops
 
OOPS IN C++
OOPS IN C++OOPS IN C++
OOPS IN C++
 
Flip flops (ff)
Flip flops (ff)Flip flops (ff)
Flip flops (ff)
 
Object-Oriented Programming Using C++
Object-Oriented Programming Using C++Object-Oriented Programming Using C++
Object-Oriented Programming Using C++
 
Flip flop
Flip flopFlip flop
Flip flop
 
Flip flop’s state tables & diagrams
Flip flop’s state tables & diagramsFlip flop’s state tables & diagrams
Flip flop’s state tables & diagrams
 
What are Flip Flops and Its types.
What are Flip Flops and Its types.What are Flip Flops and Its types.
What are Flip Flops and Its types.
 
Flipflop
FlipflopFlipflop
Flipflop
 
Oops ppt
Oops pptOops ppt
Oops ppt
 
Chapter 4 flip flop for students
Chapter 4 flip flop for studentsChapter 4 flip flop for students
Chapter 4 flip flop for students
 

Similar to 20070329 Object Oriented Programing Tips

Test Engine
Test EngineTest Engine
Test Engine
guestcdaa2dc
 
CDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptor
Caelum
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
Giordano Scalzo
 
Implementation of interface9 cm604.30
Implementation of interface9 cm604.30Implementation of interface9 cm604.30
Implementation of interface9 cm604.30
myrajendra
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java
DEVTYPE
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
Chris Weldon
 
Java осень 2012 лекция 2
Java осень 2012 лекция 2Java осень 2012 лекция 2
Java осень 2012 лекция 2
Technopark
 
Inheritance and polymorphism
Inheritance and polymorphismInheritance and polymorphism
Inheritance and polymorphism
mohamed sikander
 
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO ProprietySOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
Chris Weldon
 
Design Patterns
Design PatternsDesign Patterns
Oop lecture5
Oop lecture5Oop lecture5
Oop lecture5
Shahriar Robbani
 
More on Classes and Objects
More on Classes and ObjectsMore on Classes and Objects
More on Classes and Objects
Payel Guria
 
inhertance c++
inhertance c++inhertance c++
inhertance c++
abhilashagupta
 
Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
Jamie (Taka) Wang
 
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasaLaporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Deprilana Ego Prakasa
 
Map struct
Map structMap struct
Map struct
Hyosang Hong
 
Map struct
Map structMap struct
Map struct
Hyosang Hong
 
Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Lecture 6, c++(complete reference,herbet sheidt)chapter-16Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Abu Saleh
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy Code
Daniel Wellman
 
Lec 42.43 - virtual.functions
Lec 42.43 - virtual.functionsLec 42.43 - virtual.functions
Lec 42.43 - virtual.functions
Princess Sam
 

Similar to 20070329 Object Oriented Programing Tips (20)

Test Engine
Test EngineTest Engine
Test Engine
 
CDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptorCDI e as ideias pro futuro do VRaptor
CDI e as ideias pro futuro do VRaptor
 
Better Software: introduction to good code
Better Software: introduction to good codeBetter Software: introduction to good code
Better Software: introduction to good code
 
Implementation of interface9 cm604.30
Implementation of interface9 cm604.30Implementation of interface9 cm604.30
Implementation of interface9 cm604.30
 
3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java3. Объекты, классы и пакеты в Java
3. Объекты, классы и пакеты в Java
 
SOLID Principles
SOLID PrinciplesSOLID Principles
SOLID Principles
 
Java осень 2012 лекция 2
Java осень 2012 лекция 2Java осень 2012 лекция 2
Java осень 2012 лекция 2
 
Inheritance and polymorphism
Inheritance and polymorphismInheritance and polymorphism
Inheritance and polymorphism
 
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO ProprietySOLID - Not Just a State of Matter, It's Principles for OO Propriety
SOLID - Not Just a State of Matter, It's Principles for OO Propriety
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Oop lecture5
Oop lecture5Oop lecture5
Oop lecture5
 
More on Classes and Objects
More on Classes and ObjectsMore on Classes and Objects
More on Classes and Objects
 
inhertance c++
inhertance c++inhertance c++
inhertance c++
 
Object-oriented Basics
Object-oriented BasicsObject-oriented Basics
Object-oriented Basics
 
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasaLaporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
Laporan ai modul 2-if b 2014-14102055-deprilana ego prakasa
 
Map struct
Map structMap struct
Map struct
 
Map struct
Map structMap struct
Map struct
 
Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Lecture 6, c++(complete reference,herbet sheidt)chapter-16Lecture 6, c++(complete reference,herbet sheidt)chapter-16
Lecture 6, c++(complete reference,herbet sheidt)chapter-16
 
How to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy CodeHow to Start Test-Driven Development in Legacy Code
How to Start Test-Driven Development in Legacy Code
 
Lec 42.43 - virtual.functions
Lec 42.43 - virtual.functionsLec 42.43 - virtual.functions
Lec 42.43 - virtual.functions
 

More from Shingo Furuyama

ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性
ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性
ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性
Shingo Furuyama
 
Hadoop Source Code Reading #17
Hadoop Source Code Reading #17Hadoop Source Code Reading #17
Hadoop Source Code Reading #17
Shingo Furuyama
 
Hadoop distributions as of 20131231
Hadoop distributions as of 20131231Hadoop distributions as of 20131231
Hadoop distributions as of 20131231Shingo Furuyama
 
Askusa on AWS
Askusa on AWSAskusa on AWS
Askusa on AWS
Shingo Furuyama
 
Askusa on aws
Askusa on awsAskusa on aws
Askusa on aws
Shingo Furuyama
 
Askusa on aws
Askusa on awsAskusa on aws
Askusa on aws
Shingo Furuyama
 
Clojureのstm実装について
Clojureのstm実装についてClojureのstm実装について
Clojureのstm実装について
Shingo Furuyama
 
Asakusa Framework Tutorial β版
Asakusa Framework Tutorial β版Asakusa Framework Tutorial β版
Asakusa Framework Tutorial β版
Shingo Furuyama
 
20070329 Tech Study
20070329 Tech Study 20070329 Tech Study
20070329 Tech Study
Shingo Furuyama
 
20070329 Java Programing Tips
20070329 Java Programing Tips20070329 Java Programing Tips
20070329 Java Programing Tips
Shingo Furuyama
 
#ajn3.lt.marblejenka
#ajn3.lt.marblejenka#ajn3.lt.marblejenka
#ajn3.lt.marblejenka
Shingo Furuyama
 

More from Shingo Furuyama (12)

ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性
ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性
ストリームデータに量子アニーリングを適用するアプリケーションフレームワークとその有用性
 
Hadoop Source Code Reading #17
Hadoop Source Code Reading #17Hadoop Source Code Reading #17
Hadoop Source Code Reading #17
 
Hadoop distributions as of 20131231
Hadoop distributions as of 20131231Hadoop distributions as of 20131231
Hadoop distributions as of 20131231
 
Askusa on AWS
Askusa on AWSAskusa on AWS
Askusa on AWS
 
Askusa on aws
Askusa on awsAskusa on aws
Askusa on aws
 
Askusa on aws
Askusa on awsAskusa on aws
Askusa on aws
 
Clojureのstm実装について
Clojureのstm実装についてClojureのstm実装について
Clojureのstm実装について
 
Asakusa Framework Tutorial β版
Asakusa Framework Tutorial β版Asakusa Framework Tutorial β版
Asakusa Framework Tutorial β版
 
20070329 Tech Study
20070329 Tech Study 20070329 Tech Study
20070329 Tech Study
 
20070329 Java Programing Tips
20070329 Java Programing Tips20070329 Java Programing Tips
20070329 Java Programing Tips
 
#ajn6.lt.marblejenka
#ajn6.lt.marblejenka#ajn6.lt.marblejenka
#ajn6.lt.marblejenka
 
#ajn3.lt.marblejenka
#ajn3.lt.marblejenka#ajn3.lt.marblejenka
#ajn3.lt.marblejenka
 

Recently uploaded

Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
Zilliz
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
Jason Packer
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Wask
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
Tatiana Kojar
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
MichaelKnudsen27
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
DanBrown980551
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
Mariano Tinti
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
Matthew Sinclair
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Jeffrey Haguewood
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
Postman
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
SitimaJohn
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Tosin Akinosho
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
fredae14
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Alpen-Adria-Universität
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
ssuserfac0301
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
IndexBug
 

Recently uploaded (20)

Fueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte WebinarFueling AI with Great Data with Airbyte Webinar
Fueling AI with Great Data with Airbyte Webinar
 
Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024Columbus Data & Analytics Wednesdays - June 2024
Columbus Data & Analytics Wednesdays - June 2024
 
Digital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying AheadDigital Marketing Trends in 2024 | Guide for Staying Ahead
Digital Marketing Trends in 2024 | Guide for Staying Ahead
 
TrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy SurveyTrustArc Webinar - 2024 Global Privacy Survey
TrustArc Webinar - 2024 Global Privacy Survey
 
Skybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoptionSkybuffer SAM4U tool for SAP license adoption
Skybuffer SAM4U tool for SAP license adoption
 
Nordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptxNordic Marketo Engage User Group_June 13_ 2024.pptx
Nordic Marketo Engage User Group_June 13_ 2024.pptx
 
5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides5th LF Energy Power Grid Model Meet-up Slides
5th LF Energy Power Grid Model Meet-up Slides
 
Mariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceXMariano G Tinti - Decoding SpaceX
Mariano G Tinti - Decoding SpaceX
 
20240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 202420240609 QFM020 Irresponsible AI Reading List May 2024
20240609 QFM020 Irresponsible AI Reading List May 2024
 
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
Salesforce Integration for Bonterra Impact Management (fka Social Solutions A...
 
WeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation TechniquesWeTestAthens: Postman's AI & Automation Techniques
WeTestAthens: Postman's AI & Automation Techniques
 
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptxOcean lotus Threat actors project by John Sitima 2024 (1).pptx
Ocean lotus Threat actors project by John Sitima 2024 (1).pptx
 
Monitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdfMonitoring and Managing Anomaly Detection on OpenShift.pdf
Monitoring and Managing Anomaly Detection on OpenShift.pdf
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
Recommendation System using RAG Architecture
Recommendation System using RAG ArchitectureRecommendation System using RAG Architecture
Recommendation System using RAG Architecture
 
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing InstancesEnergy Efficient Video Encoding for Cloud and Edge Computing Instances
Energy Efficient Video Encoding for Cloud and Edge Computing Instances
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Taking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdfTaking AI to the Next Level in Manufacturing.pdf
Taking AI to the Next Level in Manufacturing.pdf
 
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial IntelligenceAI 101: An Introduction to the Basics and Impact of Artificial Intelligence
AI 101: An Introduction to the Basics and Impact of Artificial Intelligence
 

20070329 Object Oriented Programing Tips

  • 1.
  • 2. M 
  • 3. public class Shape{ protected int h,w; public void setWidth(int w){ this.w = w; } public void setHeight(int h){ this.h = h; → } } public class Rectangele extends Shape{ } public class Square extends Rectangle{ protected int h,w; public void setWidth(int w){ this.w = w; → this.h = h; } public void setHeight(int h){ this.w = w; this.h = h; } }
  • 4. LSP public class Shape{ protected int h,w; ArrayList<Rectangele> list public void setWidth(int w){ = new ArrayList<Rectangele>(); this.w = w; } public void setHeight(int h){ for(Rectangler r : list){ } this.h = h; r.setWidth(20); } r.setHeight(10); } public class Rectangele extends Shape{ } public class Square extends Rectangle{ protected int h,w; public void setWidth(int w){ this.w = w; this.h = h; } List Square public void setHeight(int h){ this.w = w; this.h = h; } }
  • 5. public class User{ public void dosth(Shape s){ public Interface Shape{ s.dosth(); public void dosth(); } } } public class Rectangle implements Shape{ public class Square implements Shape{ public void dosth(){ public void dosth(){ System.out.println(“do something”); System.out.println(“do something”); } } } } Light Weight POJP Plain Old Java Object
  • 6.   Gof  23 new  →
  • 7. Temprate Method  Strategy  Factory Method  Command  State  Null Object
  • 8. Template Method public abstract class DBInterface{ public class OracleInterface extends DBInterface{ public Date getData(){ protected void init(){ init(); // Data data = getData(); exit(); return data; } } protected Data getData(){ protected abstract void init(); // protected abstract Data getData(); } protected abstract void exit(); protected void exit(){ } // } extends }ublic class FireBirdInterface extends DBInterface{ p //// }  Data   DBInterface = =public
  • 9. Strategy public Interface DBInterface{ public class OracleInterface implements DBInterface{ public void init(); public void init(){ public Data getData(); // public void exit(); } } public Data getData(){ // } implements public void exit(){ // } } public class FireBirdInterface implements DBInterface{ //// }  Template   DBInterface
  • 10. Template Method Strategy public class TemlePrinter { Template Method main(){ DBInterface di = new OracleInterface(); print(di.getData()); uses } getData() } public class StratPrinter { main(){ Strategy DBInterface di = new OracleInterface(); di.init() print(di.getData()); uses init() getData() di.exit(); } exit() }  Template Method Strategy  = Template Method Strategy Strategy init DB Template Method
  • 11. Factory Method public Interface Bond{ public Interface BondFactory{ creates public int getMaturity(); public Bond getBondInstance(); public BigDecimal getFairValue(); } } implements implements public class TreasuryFactory implements BondFactory{ public class Treasury implements Bond{ public Bond getBondInstance(){ //// return new Treasury(); } } } public class ConvertibleFactory implements BondFactory{ public class Convertible implements Bond{ public Bond getBondInstance(){ //// return new Convertible(); } } }    Bond Strategy Template Factory Factory
  • 12. Command public class User{ public void dosth(Tranzaction t,String id){ t.do(id); public Interface Tranzaction{ } public void do(String id); } } public class addCommand implements Tranzaction{ public void do(String id){ // } } public class removeCommand implements Tranzaction{ public void do(String id){ // } }
  • 13. State public class User{ State s = n; public void dosth(){ public Interface State{ s.do(); public int do(); } } } public class GoodState implements State{ public void do(){ System.ouit.println(“Good State”); } } public class BadState implements State{ public void do(){ System.ouit.println(“Good State”); } }
  • 14. Null Object Null public class User{ public void dosth(Tranzaction t,String id){ public Interface Tranzaction{ t.do(id); public void do(String id); } } } public class NullCommand implements Tranzaction{ public void do(String id){ // } }
  • 15. DI Dipendency Injection public class User{ public void dosth(Tranzaction t,String id){ t.do(id); public Interface Tranzaction{ } public void do(String id); } } DI Tranzaction public class removeCommand implements Tranzaction{ public void do(String id){ // } }
  • 16. DI  new – –  DI – Spring – Seaser2 – EJB 3.0