53

OCM Java 開發人員認證與設計模式

Embed Size (px)

DESCRIPTION

OCM Java 開發人員認證與設計模式

Citation preview

  • 1. OCM Java Developer

2. OCM Java 3. Sun Java Certication AdvancedSpecialtySun Certified Enterprise Architect (SCEA)Sun Certified Java Developer (SCJD)Sun Certified Web Component Developer (SCWCD)Sun Certified Business Component Developer (SCBCD)Sun Certified Developer for Java Web Service (SCDJWS)FoundationSun Certified Java Programmer (SCJP)Entry LevelSun Certified Mobile Application Developer (SCMAD)Sun Certified Java Associate (SCJA)Java SEJava EEJava ME 4. Oracle Certication Program CategoriesOracle Certified AssociateOracle Certified ProfessionalOracle Certified MasterOracle Certified ExpertOracle Certified Specialist 5. Oracle Java Certication Java SE 6 Developer Java EE 6 Web Component DeveloperJava SE 5 Programmer Java SE 6 Programmer Java SE 7 Programmer Java SE 7 Programmer Oracle Certified AssociateOracle Certified ProfessionalOracle Certified MasterOracle Certified Expert 6. Oracle Certied MasterJava SE 6 Developer 7. Certication Path Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCM 8. Get Certied Step 1 Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCMOracle Certified Professional Java SE 5, 6, 7 Programmer ! Sun Certified Java Programmer Any Edition 9. Get Certied Step 2 Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCMComplete one of approved courses Instructor-led in class, Recorded courses (LWC, LVC, Training On-Demand) 10. Get Certied Step 3 Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCM1Z0-855 Java SE 6 Developer Certified Master Assignment 11. Get Certied Step 4 Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCM1Z0-856 Java SE 6 Developer Certified Master Essay Exam 12. Get Certied Step 5 Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCMComplete the Course Submission Form 13. Oracle Certied Master Prior Certification Complete Training Complete AssignmentComplete Essay Complete Form OCM 14. Step 3 - Assignment Exam Number: 1Z0-855Duration: 6 months from assignment purchaseBOTH assignment and essay must be submitted within 6 months of assignment purchase date. No exceptionsAssignment must be submitted before you can register for the essay 15. Assignment Exam Topics A graphical user interface demonstrating good principles of designA network connection, using a specied protocol, to connect to an information serverA network server, which connects to a previously specied Java technology databaseA database, created by extending the functionality of a previously written piece of code, for which only limited documentation is available 16. Step 4 - Essay Exam Number: 1Z0-856Duration: 120 minutesBOTH assignment and essay must be submitted within 6 months of assignment purchase date. No exceptionsAssignment must be submitted before you can register for the essay 17. Essay Exam Topics List some of the major choices you must make during the implementation of the above.List some of the main advantages and disadvantages of each of your choices.Briey justify your choices in terms of the comparison of design and implementation objectives with the advantages and disadvantages of each 18. Assignment Implementation Command Factory Method Decorator Strategy Observer Composite Model-View-Controller Singleton DAO 19. Breakfast Shop 20. Domain ObjectBreakfast {abstract} #name:String +getName():String +price():doubleHamburgerSandwichEggCake+price():double+price():double+price():double 21. Breakfast and Sandwich public abstract class Breakfast { protected String name = "Unknown";!!public String getName() { return name; } public abstract int price();} public class Sandwich extends Breakfast { public Sandwich() { name = ""; }!@Override public int price() { return 15; } } 22. Too Much Subclass Breakfast {abstract} #name:String +getName():String +price():doubleHamburgerSandwichEggCake+price():double+price():double+price():doubleSandwichWithCornHamburgerWithEgg+price():double+price():doubleHamburgerWithLettuce +price():double HamburgerWithHam +price():doubleEggCakeWithHam +price():double EggCakeWithLettuceSandwichWithEgg+price():double+price():doubleSandwichWithHamSandwichWithLettuce+price():double+price():double 23. Move to Super Class public abstract class Breakfast { protected String name = "Unknown";Breakfast {abstract} #name:String #egg:boolean #ham:boolean #corn:boolean #lettuce:boolean +getName():String +price():double! ! !protected protected protected protectedboolean boolean boolean boolean... public int price() { int result = 0; if (egg) { result += 10; } else if (ham) { result += 15; } else if (corn) { result += 10; } else if (lettuce) { result += 20; }!return result; } }egg; ham; corn; lettuce; 24. Move to Super Class Breakfast {abstract} #name:String #egg:boolean #ham:boolean #corn:boolean #lettuce:boolean +getName():String +price():doubleSandwich +price():doublepublic class Sandwich extends Breakfast { public Sandwich() { name = ""; }!@Override public int price() { return super.price() + 15; } } 25. ,, ,, ,?... 26. Move to Super ClassBreakfast {abstract} ... #chocolateSauce:boolean #peanutSauce:boolean #cream:boolean ...Waffle +price():doubleEggCake +price():double 27. java.io 28. Chaining Stream TogetherReader reader = new BufferedReader( new InputStreamReader( new FileInputStream("Decorator.txt"))); ! int c; ! while ((c = reader.read()) != -1) { System.out.print((char)c); } 29. Chaining Stream Togetherread()read()read() FileInputStreamInputStreamReader BufferedReader 30. APPAPPHello! Simon!IntranetAPP @^*#%!*&Internet 31. Java I/O APIInputStream {abstract}FileInputStreamFilterInputStreamBufferedInputStreamMyInputStream 32. Chaining Stream Together public class MyInputStream extends FilterInputStream { public MyInputStream(InputStream is) { super(is); } ! @Override public int read() throws IOException { int data = super.read(); if (data != -1) { data = data + myMagicCode(); } return data;}} ... 33. Chaining Stream Together InputStream is = new BufferedInputStream( new FileInputStream("readme.txt")); ! // send to intranet InputStream is = new BufferedInputStream( new MyInputStream( new FileInputStream("readme.txt"))); ! // send to internet 34. Chaining Stream Togetherread()read()read() FileInputStreamMyInputStream BufferedInputStream 35. Back to Breakfast Shop 36. Java I/O and Breakfast Breakfast InputStream {abstract}Sandwich...FileInputStreamFilterInputStreamBufferedInputStreamHamIngredientMyInputStreamEgg 37. Breakfast Structure Breakfast {abstract} #name:String +getName():String +price():doubleHamburgerSandwich+price():double+price():double Ingredient +getName():StringHam -breakfast:Breakfast +getName():String +price():doubleEgg -breakfast:Breakfast +getName():String +price():double 38. Breakfastpublic abstract class Breakfast { ! protected String name = "Unknown"; ! public String getName() { return name; } ! public abstract int price(); } 39. Sandwichpublic class Sandwich extends Breakfast { public Sandwich() { name = ""; } ! public int price() { return 15; } } 40. Ingredientpublic abstract class Ingredient extends Breakfast { ! public abstract String getName(); ! } 41. Breakfast and Ingredient public abstract class Breakfast { ! protected String name = "Unknown"; ! public String getName() { return name; } ! public abstract int price(); } public abstract class Ingredient extends Breakfast { ! public abstract String getName(); ! } 42. Ingredient - Egg public class Egg extends Ingredient { Breakfast breakfast; ! public Egg(Breakfast breakfast) { this.breakfast = breakfast; } ! public String getName() { return breakfast.getName() + ""; } ! public int price() { return 10 + breakfast.price(); } } 43. Ingredient - Ham public class Ham extends Ingredient { Breakfast breakfast; ! public Ham(Breakfast breakfast) { this.breakfast = breakfast; } ! public String getName() { return "" + breakfast.getName(); } ! public int price() { return 15 + breakfast.price(); } } 44. Chaining Breakfast Together+Breakfast breakfast = new Sandwich(); breakfast = new Ham(breakfast);+breakfast = new Egg(breakfast); 45. Chaining Breakfast TogethergetPrice()getPrice()getPrice() SandwichHam Egg 46. ,, ,, ,?ok 110 47. A Sandwich with many IngredientsX2 X3 X2Breakfast ! ! breakfast breakfast ! breakfast breakfast breakfast ! breakfast breakfastbreakfast = new Sandwich(); = new Egg(breakfast); = new Egg(breakfast); = new Ham(breakfast); = new Ham(breakfast); = new Ham(breakfast); = new Lettuce(breakfast); = new Lettuce(breakfast); 48. Decorator Pattern ! ! Wrapper! ! Decorator 49. Decorator Pattern Component {abstract} operation()ConcreteComponent +operation()Decorator {abstract} +operation()ConcreteDecorationA addedState +operation()ConcreteDecorationB addedState +operation() 50. Note Design pattern ,Decorator ast Breakf act} {abstr Decorator 1. ,ge HamburrSandwich2. ,,Decorator 3. Decorator ...EggCakeIngredient {abstract}HamEgg CornLettuce ... 51. [email protected]