Selecting The Technology Stack for JCart

Selecting the right technology stack is very crucial and plays an important role in project success. Many of the architects (unknowingly??!!) try to make complex designs by trying to use all kinds of latest and greatest stuff. On the other hand some architects try to be in their comfort zone by limiting their technology stack to the technologies with which they are comfortable. Both approaches are dangerous. One should understand the business needs and pick the technologies that are necessary for project. Java Platform: We will be using Java 8 for JCart so that we can leverage the good features

Continue reading »

Developing a simple e-commerce application from scratch to production using SpringBoot

We can find plenty of information on any technical topic, be it Java, .NET, Python or any frameworks like Spring, Hibernate, CDI, JSF etc. You can find hundreds of well written blogs on many of these topics. For example, you can find lot of tutorials on how to use SpringBoot or how to use various mappings in JPA/Hibernate or how to do form validations in JSF etc. Also, there are plenty of books published by well established publishers on most of the technologies. But once the “Junior Developer” stage is crossed, many developers would like to learn more about how

Continue reading »

SpringBoot: Introducing SpringBoot

SpringBoot…there is a lot of buzz about SpringBoot nowadays. So what is SpringBoot? SpringBoot is a new spring portfolio project which takes opinionated view of building production-ready Spring applications by drastically reducing the amount of configuration required. Spring Boot is taking the convention over configuration style to the next level by registering the default configurations automatically based on the classpath libraries available at runtime. Well.. you might have already read this kind of introduction to SpringBoot on many blogs. So let me elaborate on what SpringBoot is and how it helps developing Spring applications more quickly. Spring framework was created

Continue reading »

Clean Code: Don’t mix different levels of abstractions

We spend more time on reading code than writing. So if the code is more readable then obviously it will increase the developer productivity. Many people associate readability of code with coding conventions like following standard naming conventions, closing file, DB resources etc etc. When it comes to code reviews most of the people focus on these trivial things only, like checking for naming convention violations, properly releasing resources in finally block or not. Do we need “Senior Resources” in team (I hate to call a human being as a Resource) to do these things?Tools like Findbugs, PMD, Checkstyle, Sonar

Continue reading »

Drools JBoss Rules 5.X Developer’s Guide Book Review

We all start our new projects by promising to follow best practices and good design principles etc.But over the time business rules change and developers keep adding new features or updates existing logic.In this process the common mistake done by many teams is putting if-else conditions here and there instead of coming up with better design to support enhancements. Once these feature turn on/off flags and behavior branching logic started creeping into code then overtime it might become un-maintainable mess. The original developers who design the basic infrastructure might left the organization and the current team left with a huge

Continue reading »

Dear NetBeansIDE, You are just one step away from massive adoption

Well, NetBeansIDE 7.3 is out with plenty of new features, tremendous performance improvements.In addition to the great support for Java/JavaEE technologies, NetBeansIDE 7.3 comes with decent support for HTML5, Groovy, PHP, C++ as well. If you are skeptic with older versions of NetBeans like 5.x and never again look at NetBeansIDE, I would strongly suggest you to take a look at latest NeaBeans releases specifically 6.9.x on wards. However, I wish NetBeans should have following features which greatly increases its adoption:1. NetBeansIDE as a zipped bundle: You may ask how does it matters?!!. Think about the enthusiastic developers in so called Big MNCs without

Continue reading »

Are frameworks making developers dumb?

Last week I got to take interviews to hire senior java developers with around 5 years of experience. But after the interview process is over I felt like the frameworks makes developers life easier but at the same time making them dumb. Everyone puts almost all the new frameworks on their resume claiming they have “Strong, working experience on Spring, Hibernate, Web Services etc”. Here is how the interviews went on. Me: You have used Spring in your latest project. What are the advantages of using Spring?Interviewee: We can configure beans in XML and it will take care of instantiating

Continue reading »

Mock Table utility for CRUD operations

While learning a new technology we may need a database table to store the data.But creating a database, setting up jdbc connection and writing crud operation may be cumbersome. So I thought it would be good to have some mock utility to represent a table which can be used just like a database table. Here is what I came up with. package com.sivalabs.sample.util;import java.io.Serializable;public interface Identifiable<K> extends Serializable{ public void setId(K id); public K getId(); } package com.sivalabs.sample.util;import java.util.Collection;import java.util.HashMap;import java.util.Map;public abstract class Table<PK extends Object, T extends Identifiable<PK>>{ protected final Map<PK, T> table = new HashMap<PK, T>(); public abstract

Continue reading »

JSON processing using Jackson Java JSON Processor

JSON(Javascript Object Notation) is becoming more popular data exchange format. While developing Web applications using Javascript frameworks like YUI, ExtJS, DOJO etc we can use either XML or JSON to exchange the data between the client and server.Normally we get the response from the server in terms of java objects. Then in Servlets or Action classes we need to build the JSON from objects and send back to client.To build the JSON response from Java object we can use Jackson Java JSON Processor which very much easy to use. Let us see how we can use Jackson Java JSON Processor

Continue reading »

Java Coding Best Practices: Better Search Implementation

In web applications searching for information based on the selected criteria and displaying the results is a very common requirement.Suppose we need to search users based on their name. The end user will enter the username in the textbox and hit the search button and the user results will be fetched from database and display in a grid.In the first look it looks simple and we start to implement it as follows: public class UserSearchAction extends Action{ public ActionForward execute(…) { SearchForm sf = (SearchForm)form; String searchName = sf.getSearchName(); UserService userService = new UserService(); List<User> searchResults = userService.search(searchName); //put search

Continue reading »