Saturday, 31 December 2011

Top 10 JavaCodeGeeks posts for 2011

2011 is coming to its end, and like last year, we have created a compilation of the Top 10 Java Code Geeks posts for this year. This compilation serves as a reminder of our best moments for the year that is ending.

The posts ranking was performed based on the absolute number of page views per post, not necessarily unique. It includes only articles published in 2011. So, let's see in ascending order the top posts for 2011.

Friday, 30 December 2011

Configure Java EE applications or "Putting Bien into practice"

A lot has been talked about application configuration in the past. I don't know who kicked off the debate but the most fundamental reading (with a look at future Java EE 7 and beyond) is Antonio Goncalves' posting [Debate] – And what about configuration in Java EE 7. Fact is, with vanilla Java EE we all do application configuration day by day. Without having any special mechanism in place. Having seen Adam's latest post from yesterday I would like to share a slight add-on to it, which I feel could fit to most of the projects out there.

Android Game Postmortem - ArkDroid Development

Hello guys,

As you might have noticed, we have recently delved into the world of mobile game programming. This was done after creating JCG Studios, an independent mobile game studio based on Athens, Greece.

JCG here stands for Just Cool Games, it is our other acronym, except for Java Code Geeks of course.

Our platform of choice is Android and our first attempt of developing a game from scratch resulted in the creation of ArkDroid. As its name suggests, ArkDroid is an Arkanoid clone for Android. It is what we would like to call "Brick Breaker Evolved".


The Architecture Spike Kata

Do you know how to apply coding practices the technology stack that you use on a daily basis? Do you know how the technology stack works? For many programmers, it’s easy enough to use test-driven development with a trivial example, but it can be very hard to know how to apply it to the problems you face every day in your job.

Thursday, 29 December 2011

Red Hat Openshift: Getting started - Java EE6 in the Cloud

For a while now I’m looking into ‘the cloud’. Looking into its features, what it can do, why we should switch to ‘ the cloud’, going to talks, talking to people like @maartenballiauw, who is a cloud specialist at RealDolmen. I’ve already deployed an application on google app engine (for java) and I really liked the experience. Some new concepts come into play like distributed data and so on.

JAXB, SAX, DOM Performance

This post investigates the performance of unmarshalling an XML document to Java objects using a number of different approaches. The XML document is very simple. It contains a collection of Person entities. 

Spring MVC and REST at Google App Engine

Some time ago I wrote about how to implement your Restful Web API using Spring MVC. Read my previous post to know about it.

Wednesday, 28 December 2011

Transaction configuration with JPA and Spring 3.1

This is the fifth of a series of articles about Persistence with Spring. This article will focus on the configuration of transactions with Spring 3.1 and JPA. For a step by step introduction about setting up the Spring context using Java based configuration and the basic Maven pom for the project, see this article.

Significant Software Development Developments of 2011

As I did in 2007, 2008, 2009, and 2010, I summarize some of the software development events of 2011 that I find most significant. All of the normal caveats still apply: this list is definitely shaped by personal experience, interests, and biases.

Product Related Classic Mistakes

In my last blog I looked a Process Related Classic Mistakes from Rapid Development: Taming Wild Software Schedules by Steve McConnell, which although it’s now been around for at least 10 years, and times have changed, is still as relevant today as when it was written.

Tuesday, 27 December 2011

Devops: How NOT to collect configuration management data

Hi all, Willie here. This time we’re going to step away from the keyboard and get architectural. But no ivory towers here. In my next two blog posts, I’m going to give you something that will get you out of lots of pointless meetings.

The Persistence Layer with Spring Data JPA

This is the forth of a series of articles about Persistence with Spring. This article will focus on the configuration and implementation of the persistence layer with Spring 3.1, JPA and Spring Data. For a step by step introduction about setting up the Spring context using Java based configuration and the basic Maven pom for the project, see this article.

Best Of The Week - 2011 - W52

Hello guys,

Time for the "Best Of The Week" links for the week that just passed. Here are some links that drew Java Code Geeks attention:

