Sunday, January 24, 2010

Hottest IT practices in 2010

According to Forrester Research, the future is in so called 'lightweight' and 'cloud' based applications.
Let me clarify the concept of lightweight being used here.Firstly, lightweight or agile means a framework having very small initial setup requirements and not only it invloves shorter developmental cycles, but also requires lesser maintenance and upkeep costs, once the application goes live. Mentioned in the abovementioned article, are the frameworks such as :- 
Flex
Dojo
Drupal 
GWT
Ruby on Rails
Spring
Zend


This is not a definitive list as such and much more can be added. However, if you've used atleast a single framework out of these, you'll come to the conclusion that these frameworks are quick to set up and run, and are flexible at the same time. It is not surprising that, given the post-recession economic scenario and the ever-increasing SOA adoption by the industry, these (and many such) frameworks are most sought after (read as 'hot') in the job market.

Sunday, January 17, 2010

Importance of a Build Utility-2

In this part, I'll be covering the various aspects of building an application in the java platform. I am specific about this because of a large developer base on this platform (It has more than 20 Million developers currently).

In this platform too, building applications is not a breeze as you need to do a lot of things. All this requires a lot of forethought and a nice build routine to smooth things as we go on. Think of a build utility as an investment that gives a rich dividend once your application increases in size and complexity.

By and large, there is a single build utility in java, known as ant [ Another Neat Tool ] (http://ant.apache.org). This is an open-source xml based building utility that frees you from the burden of performing complicated and repetitive steps. It is also the build utility involved behind the scenes in IDEs like Netbeans and Eclipse. It is quite easy to learn and use, as it doesn’t requires more than one day to learn this. Apart from the quintessential hello world application types, it helps you a lot in your application automation.

Note that the root tag is the project and other activities are targets. Inside each target, are the actual works to be performed in the form of tasks. There are various tasks inbuilt in ant distribution as well as the third-party tasks are there, downloadable from the internet. Also you can create your own custom tasks (although I've never seen many of them).

Example (build.xml):

< project name="Custom" basedir="." default="run">

< property name="src" value="src" />
< property name="build" value="build"/>
< property name="dist" value="dist" />
< property name="jarfile" value="${dist}/Custom.jar" />

< target name="init">
< delete dir="${build}"/>
< delete dir="${dist}"/>
< mkdir dir="${build}" />
< mkdir dir="${dist}" />
< /target>

< target name="compile" depends="init">
< javac srcdir="${src}" destdir="${build}" />
< /target>



< manifest file="Manifest.mf">
< attribute name="Main-class" value="Test" />
< /manifest>
< jar destfile="${jarfile}" basedir="${build}"
manifest="Manifest.mf" />
< /target>
< target name="run" depends="package">
< java jar="${jarfile}" fork="true"/>
< /target>
< /project>

Assumptions :
jdk1.2+ is installed
ant is installed (in the same manner as your jdk)
The application is a JavaSE application that has a main class as Test

Here, on typing ant on the current directory, the ant would delete the build and dist directories, then compile all the source files. After this, it packages the application in a jar file and lastly runs it to test our application.
In Netbeans, you can view the ant file created in your project directory as nbproject/build-impl.xml and as notified, you can add your own customizations in a child build file to alter your project build routines as the needs arise.

Ant is quite flexible and you can perform almost all actions that you require. This article just scratched the surface of the build utility, you can search for more comprehensive tutorials as well as different tasks online.

In large projects, even ant has quite a few shortcomings, which is further automated by newer technologies like Maven. I'll be covering out that in my next article.

Monday, January 4, 2010

Importance Of A Build Utility -1

Build utilities are essential ingredients in a software developmental life cycle. In order to create and streamline your production process in a modern project, you need to know and use build tools to automate the repetitive tasks.It is unthinkable to work upon a large program (usually with a large number and types of files) without using a build tool, which helps you to :-
Eliminate repetitive tasks
Manage the project
Focus on code, not on peripheral issues
Manage the libraries, or dependencies
Package the project , and deploy into a necessary environment, if needed
Run tests and other routines on the project
Ease of use

I'll start from one of the most popular build utility, make (www.gnu.org/software/make/). Make is a utility for automatically building executable programs and libraries from source code. Here, we can perform various tasks such as dependency management, file structure handling, compiling, packaging, etc to build a program. Although used much in Unix based projects, in its heyday, make was also the build utility to be used in windows using the Microsoft's nmake utility. Eg :
# gnumake file

.build: .clean
gcc -o *.c

clean:
/bin/rm -f *.o

A makefile is tab indented, which means that certain commands like c and c++ compiler need to be stated after a tab.
For example, the postgres database performs the following to package itself
...
distdir := postgresql-$(VERSION)
dummy := =install=
garbage := =* "#"* ."#"* *~* *.orig *.rej core postgresql-*

dist: $(distdir).tar.gz
ifeq ($(split-dist), yes)
dist: postgresql-base-$(VERSION).tar.gz postgresql-docs-$(VERSION).tar.gz postgresql-opt-$(VERSION).tar.gz postgresql-test-$(VERSION).tar.gz
endif
dist:
-rm -rf $(distdir)

$(distdir).tar: distdir
$(TAR) chf $@ $(distdir)
......

This makes our life easier as we now do not have to explicitly specify the commands for packaging i.e. tar ProgramName- and so on manually.

The Java Build Tools
The needs of large scale application also come in java technology. While you can create a .sh or a .bat file for simple commands like javac, java, etc, but this is'nt good from scalability point of view also, this is'nt portable, which eliminates the entire platform neutral nature of java.
So, we need something to get our projects going.
For this, ant(http://ant.apache.org) is the de-facto utility used in all projects. As an ant file is a xml file, it can be easily be ported, extended, tweaked, etc which increases the flexibility of this tool.
However, in large scale projects, even ant can't be used to ease the build process. Here, when we are facing dependency problems, we need more automation and a greater degree of reuse. For this, we use Maven as a key build utility (http://maven.apache.org). This not only promotes build process reuse, but also handles dependency management.

Thus, in order to focus more on other aspects of software development, you must have a clear plan and a solid platform for your application.Altough, it might seem as eccentric to you first, but such utility pays off in the longer run when you consider the development headaches and delays. What's your take on this?, I'd love to have your opinion.