3 arrows

Summer-Ready Savings: Up To $500 Off Training 

closeClose

Java 7 and Patterns Foundations v1.0 (Spring Edition)

  • Tuition USD $4,375
  • Reviews star_rate star_rate star_rate star_rate star_half 4119 Ratings
  • Course Code JAV-PATTERN-SPRING
  • Duration 5 days
  • Available Formats Classroom

This 5-day Java 7 & Patterns Foundations course is written specifically for programmers coming from other languages such as C++, C#, .NET, C, Delphi, etc. and who would like to get up to speed quickly with Java so that they would be ready to learn Spring. It is a first-step course to take before you would study the excellent Spring Core course.

  • We start with the basics of Java syntax and object orientation and introduce you to some libraries that you will need in order to write productive Java code. After 5 days of intensive learning, you will be ready to go to the next step in your education, where you study the actual Spring framework.

Skills Gained

  • The Java 7 & Patterns Foundation - Spring Edition course is designed to teach your programmers the necessary basics of plain Java and Design Patterns, in order to prepare them for further Spring specific training. In our course, we do not cover any Spring specific libraries, but rather teach the students Java syntax and Object Oriented principles.
  • The first 3 days are spent studying Java syntax and some libraries that they will need to know. This takes approximately 400 slides.
  • The last 2 days are spent studying Design Patterns that they will need in order to understand Spring better.
  • Once they have attended this course, they will know how to write simple Java classes. They will understand the Java syntax and some of the patterns that we frequently use in Spring.
  • This course is ideally suited for a programmer coming from another language, such as C++, C#, .NET or C.
  • After each section they will be given practical exercises to complete, which is an essential part of the learning process.

Prerequisites

  • Previous Training: Preferably a formal qualification in computer science or related field.
  • Required Experience: At least one year's programming experience in languages such as: C/C++, Delphi, VB, C#, .NET, COBOL.
  • Equipment: Please consult our setup guide on how to set up your lab.

Course Details

A) JAVA

1. Introduction to Objects

We start with a basic introduction to Java, the principles that it uses. We look at object oriented fundamentals that a programmer would need to understand in order to use Java. We then introduce some concepts of refactoring, design patterns and unit testing. We end with a short history lesson of where Java has come from and where it is headed.

  • Basic Principles
  • Fundamentals of OO
  • Refactoring
  • Design Patterns
  • History

2. Objects in Java

In Java, everything is an object. We study how object references work (ordinary pointers) and how we can use primitives for our class elements and local variables. We show how we can build basic classes in Java and use access specifiers to protect sensitive data. We learn what an array is. Lastly we learn how to document our code.

  • References
  • Primitives
  • a) Java 7 numeric format
  • Arrays
  • Class Structure
  • Access Specifiers
  • JavaDocs

3. Controlling Program Flow

This chapter studies basic programming constructs that we use in Java, such as if-else statements, loops, switch statements and comparisons. We also learn about the equals() method and why this is important in Java. We demonstrate how we can switch on Strings in Java 7.

  • if-else
  • for / while / do loops
  • for-each loop
  • switch
  • a) Switching on Strings in Java 7
  • Comparisons
  • equals() method

4. Initialization & Cleanup

We learn how we can initialize objects correctly and what the difference between fields and local variables are. We do a very brief overview of how the garbage collector works to show how we can avoid some of the pitfalls. We then study method overloading, the "this" keyword and how variable argument lists work in Java.

  • Constructors
  • Local variables
  • Fields
  • Garbage Collection
  • a) Escape analysis
  • Method overloading
  • this keyword
  • Variable argument lists

5. Hiding the Implementation

In Java we want to protect our implementation using encapsulation. In this chapter we learn how we can do that and how we can package our components.

  • Packages
  • Libraries
  • Classpath
  • Access specifiers

6. Reusing Classes

We see ways in which we can reuse existing classes through composition and inheritance. We also learn about the final keyword and how this can help us write more reliable code. Lastly we look at when classes are loaded in Java.

  • Composition
  • Inheritance
  • Initialization
  • final keyword
  • Class loading