* 7 habits I learned to become more efficient programmer: This post summarizes some coding guidelines that might help developers to write more maintainable source code. The tips include using names, keeping the indentation consistent, adding meaningful comments, following design patterns etc. Also check out Things Every Programmer Should Know.

Monday, 26 December 2011

Migrating from JavaFX 1.3 to JavaFX 2.0

Some days ago I finished migrating the source code of Modellus from JavaFX 1.3 script to JavaFX 2.0 java language. So I thought it would be nice to write about what I’ve learned in the process.

I’d like to point out that if you want to keep using JavaFX script in JavaFX 2.0 you can use Visage: http://code.google.com/p/visage/

Arcane magic with the SQL:2003 MERGE statement

Every now and then, we feel awkward about having to distinguish INSERT from UPDATE for any of the following reasons:

Running RichFaces 4.1.0.Final on WebLogic 12c

You might have noticed, that I simply love JSF. Not only the specification and the reference implementation Mojarra but also the most creative component suites on the market. This is my all-time favorite PrimeFaces and of course RichFaces. This is the reason why you find "running xxx on xxx" posts here :) Today is my RichFaces and WebLogic day, so a little followup on my earlier post this is more an update on how to get it running on latest WebLogic 12c. Here we go:

Moving Java Forward? A definition. A year in review.

This post is among many other "year end" blog-posts and reviews. But it was intended not to be like this. I'm trying to summarize what I have learned about Oracle and Java in 2011 and I also try to explain what "Moving Java Forward" means to me and what I think should be better or simply changed a bit. Thanks for following my blog through the year and thanks for the many comments, visits, downloads, follower on Twitter and personal conversations on meetings and conferences. I enjoy sharing: Thoughts, tips, tricks, experiences, pictures and whatever comes along my way on the journey called "Enterprise Java". I am wishing you and your loved ones a wonderful, peaceful Christmas time and a happy new year!

"Moving Java Forward". Probably the sentence of the year 2011. At least for the Java Community. After long months of discussions about the Sun acquisition and what it mean for Java and the whole ecosystem around, 2011 finally was the year to deliver. And that is exactly what happened. Oracle delivered Java 7. After long four years, seven months and seventeen days Java developers around the world have been able to play around with the new features and start embracing them in their daily projects. From an Oracle perspective the "Moving Java Forward" slogan simply expresses what they are committed to:

Friday, 23 December 2011

Process Related Classic Mistakes

In my last blog I looked a People Related Classic Mistakes from Rapid Development: Taming Wild Software Schedules by Steve McConnell, which although it’s now been around for at least 10 years, and times have changed, is still as relevant today as when it was written.

Develop Restful web services using Spring MVC

REST INTRODUCTION
From Wikipedia: REST-style architectures consist of clients and servers. Clients initiate requests to servers; servers process requests and return appropriate responses. Requests and responses are built around the transfer of representations of resources. A resource can be essentially any coherent and meaningful concept that may be addressed.

Google Authenticator: Using It With Your Own Java Authentication Server

The Google Authenticator application for mobile devices is a very handy application that implements the TOTP algorithm (specified in RFC 6238). Using Google Authenticator you can generate time passwords that can be used to authorize users in an authentication server that shares the secret key of the requesting users.

Thursday, 22 December 2011

Java 8 virtual extension methods

I’ve been following the evolution of the Java 8 Lambda expressions project for a while now, and I’m really thrilled by its current state of progress. The latest “easy-to-understand” presentation I’ve found is this one:
http://blogs.oracle.com/briangoetz/resource/devoxx-lang-lib-vm-co-evol.pdf

GROUP BY ROLLUP / CUBE

Every now and then, you come across a requirement that will bring you to your SQL limits. Many of us probably give up early and calculate stuff in Java / [or your language]. Instead, it might’ve been so easy and fast to do with SQL. If you’re working with an advanced database, such as DB2, Oracle, SQL Server, Sybase SQL Anywhere, (and MySQL in this case, which supports the WITH ROLLUP clause), you can take advantage of the ROLLUP / CUBE / GROUPING SETS grouping functions.

Single Sign On for the cloud: SAML & OpenId

