Inside Groovy

March 21, 2013 1 comment

Groovy is an object-oriented programming language for the Java platform. It is a dynamic language with features similar to those of Python, Ruby, Perl, and Smalltalk. It can be used as a scripting language for the Java Platform, is dynamically compiled to Java Virtual Machine (JVM) bytecode, and interoperates with other Java code and libraries.

Let’s go inside Groovy to discover how it works internally, for that we use JArchitect.
Groovy comes with many libraries like groovy-sql, groovy-json and others, here’s the dependency structure matrix of all groovy jars.

Read more…

Categories: CodeProject

Immutability to the rescue

November 8, 2012 2 comments

There is a powerful and simple concept in programming that is really underused: Immutability.
Basically, an object is immutable if its state doesn’t change once the object has been created. Consequently, a class is immutable if its instances are immutable.

There is one killer argument for using immutable objects: It dramatically simplifies concurrent programming. Think about it, why does writing proper multithreaded programming is a hard task? Because it is hard to synchronize threads accesses to resources (objects or others OS things). Why it is hard to synchronize these accesses? Because it is hard to guarantee that there won’t be race conditions between the multiple write accesses and read accesses done by multiple threads on multiple objects. What if there are no more write accesses? In other words, what if the state of the objects threads are accessing, doesn’t change? There is no more need for synchronization!
Read more…

Categories: Uncategorized

Discovering the future of Java

October 31, 2012 4 comments

Java 6 was released in 2006 and Java 7 in 2011. No major changes were added to the Java7, many of the new features were present in Java 6 updates. After Java 7 Oracle has decided to implement a two years roadmap planning for Java, and the next major release will be available in 2013.

Java 8 has some interesting new features like lambda expressions, but the major new feature planned was Jigsaw, in fact Jigsaw was originally intended for Java 7 but was deferred to Java 8 and now it’s moved to Java 9.
Read more…

Categories: CodeProject, Uncategorized

Learn design patterns from real projects : JBoss case study (Part 2).

October 27, 2012 Leave a comment

In the previous article we dicovered some creational patterns used by JBoss, let’s discover now some structural design patterns used by it.

Structural design patterns are design patterns that ease the design by identifying a simple way to realize relationships between entities. There’s a common point between the majority of these kind of patterns, it’s the notion of interface or abstraction, so before discussing about structural patterns used by JBoss let’s discover the utility of using interfaces.
Read more…

Categories: CodeProject

Learn design patterns from real projects : JBoss case study (Part 1).

October 18, 2012 1 comment

The majority of developers have already heard about design patterns, GOF(Gang Of Four) patterns are the most popularized, and each developer has his way to learn them , we can enumerate:

  • Reading a book or a magazine.
  • From web sites.
  • From a collegue.
  • Doing a training.

Read more…

Categories: CodeProject

The OSGi puzzle

October 11, 2012 2 comments

OSGi became very popular today, thanks to its modularity approach and its capability to enforce logical boundaries between modules. When we discover it the first time, the question is where to begin to understand how it works?

To understand OSGi concepts we will try to follow the puzzle approach, the idea is to begin with the trivial part of this technology, and search for other parts related to the found ones. And to assemble the puzzle we will be assisted by JArchitect that will be helpful to detect OSGi internal design.
Read more…

Two powerful principles to improve the design

December 12, 2011 1 comment

Coupling is usually contrasted with cohesion. Low coupling often correlates with high cohesion, and vice versa.
Low coupling is often a sign of a well-structured computer system and a good design, and when combined with high cohesion, supports the general goals of high readability and maintainability.

The goal of this case study is to show the benefits of low coupling and high cohesion, and how it can be implemented with Java. The case study consists of designing an application that accesses a file in order to get data, processes it, and prints the result to an output file.

Solution without design:
Read more…

Categories: Uncategorized