7. Polymorphism

One of our most powerful weapons in producing object-oriented code is polymorphism. In this chapter we see what this is and how it works in Java. We also learn the abstract keyword and see how we can override methods.

  • Substitutability
  • Extensibility
  • Upcasting
  • verriding
  • abstract keyword
  • Constructors
  • Polymorphism

8. Interfaces and Inner Classes

Usually we specify our libraries with interfaces. Java supports this with the interface, which is like an abstract class with only abstract methods. We then get introduced to inner classes. We also look at the traditional approach of using interfaces to define constants and the better static import mechanism of Java 5. We study anonymous inner classes and as an example get introduced to the Null Object Pattern, which we use to avoid null pointer exceptions in Java.

  • Interfaces
  • Inner classes
  • Interface constants
  • a) Static imports
  • Anonymous inner classes
  • NullObject pattern

9. Enumerated Types

Java allows us to define enumerated types when we use constants. In this chapter we look at different ways in which we can define enums, either with data or as simple types. We also show how we can switch on enums.

  • Simple enums
  • Complex enums
  • Adding methods
  • Looking under cover
  • Switching on enums

10. Java Collections

We look at the most useful collections in Java: ArrayList, LinkedList and HashMap and how we should use them. We then look at how iterators work and how we can write good hashing functions in our key objects. We see a brief introduction to generics.

  • Arrays
  • Sorting
  • Collections
  • Generics
  • Iterators
  • Hashing
  • Performance

11. Generics

Generics are now covered in a bit more detail to allow us to understand what the compiler is looking for when we see an error message.

  • Using Generics
  • java.lang.Comparable
  • Wildcards
  • Extending Generic Classes
  • For/In Loop
  • Erasure

12. Error Handling with Exceptions

Exception handling is built into Java from the start. We learn the difference between checked and unchecked exceptions. We also see three new Java 7 exception handling constructs: try-with-resource, handling several different exceptions and the final rethrow.

  • try / catch / finally
  • Exception hierarchies
  • Global exception handling
  • try-with-resource (Java 7)
  • Handling several different exceptions
  • Final rethrow

13. Run-Time Type Identification

We show a basic overview of how runtime type identification works in Java, specifically how downcasting and instanceof are used.

  • Downcasting
  • instanceof keyword

14. Annotations

Java 5 introduced the concept of annotations, which allows us to mark up our classes with special commands that can be used at compile-time and run-time to control how frameworks use our classes.

  • Standard Annotations
  • Writing Own

B) DESIGN PATTERNS

1. Introduction to Patterns

In the first section, we lay the foundation for the rest of the course. We talk about why patterns are important, where they come from, their general structure and give a UML refresher.

  • Importance of patterns :: Experienced object oriented programmers use patterns to build their software. This helps to make their components reusable. The reduction in copy and pasted code makes maintenance easier. In this section we look at why patterns are important to help your team speak the same language.
  • Origin :: We look at some great resources that explain where object oriented design patterns come from. We look at some of the great books on patterns in which you can find more detailed information. Examples are: Head First Design Patterns, Pattern Hatching and of course the famous Gang-of-Four book.
  • Names :: The name is useful to document which pattern we are referring to. We talk about the dangers of having a weak name and a strong pattern, as well as having a strong name and a weak pattern. Or just having the wrong name to start with.
  • Diagrams :: Throughout our course we use UML to describe the patterns. We explain why being able to draw a class diagram of the pattern is important. A pattern has three main elements that identify it: its name, its structure and its intent. We look at what the structure typically looks like to help you recognise typical patterns. However, the structure cannot give you a conclusive answer as to what the pattern is. This can only be discovered once you know what the intent of the author was.
  • UML refresher :: We use UML class diagrams to describe the designs. In this section we review the basic UML components used to show our patterns. This helps us to understand the subtleties of association, aggregation and composition. We also show how to draw the UML components. We show why reverse engineering UML from code is of little use.
  • jpatterns.org annotations :: We give a short tutorial on how to use the jpatterns.org annotations to describe the design patterns in our code. These will be used extensively in our coding to show what patterns we were thinking of using.