When accessing different applications owned by different organizations, having to authenticate everytime you go from one application to another is annoying. Not only is it time consuming, but you also have to remember multiple passwords, which are often lost.

Single sign on is the ability to authenticate once and be able to move between applications seamlessly using the authenticated identity.

Wednesday, 21 December 2011

2011: The State of Software Security and Quality

It's the end of the year. Time to look back on what you’ve done, what you’ve learned, your successes and mistakes, and what you learned from them. I also like to look at the big picture: not just my team and the projects that I manage, or even the company that I work for, but software development in general. How are we doing as an industry, are we getting better, where are we falling behind, what are the main drivers for developers and development managers?

People Related Classic Mistakes

In my last blog I mentioned Rapid Development: Taming Wild Software Schedules by Steve McConnell, which although has now been around for at least 10 years is still as relevant today as when it was written. One of my favourite parts of the book was his treatment of Classic Mistakes

Tuesday, 20 December 2011

Transactional event-based NOSQL storage

I am presenting here a simple two steps architectural approach based on stored events as a workaround for the lack of full atomic transaction support in so-called “NOSQL” databases.

Being fairly new to NOSQL-based architectures, I have the annoying intuition that I am about to write nothing but a set of obvious statements. On the other hand, I have not yet read a detailed description of this anywhere, so hopefully it will be useful to some other developers as well.


Best Of The Week - 2011 - W51

Hello guys,

Time for the "Best Of The Week" links for the week that just passed. Here are some links that drew Java Code Geeks attention:

* Spring 3.1 is GA Today - Adds Java 7 Support, Environment Abstraction and Cache Abstraction:Following the announcement for the general availability of Spring 3.1, this article provides some information  on the new releases and the major new features for Spring 3.1, which include Java 7 support, environment abstraction and cache abstraction.

Using a ThreadPoolExecutor to Parallelize Independent Single-Threaded Tasks

The task execution framework, introduced in Java SE 5.0, is a giant leap forward to simplify the design and the development of multi threaded applications. The framework provides facilities to manage the concept of task, to manage thread life cycles and their execution policy.

Monday, 19 December 2011

How to start a Coding Dojo

I recently attended the XP Days Ukraine conference in a rainy, but beautiful and Christmas-decorated Kiev. I conducted a coding dojo and gave a talk where I demonstrated pair programming live together with Dima Mindra. After the talk, I got a few questions about how to run a Coding Dojo.

LeWeb - 2011 - Round up

Just a couple of hours before I head up to the airport, I will write my last post related to LeWeb. This time I will focus on the conference itself.

Having attended a few developer conferences (not much but enough to give you some sort of experience) I have developed my own custom framework of rating a conference. I use the 6 criteria below, so I will provide my own view of things.

Oracle JRockit Mission Control 4.1 released

Oracle released a new version of their former JRockit-only tooling Mission Control Suite (JRMC). The 4.1 version is a minor version upgrade which directly follow the 4.0.1 which was released way back middle 2010.

But even if the version number indicates, it's a minor upgrade, you still find tons of new features in it. JRMC is a set of plug-ins for the Eclipse IDE designed to help develop, profile and diagnose applications running on the Oracle's JVMs.

Friday, 16 December 2011

Overload API methods with care

Overloading methods is a strong concept in API design, especially when your API is a fluent API or DSL (Domain Specific Language).

This is the case for jOOQ, where you often want to use the exact same method name for various means of interaction with the library.

Reusing Generated JAXB Classes

In this post I will demonstrate how to leverage the -episode XJC extension to reuse classes previously generated from.an XML schema. This is useful when an XML schema is imported by other XML schemas and you do not want the same classes generated each time.

Spring GWT Integration using the RequestFactory API

Beginning from GWT 2.4 the integration of the RequestFactory API with Spring services on the backend is easy all you need to do is create a custom ServiceLocator on your server which will be used by GWT to locate properly the called services :

Thursday, 15 December 2011

Android Drag and Drop Tutorial

This post is going to cover implementing Drag and Drop in an Android application.

(I am currently using version 4.0 of the sdk, but I originally wrote the code in this series with the 3.1 version.)

Configure LogBack Logging with Spring

