When you are coding with immutable objects, there are many times where you not only need to initially define them but may want to create derivative versions of an existing instance. You might want to consider using chained methods to make your code more concise or to take advantage of default or optional parameters. Read More »
Last Tuesday I went to the AWS Builders Day here in Manchester at the Victoria Warehouse in Salford Quays. Like most of the country, we woke up to snow on the ground which is pretty rare here in the UK. Having lived in Cleveland, Ohio in the US for 15 years, I am not unaccustomed to getting 3 foot of snow this time of year so the inch or two we got wasn’t putting me off. On the plus side, not too many people travelling the Metrolink Tram, but on the bad side, the trams were only running to MediaCity which meant a 20-minute walk to the Victoria Warehouse. Despite the weather, I was able to get there in plenty of time and was met with free coffee and pastries. Read More »
Chained methods are class methods that return the instance of the object so you can call another method on the same object. This article looks at the problems you can face with implementing classes with chained methods in Java when using inheritance, and how to solve them. Read More »
This post is the first in a series on concurrency and describes the benefits and some of the problems with concurrency we might face in our code and simple ways we can fix them. While there are far more complex problems that require more advanced solutions they all share the same principles and in many cases, are rooted in these basic solutions. Read More »
One of the many accusations aimed at JSF is the definition and complexity of the JSF Lifecycle. The JSF lifecycle is responsible for processing the page creation and submission and orchestrates the different pieces of the framework. A more thorough description of the process can be found in this article by Rick Hightower. At a high level, this process is defined as :
- Restore View – JSF builds the view for the first time or restores the component tree.
- Apply Request Values – take the values from the submitted form, convert them and put them in the component objects.
- Process Validation – validates the converted values based on applicable validators. If validation fails, we jump to the last step.
- Update Model Values – take the converted and validated values and put them in the properties of the backing bean.
- Invoke Application – Once your backing beans have been updated, the application is called and usually code is executed against the backing beans.
- Render Response – the response is generated and sent back to the users browser.
It is claimed that it is an unnecessary complexity that the developers must deal with in order to use JSF. Understanding the lifecycle is not a requirement but will help you understand what is going on, but what is objectionable about this assertion is that this lifecycle is no different than just about any other web framework. One Spring MVC user has posted a cheat sheet which is quite a handy guide to the form controller. It shows how complex Spring MVC can be in executing identical behavior. Wicket and even ASP.net perform the same steps in that it utilizes a server side model, pushes the values in, converts and validates them, handles events, and then renders a response. Even the most simplistic frameworks must always extract values, convert and validate them since when working in the web, you are merely pushing strings between server and client. At some point these string values be converted to meaningful data and objects and the consequences of invalid content must be dealt with. JSF is quite upfront about this process and even lets you hook in to the lifecycle events through the JSF
This article shows how you can leverage JPA Lifecycle Events to automate the filling in of audit information. The first example uses a base entity class with lifecycle events that looks for a time stamp interface to determine whether the entity is audited.
Read More »
Despite the fact that there are plenty of free languages and development tools available online, there is still a much larger barrier to entry for someone who wants to get started as a programmer compared to nearly 30 years ago. I have fond memories of the computing of the 80s so I thought I’d take a quick trip down memory lane and write about my personal exerience of becoming a programmer. It may also be of interest to those familiar only with the Silicon Valley version of the history of computing since this covers events from the other side of the pond in the UK. When historians talk about the history of computing, they really only cover things like the TRS80, Altair and rise of the PC and Mac, yet there were many important and competitive developments in Europe that are often not included as part of this history.
There’s still a lot of confusion over the difference types of managed beans provided in Java EE 6 with EJBs, CDI beans and JSF managed beans all being available. This article aims to clear up some of the differences between the them and define when to use them. Read More »
In this second article on implementing Spring MVC in Java EE 6 we’ll take the metadata we extracted in part one and use it to invoke request mapped controller methods in response to web requests and then direct the user to a web page based on the result of the method. Read More »
One of the opinions I’ve had over the last couple of years is that Spring makes things look really easy, and CDI is a great dependency injection framework. Throw in this article suggesting you can build your own Java EE 7 and it sounds like a challenge, so for fun, I thought I might have a go at implementing a subset of Spring MVC on top of CDI with Java EE 6. Read More »