2. Structural Patterns (I)

Our first stop is structural patterns, since most of us can relate to these easily.

  • Proxy :: The Proxy pattern is used in many systems to provide placeholder objects. Most programmers have seen or used this pattern. This makes it a good first pattern to study as we quickly see the benefit of using design patterns. We study various ways of creating proxies. We show how to write them by hand, how to generate them using the new Java 6 built-in compiler and how to create them as dynamic proxies. We also study different uses of proxy types. Examples are virtual, remote and protection proxies. We show how these can be created with dynamic proxies or automatically generated code.
  • a) Virtual Proxy :: e virtual proxy creates objects on demand. It helps us simplify our clients when we want to lazily create objects. It does this by moving the lazy creation functionality into the virtual proxy class. Students get to build their own virtual proxy using dynamic proxies.
  • b) Remote Proxy :: Remote proxies are used a lot in Java to communicate between different machines. We look at the challenges with using this type of proxy. Examples are the checked exceptions and the much slower remote method calls.
  • c) Protection Proxy :: Our last variation is the protection proxy, where we guard the real object. As part of the exercises, students have to build a protection proxy that only allows us to view salary details if we have the right permissions.
  • Facade :: The Facade pattern is often confused with the session facade. In fact, it is not really a design pattern. Rather, it is a necessary part of any complex design thanks to the added flexibility that patterns bring.
  • a) Facade vs Session Facade :: The Session Facade usually prevents direct access to the single pieces of the subsystem. The GoF Facade allows direct access to the subsystem. We also look at the motivation of using the Session Facade.
  • b) Is it a Design Pattern? :: We look at the question: Is the Facade really a design pattern?

3. Behavioral Patterns (I)

Our next set of patterns are used for algorithms and behavior. They help to reduce duplicate code and get rid of if-else and switch statements. Code becomes less complex with less duplication, leading to lower costs.

  • Template Method :: The template method is used when we have some classes which do the same thing, but a bit differently. We can replace the duplicate code with a single template method and can push the differences into primitive methods, which are contained in subclasses.
  • Observer :: The observer pattern is one of the most prolific ideas in object oriented designs. It helps us to decouple the components. We show how the Java observer was implemented and use this to build a simple stock price viewer, where observers can get notified when a share changes.

4. Creational Patterns

Creational patterns are the most tricky to get right. They are frequently abused for building systems that are non object oriented. In this section we look at the most common creational patterns and show how they should be used.

  • Singleton :: Ask a group of novice programmers if they know any patterns and the "singleton" is the most common answer you will get, next to "factory" and "MVC". In this section we discover the real purpose of this pattern. The purpose of this pattern is to be able to substitute one singleton object for another without the clients having to know. Sadly most of the time it is used to put global variables into systems. We learn how to correctly use this pattern.
  • a) Polymorphic :: One of the characteristics of the singleton is that the constructor is private. This makes it impossible to create several instances. We have a look at how to allow for polymorphism.
  • b) Managing synchronization :: A lot has been written about how to actually initialize the instance. The most tricky part is getting synchronization correct. We look at solutions and reasons why the most simple option is usually the best.
  • c) When to use & avoid :: There are several reasons why we should avoid using the singleton. It makes our system very static. It is difficult to reset instances. We cause global access to shared values. In this section we look at the reasons why singletons cause so many problems in designs.
  • Factory Method :: The GoF factory method pattern is used to allow subclasses to create their own instances of their own specific types. An example would be the iterator() method of the Collection interface. We give examples of how and when this should be used.
  • a) Simple factory :: Martin Fowler uses the name "factory method" to describe something quite different to the GoF pattern. His is a static method that creates objects. This is a useful pattern in its own right, but is not the GoF pattern. In Java we can often use his pattern with the reflection API.
  • b) Tough questions :: This pattern is used to produce decoupled systems. We combine this with strategy and facade to produce a flexible design. We also ask some hard questions to make sure that we all understand the differences between the interpretations of this pattern.