LogBack is a new API for logging created by the same author of Log4j(a newer implementation, it is like a new version), during this article I’m going to show how to integrate it and use it on a Spring project.

Cloning of Serializable and Non-Serializable Java Objects

Frequently developers rely on 3d party libraries to avoid reinventing the wheel, particularly in the Java world, with projects like Apache and Spring so prevalent. When dealing with these frameworks, we often have little or no control of the behaviour of their classes.

Wednesday, 14 December 2011

Setup JAVA_HOME, MAVEN_HOME, ANT_HOME in MacOSX Lion in 5 minutes

I have been getting the very same question all the time, from people trying to make it through the world of Java development on the Mac. One of the first things they have to tackle is setting up the appropriate tools and enviroment.

Scaling up to WebLogic 12c Server from GlassFish 3.x

One of the main goals of Oracle's strategy for GlassFish server was to "integrate with Fusion Middleware and Products" (source: Community Roadmap May, 2010). Back in this year you heard a lot of fears and rumors about the two servers becoming one. Seeing both products moving forward in terms of features and releases it gets clearer what that strategy could be.

The Persistence Layer with Spring 3.1 and JPA

This is the third of a series of articles about Persistence with Spring. This article will focus on the configuration and implementation of the persistence layer with Spring 3.1 and JPA. For a step by step introduction about setting up the Spring context using Java based configuration and the basic Maven pom for the project, see this article.

Tuesday, 13 December 2011

My Testing and Code Analysis Toolbox

Last week we kicked of a “Testing Skill Group” at LINEAS, a group for exchanging knowledge about testing. One question that came up over and over again in various flavors was: What tools are there for testing and analyzing your code? So here is my personal answer for this, in the approximately order I tend to introduce them into projects:

Simplifying the Data Access Layer with Spring and Java Generics

This is the second of a series of articles about Persistence with Spring. The previous article discussed setting up the persistence layer with Spring 3.1 and Hibernate, without using templates. This article will focus on simplifying the Data Access Layer by using a single, generified DAO, which will result in elegant data access, with no unnecessary clutter. Yes, in Java.

Quickstart WebLogic 12c with NetBeans 7.1 RC 2

WebLogic server 12c is out since a few days. It is for "naked" Java dev - the fancy Fusion Middleware stuff will move on to 12c down the line. So, this is basically my release to run. Today I am giving you a quick start with latest NetBeans 7.1 (RC 2) and WebLogic to run the Pet Catalog example with MySQL.

Monday, 12 December 2011

Best Of The Week - 2011 - W50

Hello guys,

Time for the "Best Of The Week" links for the week that just passed. Here are some links that drew Java Code Geeks attention:

* Bad code plagues business applications, especially Java ones: An article discussing a quite sad (but true) study regarding business applications code. It seems that bad code plagues applications which are built based on bad coding practices that affect security, performance and uptime. The saddest part: Java Enterprise Edition applications were found to have the greatest number of problems. Also check out How many bugs do you have in your code?

Net Neutrality Simplified – Information super-highway analogy

A few months back, during an informal discussion with a colleague – the concept of net neutrality came along.

Getting Started with Amazon Web Services and Fully Automated Resource Provisioning in 15 Minutes

While waiting for a new project, I wanted to learn something useful. And because on many projects we need to assess and test the performance of the application being developed while only rarely there is enough hardware for generating a realistic load, I decided to learn more about provisioning virtual machines on demand in the Cloud, namely Amazon Web Services (AWS).

I’ve learned a lot about the tools available to work with AWS and the automation of the setup of resources (machine instances, security groups, databases etc.) and automatic customization of virtual machine instances in the AWS cloud. I’d like to present a brief introduction into AWS and a succinct overview of the tools and automation options. If you are familiar with AWS/EC2 then you might want to jump over the introduction directly to the automation section.

Friday, 9 December 2011

The Pragmatic Programmer - Review / Summary Notes.

I recently finished The Pragmatic Programmer, to be completely honest this had been the 3rd attempt to read it, although the book is good and well worth the read, I had unfortunetly learnt most of the lessons the hard way on my own over the last decade or so of being a software developer, so I found often myself easily distracted.

