Presentation is loading. Please wait.

Presentation is loading. Please wait.

Week 3, Day 3: Singleton Pattern Quiz Status Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick.

Similar presentations


Presentation on theme: "Week 3, Day 3: Singleton Pattern Quiz Status Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick."— Presentation transcript:

1 Week 3, Day 3: Singleton Pattern Quiz Status Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick Errors: Dr. Yoder 1

2 Summer Study Abroad Opportunity in St. Petersburg, Russia July 11 – 25, 2016 Two-week educational and cultural program in St. Petersburg, Russia. Curriculum is focused on the “Internet of Things (IOT)” technologies. Students will earn 3 MSOE transfer credits in CE 498 course. Online information: http://www.sut.ru/eng/international- cooperation/summer-schoolhttp://www.sut.ru/eng/international- cooperation/summer-school Summer 2015 video: http://youtu.be/SFbVtbq67cghttp://youtu.be/SFbVtbq67cg Freshmen, sophomores, juniors and even seniors are welcome to apply. Cost Tuition, room & some board, excursions – 1000 Euro Airfare ≈$1100 - $1300 Student Visa - $300 Bank Transfer Fee - ≈ $45 - $60 (may be less) HIV Test for Student Visa – MSOE or your own doctor’s office (insurance typically covers). For all information, please email Dr. Olga Imas at imas@msoe.edu.imas@msoe.edu

3 Patterns Muddiest Point We really didn't cover any sorting algorithms and what each's benefits are Can we do an example??? Related to the quiz for below question Do we need to implement code versions of the strategy and factory method patterns?? If so how extensive and will it be similar to how we implemented in class? Implementing the methods needed for the factory method pattern. Is there a flowchart/checklist to determine which pattern is more appropriate to use? Choosing the correct design pattern What are Coupling and Cohesion and is it better to have high or low coupling or cohesion? On a quiz/test would you ask us to draw the uml of a particular general pattern, or would you just ask us to write the code? Why would we use Factory Pattern? How do you know when to use what pattern to solve a problem? Diagrams High/Low Cohesion/Coupling Class Diagram for Factory Design Pattern Nothing 3

4 Threading Muddiest Point All lambda examples the same code? [No, they weren't. see new slide] Lambda examples When would you use a Lambda expression over an anonymous class and vice versa? Lambda vs. Anon inner syntax The Lambda is a Java thing, not an intelliJ thing right?Java 8 whens the next quiz?Quiz Agree Lambda examples More examples of using lambdas (didn't get exposure in software dev 2) Lambda examples Effectively Final? "Effectively Final" SE-2811 Dr. Mark L. Hornick 4

5 Lambda Expression Syntax Exercise: What parts does a regular method have? Lambda Expression: A variety of syntaxes are available: -> (Scanner in) -> {int x = in.nextInt(); return x+1;} (int x) -> x+1 () -> System.out.println(“hi”) x -> x+1 SE-2811 Dr. Mark L. Hornick 5

6 Lambda Expression Syntax Different Syntax, Same result: (int x) -> {return x+1;} (int x) -> x+1 x -> x+1 new IntInterface() { public int intMethod(int x) { return x+1; } } SE-2811 Dr. Mark L. Hornick 6

7 Have you ever seen a private Constructor? class Mystery { private Mystery() { /* */ } } What happens if a constructor is private? Why would you want this? SE-2811 Dr. Mark L. Hornick 7

8 Singleton Pattern How to use a private constructor? How to ensure only one instance is created (Single-threaded)? Again, but if multiple threads? SE-2811 Dr. Mark L. Hornick 8

9 Two kinds of Singletons Eager Lazy Continue coding examples SE-2811 Dr. Mark L. Hornick 9

10 SE-2811 Dr. Mark L. Hornick 10


Download ppt "Week 3, Day 3: Singleton Pattern Quiz Status Russia Opportunity Muddiest Points – Patterns SE-2811 Slide design: Dr. Mark L. Hornick Content: Dr. Hornick."

Similar presentations


Ads by Google