5. Behavioral Patterns (II)

In the second set of behavior patterns, we learn how to decouple our designs even further with the Command. We show how to build chains of implementers with the Chain of Responsibility.

  • Command :: The command pattern helps to clearly assign responsibilities, which leads to a decoupled design. We show why the typical AWT action listener is not the best way of using the pattern. We then demonstrate how we get a cleaner design when we follow the pattern structure more closely. The exercise is challenging as the first instinct is to use an object adapter, but that would lead to an inflexible design.
  • a) Swing :: wing and AWT use the command pattern to bind actions to receivers. We learn the advantages of an event based, decoupled design.
  • b) Thread Pools :: In Java 5, thread pools were introduced into the standard JDK. These solve the question of how to deal with results that you might want to return from commands. We look at how Runnable and Callable is used within the ExecutorService.
  • Chain of Responsibility :: This pattern allows us to define flexible systems where we do not need to specify at coding time which object will process a message. This is set up by configuring the chain. We look at some of the issues that happen when a message drops off the end of the chain.

6. Structural Patterns (II)

We end our course with a structural pattern that is fairly easy to grasp. The decorator allows us to change the interface of an object dynamically.

  • Decorator :: The decorator is used for two main purposes. Firstly we use it to add functionality to existing objects. We call this decorating. Secondly we can take it away from objects. We call this filtering.
  • a) Collections :: We learn why the special collections (unmodifiable, synchronized, checked, etc.) are in fact not decorators, but rather another pattern. We also demonstrate how we would design the collection classes using the decorator or filter pattern.

7. Conclusion

The course ends with a conclusion about what we have learned and where to study them further. We also look at how the patterns are all connected.

  • References :: We give a number of great references where you can learn new patterns and study the subtleties of patterns further.
  • Discovering Patterns :: Lastly, we give some pointers on how to write your own patterns. This process is called discovering or inventing a pattern.

When does class start/end?

Classes begin promptly at 9:00 am, and typically end at 5:00 pm.

Does the course schedule include a Lunchbreak?

Lunch is normally an hour long and begins at noon. Coffee, tea, hot chocolate and juice are available all day in the kitchen. Fruit, muffins and bagels are served each morning. There are numerous restaurants near each of our centers, and some popular ones are indicated on the Area Map in the Student Welcome Handbooks - these can be picked up in the lobby or requested from one of our ExitCertified staff.

How can someone reach me during class?

If someone should need to contact you while you are in class, please have them call the center telephone number and leave a message with the receptionist.

What languages are used to deliver training?

Most courses are conducted in English, unless otherwise specified. Some courses will have the word "FRENCH" marked in red beside the scheduled date(s) indicating the language of instruction.

What does GTR stand for?

GTR stands for Guaranteed to Run; if you see a course with this status, it means this event is confirmed to run. View our GTR page to see our full list of Guaranteed to Run courses.

Does ExitCertified deliver group training?

Yes, we provide training for groups, individuals and private on sites. View our group training page for more information.

Does ExitCertified deliver group training?

Yes, we provide training for groups, individuals, and private on sites. View our group training page for more information.

Fantastic and great training. Tons of hands-on labs to really make you understand the material being thought.

The tool provided to practice the course teachings is very functional and easy to use.

Concise and good to follow along. Although it is a lot to take in under a short period of time.

The technical data in the AWS Solutions Architect course was very thorough.

Thank you for training on AWS development. Course was good and encouraging but labs need to be improved and provide more information and ask students to more work than provide solutions.

0 options available

There are currently no scheduled dates for this course. If you are interested in this course, request a course date with the links above. We can also contact you when the course is scheduled in your area.

Contact Us 1-800-803-3948
Contact Us
FAQ Get immediate answers to our most frequently asked qestions. View FAQs arrow_forward