Fix That Code Immediately!

You are working on that fresh project and you see a bad piece of code somewhere. The wrong way to approach it is “nah, that’s someone else’s code, I’m not doing anything about it”, “I don’t have time to fix that – I have other tasks”, “I’ll surely break things if I change this”.

Some Definitions - Testing Techniques 9

I think that I’m coming to the end of my series of blogs on testing techniques, and it feels like it’s been along haul. One of the things that has become clearer to me is that approaches to testing are still in their infancy and as such are a definite source of contention or discussion amongst developers - and that’s a good thing.

I suspect that we are at a point in the history of our profession where the discipline of writing tests is only just gaining ground and will one day be common place and taught as part of elementary programming classes (1). Today’s blog provides a summary of the of the terms used in my previous blogs in this series.

Thursday, 8 December 2011

Devops has made Release and Deployment Cool

Back 10 years or so when Extreme Programming came out, it began to change the way that programmers thought about testing. XP made software developers accountable for testing their own code. XPers gave programmers practices like Test-First Development and simple, free community-based automated testing tools like xUnit and FIT and Fitnesse.

Scala's version fragility make the Enterprise argument near impossible

I have been working with Scala for more than five years. In those five years, I've seen Scala evolve and seen the ecosystem and community evolve.

Why You Should Write Unit Tests - Testing Techniques 8

I’ve had lots of reaction to my recent blog on ‘What you Should Test’, some agreeing with me for varying reasons and others thinking that I’m totally dangerous for suggesting that certain classes may not need unit tests. Having dealt with What to test, today’s blog deals with Why you should write unit tests, and today’s example code is based upon a true story: only names, dates and facts have been changed.

Wednesday, 7 December 2011

More on Creating Stubs for Legacy Code - Testing Techniques 7

In my last blog, I talked about dealing with the badly behaved untestable(1) SitePropertiesManager class and how to create stubs by extracting an interface. But what happens when you don’t have access to the source code of the legacy class because it’s locked away inside a third party JAR file? The answer is one of those things that you really don’t think about, but when you see it you realise that it’s fairly obvious.

Java Recursion basics

For those who don't know what recursion is (and like a good laugh), click on this link: Google search: Recursion and click on the "did you mean..." item.

Hopefully you've finally figured out that recursion is anything that refers to itself (if not, then you may be stuck browsing google forever trying to find out what recursion is!). A fairly common example of recursion is the Fibonacci numbers. The pattern for Fibonacci numbers is to add the 2 previous terms together for the next term, starting with one and one.

Java Examples & Code Snippets by Java Code Geeks - Official Launch

Hi all,

Here at Java Code Geeks we are striving to create the ultimate Java to Java developers resource center. In that direction and during the past few months we have made partnerships, we have set up a Java and Android tutorials page and we have created open source software.

But we did not stop there. We are now proud to announce the official launch of our Java Examples & Code Snippets dedicated site. There you will find a wealth of Java snippets that will help you understand basic Java concepts, use the JDK API and kick start your applications by leveraging existing Java technologies.
  
The main categories currently are:

Our goal was to make the snippets as easy to use as possible. For this reason, the vast majority of them can be used as a standalone application that showcases how to use the particular API. The snippets are ready to go, just copy and paste, run the application and see the results.

We hope that this effort will be a great aid to the community and we are really glad to have helped be created. We would be delighted if you helped spreading the word and allowing more and more developers to come in contact with our content. Don't forget to share!



Happy coding everyone!

Cheers,
The Java Code Geeks team

Tuesday, 6 December 2011

The persistence layer with Spring 3.1 and Hibernate

This article will focus on the configuration and implementation of the persistence layer with Spring 3.1 and Hibernate. For a step by step introduction about setting up the Spring context using Java based configuration and the basic Maven pom for the project, see this article.

Musing on mis-usings: 'Powerful use, Damaging misuse'

