IMPORTANT! Completed tasks are evaluate at the final result and the manner of applying the knowledge gained in the course
- Prentice Hall - Applied Java Patterns
- Effective Java - 2nd edition
- Design Patterns - Elements of Reusable Object-Oriented Software
- James Cooper - The Design Patterns Java Companion
- Big Transitions in small Steps
- Use your singletons wisely
- Builder Pattern (Well described in Effective Java, 2nd edition)
- Command Pattern (Will help in web development)
- Chain of Responsibility Pattern (Will help in web development - Servlet Filters)
- Model View Controller (described In Applied Java Patterns)
-
Factory
Create an CodecFactory which should be responsible for the creation of different type of Codec objects (JSONCodec, XMLCodec) There should be 2 implementations of this Factory:- By using regular instantiation with "new"
- By using Reflection
-
Singleton
The Design Pattern Singleton should be realized. Create a class called Singleton*.*The class should have a private constructor only. The class should be implemented in an appropriate way such that only a single instance of it should be created (i.e. no more than one instance should be instantiated in the memory).
//constructor
private Singleton() {
System.out.println("Singleton created");
} - Да се направи Builder, който e отговорен за създаването на следния обект:
public final class Order {
private Long orderId;
private String customerName;
private String customerAddress;
private Date orderCreationDate;
private Date orderDeliveryDate;
private List<OrderItem> items;
}
public final class OrderItem {
private String productName;
private String measureUnit;
private Double quantity;
private Double price;
}Описание: Да се напише тест на метод, който определя дали order'a е доставен със забавяне или не.
-
Да се направи Adapter на InputStream, който да позволява използването единствено на int read(byte[] buf, int offset, int length) метода.
-
Observer
Да се направи програма за поддържане на статистика на стоки. Трябва да има един клас, който да поддържа статистика за наличните стоки и един, в който има списък с продадените стоки (тези, които вече не са налични). Класът който е регистриран като слушател да следи за премахване на стари или добавяне на нови стоки.