background preloader

Java Pattern

Facebook Twitter

Code Refactoring Resources. Home » Software Development 29 August 2011 2 Comments Martin Fowler defined refactoring as a ” disciplined technique for restructuring an existing body of code, altering its internal structure without changing its external behavior”.

Code Refactoring Resources

Step by step tutorial to create Keystore and Truststore file. Truststore and Keystore file will be used in the JSSE to provide secured transaction between the client and server. The keytool command is used to create the key store file which contains the public/private keys and then using keystore, Create a truststore file which contains only public keys. In this article, Let us learn how to create Truststore and Keystore file using 5 easy steps given below, Generate a private key in keystore file Verifiy the newly created keystore file Export the certificate. Zen in the art of IT: Design Patterns in the JDK. Immutable Objects.

What is Immutable Object An immutable object is something whose state can't be change after there creation, e.g.

Immutable Objects

String objects. Once you have created a String object, you can't alter this. Creating an Immutable object's class Creating an immutable object's class can be tricky. Minimal requirement to create an immutable object's class is, make class and every member variable, "final". SimpleImmutableClass is a class of mutable object, one can't change its state, once object is created. Consider following example, that has mutable objects as members, though every member is final, private and has only getters (to access) and no setters, but still do you think that it is a class that can produce immutable objects.

Caught By Java » Blog Archive » Real world example of Flyweight Design Pattern - Just another Technology Blog. SOA anti-pattern: Transactional Integration. Transactional Integration It all starts with a business requirement – as it always should.

SOA anti-pattern: Transactional Integration

We have an ordering system (say the same one from the Knot anti-pattern) and the business says they only want to confirm an order to the user if the item is already secured for that order in the stock. From the technical point of view we have 2 separate services – one handles orders the other handles the stock – now what? Figure 10.1 A vanilla ordering scenario. An Ordering service needs to confirm item in stock before confirming order for customer. S tech blog » Views on CDI and what’s new in JavaEE6. In the light of this article which was criticized for not mentioning JavaEE6, I’m going to discuss JavaEE6 innovations.

s tech blog » Views on CDI and what’s new in JavaEE6

JavaEE 6 is still new – only one application server is certified and ready – Glassfish. JBoss AS is on the way. So, what is new in JavaEE 6: EJB 3.1 – EJB Lite – a lighter version, excluding MDBs, web services, remote ejbs, timers, corba and the new @Asynchronous annotation. [JavaSpecialists 113] - Enum Inversion Problem. The Java Specialists' Newsletter Issue 113 Category: Language Java version: Sun JDK 5.0 by Dr.

[JavaSpecialists 113] - Enum Inversion Problem

Heinz M. Deep Inside Structural Patterns. Digg New day, a new pattern.

Deep Inside Structural Patterns

Daniel Pitts’ Tech Blog » Blog Archive » Using enums as a flyweight pattern. HTML and ShortTags: Its valid but doesn? Introduction to: Patterns of Design (III) « Blog about Java EE Development. Posted on 2010/09/26 by Josep Prat If you search this words on google, factory vs builder pattern, you will find thousands of web pages which try to explain the difference between this two patterns.

Introduction to: Patterns of Design (III) « Blog about Java EE Development

We could say that the main difference between them, is the type of complexity in creating the product. So, when the product must be created step-by-step, you’d rather use the Builder Pattern. Otherwise, when the product is created in a single action, the Factory Method must be chosen. Using MemBus for messaging between application components - Gunnar Peipman's ASP.NET blog. Sometimes we need publisher/subscriber messaging in our applications to broadcast messages to different parts of system in real time. Introduction to: Patterns of Design (I) « Blog about J2EE Development. The purpose of this post is to try to introduce the Patterns of Design.

Introduction to: Patterns of Design (I) « Blog about J2EE Development

5 Implementations of Singleton Pattern.

Getter & Setter

Service Layer. Fluent interface. The Observer Pattern. In today's post, I am going to discuss about the observer pattern.

The Observer Pattern

This is one of the most widely used patterns in J2EE applications. I say this because of the inherent simplicity of this pattern and the the fact that it is highly possible that you are already implementing this pattern without actually being aware of it! This is something that certainly cannot be said about other patterns like the Visitor or the Factory pattern. As I always do, I am going to elaborate the usage of this pattern in a fictional - game like situation.

Lets imagine we are playing a horror game. First, lets begin with a somewhat formal introduction to the pattern. As the name suggests, the Observer pattern is basically used to associate an object A with a group of other objects that observe any changes in the properties of the object A, and perform some very critical, earth shattering tasks, based upon the change made to the properties of the object A. To be concise - Observer Objects Observe Observable Objects. Interface vs. Implementation Depedencies in Java. August 24, 2010 by Stephan Schmidt I often use the notion of interface and implementation dependencies, where interface dependencies are mostly always smaller.

Interface vs. Implementation Depedencies in Java

I think this is a very important concept to understand for Java developers, and although it seems obvious and self evident, many developers do not think along those lines and still couple classes too tightly. Take this example: class CassandraStorage { public void store(String key, String value) { otherPartOfApp.doSomething(); yetAnotherPart.doSomethingElse(); cassandraClient.store(key,value); } } class MyApp { @Inject CassandraStorage storage = null; public void myCode() { ... } }

Tell don't ask

Dr Dobbs - Creating and Destroying Java Objects: Part 1. Tecnic. Pattern. Liferay Development Documentation 5.0.