There's an old phrase attributed to the former British Prime Minister Benjamin Disraeli which states there are three types of lies: "lies, damn lies and statistics".  The insinuation here is that statistics are so easy to make up they are unreliable.  However, statistics are extensively used in empiracle science so surely they have some merit? In fact, they have a lot of merit.  But only when they are used corrrectly.  The problem is they are easy to misuse.  And when misused, misinformation happens which in turn does more more harm than good.

Multitenancy in Google AppEngine (GAE)

Multitenancy is a topic that has been discussed for many years, and there are many excellent references that readily available, so I will just present a brief introduction.

Monday, 5 December 2011

Spring Pitfalls: Transactional tests considered harmful

One of the Spring killer-features is an in-container integration testing. While EJB lacked this functionality for many years (Java EE 6 finally addresses this, however I haven't, ekhem, tested it), Spring from the very beginning allowed you to test the full stack, starting from web tier, through services all the way down to the database.

Database is the problematic part. First you need to use in-memory self-contained database like H2 to decouple your tests from an external database. Spring helps with this to a great degree, especially now with profiles and embedded database support. The second problem is more subtle. While typical Spring application is almost completely stateless (for better or worse), database is inherently stateful. This complicates integration testing since the very first principle of writing tests is that they should be independent on each other and repeatable. If one test writes something to the database, another test may fail; also the same test may fail on subsequent call due to database changes.

Basic and Digest authentication for a RESTful Service with Spring Security 3.1, part 6

This is the sixth of a series of articles about setting up a secure RESTful Web Service using Spring 3.1 and Spring Security 3.1. A previous article introduced security in the context of a RESTful service, using form-based authentication. This article will focus on configuration of Basic and Digest authentication and on configuring both protocols for the same URI mapping of the API, using Spring Security 3.1

Best Of The Week - 2011 - W49

Hello guys,

Time for the "Best Of The Week" links for the week that just passed. Here are some links that drew Java Code Geeks attention:

* Java 7: Project Coin in code examples: This article provides a short description of the new features included in Java 7 (Project Coin) accompanied with code
examples on how to use them. Also check out Manipulating Files in Java 7 and Java 7 Feature Overview.

Friday, 2 December 2011

REST Service Discoverability with Spring, part 5

This is the fifth of a series of articles about setting up a secure RESTful Web Service using Spring 3.1 and Spring Security 3.1 with Java based configuration. The previous article introduced the concept of Discoverability for the RESTful service, HATEOAS and followed with some practical scenarios driven by tests. This article will focus on the actual implementation of discoverability and satisfying the HATEOAS constraint in the REST Service using Spring 3.1.

Principles for Creating Maintainable and Evolvable Tests

Having [automated] unit/integration/functional/... tests is great but it is too easy for them to become a hindrance, making any change to the system painful and slow – up to the point where you throw them away. How to avoid this curse of rigid tests, too brittle, too intertwined, too coupled to the implementation details?

Surely following the principles of clean code not only for production code but also for tests will help but is it enough? No, it is not.

Based on a discussion on our recent course with Kent Beck, I think that the following three principles below are important to have decoupled, easy to evolve tests:
(Disclaimer: All good ideas here come from Kent Beck and my course-mates. All misconceptions are genuinely mine.)

Thursday, 1 December 2011

RESTful Web Service Discoverability, part 4

This is the fourth of a series of articles about setting up a secure RESTful Web Service using Spring 3.1 and Spring Security 3.1 with Java based configuration. The article will focus on Discoverability of the REST API, HATEOAS and practical scenarios driven by tests.

Ignoring Self-Signed Certificates in Java

A problem that I’ve hit a few times in my career is that we sometimes want to allow self-signed certificates for development or testing purposes. A quick Google search shows the trouble that countless Java developers have run into over the years.

Depending on the exact certificate issue, you may get an error like one of the following, though I’m almost positive there are other manifestations:

Decompiling Mega Vendors behaviour and future strategics (Microsoft, IBM, Oracle and SAP)

IT News have an excellent article about the latest Gartner Symposium, where one of Gartner analyst Dennis Gaughan gave a broad overview of the strategic direction of the world’s largest application vendors IBM, Microsoft, Oracle and SAP.

Below are some keynotes and related "quotes" from Mr. Dennis Gaughan.