Tag Archives: environment

The Java Roadmap – Its second life.

Woo Hoo!

I am excited to know about Java being back on-track with its journey of being the most preferred in-demand platform.
I started following the development at the following interesting links:
Here’s what I have learnt in the last few hours:
1/With news about the next JDK releases slated for 2011 and late 2012, the java platform is in for a complete re-write much more intutive and more robust than ever before.
2/The sensor api is the answer to the recent advancements in the mobile domain viz-a-viz touch screen/GPS enabled life-apps. Looks like J2ME(or what ever it will be called) will reign in for the first time in serious cometetion!
3/Must read Project Coin.
4/Oracle’s official statement is adamant at keeping two versions alive for whatever product they already had and what they inherited from Sun. A tough situation to be in.
I have been recently loosing faith in what the future of java will be after Oracle took over and a lot of Sun luminaries quiting Oracle controlled java. Atleast I see new life(hard work and pain going in) in my most loved language, Ever!
I look forward to it with renewed hope!

Annotations are hardcoded string literals.

Well,
I do not have much to say apart from the what the title of this post says.

I do not like annotations as a way of weaving code for an application at all.
XML’s are bearable, but looking at an annotated code, is like looking at hardcoded values as if they are all string literals.

The reason I prefer XML over annotations is atleast they keep the configuration part staked away seperately or is it just me who does not like overloaded contexts?

Here’s the real motivation:
The OO paradigm was there to do the abstraction right, by punctuating them with annotations, we miss the broader general rule of why the object maping was done initally.

Let’s Keep the principle Simple!

Stable Dev Environment?

Once upon a time there was a Q&A that happened as follows…

Q:So when can you say that your local dev environment is ready?
A:When you have run a comprehensive unit test, pre-existing or drafted yourself.

Q:What is a comprehensive unit test?
A:One that covers all major components of the architecture you are working on.

Q:What can be the major components of an architecture, one may be working on?
A:Layer Code, deployment, DB, Jndi context, orm context, 3rd party API context.

Q:What’s your point?
A:You environment ain’t ready until all your environments are not accessible from your box. The best way to ensure this is with a unit test and know thy environment!

Introductory AOP (Aspect Oriented Programming)

I wrote this piece as part of my work….

Aspect Oriented Programming is one of the programming paradigms where secondary or supporting functions are separated from the main business logic. The major objective is to increase the modularity by separating the secondary functionalities as crosscutting concerns. The main driving force behind the AOP was Gregor Kiczales, who worked on AOP at Xerox Palo Alto Research Center (PARC) and developed AspectJ which is one of the most popular AOP packages available today.
Basic Concepts
The basic concepts involved in Aspect Oriented Programming are:
1) Cross Cutting Concern: This refers to the secondary functionality which needs to be separated from the main business logic. For example, logging needs to be performed by classes in our data access layer and also by classes within our UI layer. Even though the major functionality of classes in UI and data access layer is separate but the secondary concern (i.e. logging) is common to both. So, in this case logging functionality forms a cross-cutting concern (term cross-cutting is used as the functionality needs to be implemented in such a way that it cuts across the main functionality).
2) Advice: The additional code that needs to be implemented whenever a cross cutting concern is involved. For example, this can be the logging code which needs to be implemented.
3) Pointcut: The point of execution in the application where cross cutting concern needs to be applied. For example, pointcut is reached when we need to log information before entering a method and we need to log information after exiting out of method.
4) Aspect: Aspect is simply a combination of the pointcut and advice. So, if we continue with our logging example, then logging aspect involves the advice (logging code to be implemented) and pointcut (point where we need to execute our advice).
Support for AOP
AOP is supported by variety of frameworks, platforms and languages. As of now, nearly every major J2EE platform (JBOSS, Spring, Weblogic, Websphere) is supporting AOP. AspectJ and AspectWerkz are two most popular packages available for AOP for use with Java. Moving apart from Java/J2EE world, AOP is also supported by .NET framework (both C# and VB.NET), C, C++, Perl, Python etc.
Implementation
AOP can be implemented via a process called weaving, which involves the use of an aspect weaver reading the aspect oriented code and weaving it (or simply put as generating) appropriate object-oriented code with all the aspects integrated. The weaving methodology is language independent and the only factors which govern the choice of weaving are 1) implementation and 2) ease of deployment. Weaving process can be done in two ways:
1) Source-level weaving: Source level weaving can be implemented using preprocessors having access to modify source code files. For example, in case of Java programming language, source level weaving can be performed via bytecode weavers which can work directly on compiled .class files. Bytecode weavers can work during codebuild, or during class loading. However, this approach causes problems as some of the third party decompilers or debuggers are unable to process the woven code as they understand the code generated by Java compiler rather than the one generated by the aspect weaver. AspectJ uses source-level weaving to generated aspect oriented code.
2) Deploy-time weaving: In order to avoid the problem associated with source-level weaving, deploy-time weaving use post processing whereby instead of modifying the existing code, we subclass existing classes and any modification is carried out via method overriding. The existing code thus remains untouched. This approach is commonly implemented in Java EE application servers, such as Websphere by IBM.
Problems with AOP
The use of AOP involves proper understanding of crosscutting concerns which sometimes can be a difficult task involving clear knowledge of static as well as dynamic flow of a program. If a developer commits any logical error while implementing crosscutting, the effect may be widespread. Also, if joinpoints are modified again it might lead to breakdown across the application.

Spring Integration: Basic Fundamentals

Looking into spring integration for quite a while now.

Spring Integration is a project of SpringSource(duh). The major aim of Spring Integration is to apply the Spring’s core programming model (IoC et.al) into the messaging domain.

The main components of Spring Integration are:

1) Message: It is a generic wrapper for any Java object combined with the metadata to be used by the framework to handle that object. The message is further consisting of header and payload. Payload can be of any type(basically a Java object) and header is for holding the information required for the message to be processed.

2) Message Channel: Message Channel forms the mode of communication between the message producer and consumer. It decouples the message production logic from the message consuming logic. The key point to be noted is that the message channel supports both Point-to-Point and Publish-Subscribe models (for the uninitiated, Point-to-Point model basically means a message has only one consumer processing it even though other consumers might also exist for the same message and Publish-subscribe model basically means a message has multiple consumers processing it simultaneously. To summarize, Point-to-point is unicasting the message whereas Publish-subscribe is broadcasting it). Another important point to be noted here is that while these two models describe how many consumers would ultimately process the message, Spring Integration also allows you whether to have message channel to buffer messages or not. This is important in the scenarios where it might be prudent not to overload the consumer with the messages.

3) Message Endpoint: Message endpoint connects the message and the application code in a non invasive manner. In other words, application code and message need not know the implementation details of each other.

Maven and Proxy scripts

This friday at work, I was configuring a new system for project use.
The transition to a newer LAN was fun but what was more challenging and a little less-fun the configuration of maven for some spikes.

I was supposed to get working on spring-webflow and for that I had to get a maven controlled project up and running.

In this I faced the challenge of getting maven past the proxy settings and it being able to download all/any dependencies as required.
I had earlier, on a previous LAN setup, known the proxy server and port number and configuring the settings.xml for the same was not at all tough.
This time, our LAN is configured via some asp scripts residing at a server, so I did the following to get maven talking to the internet.

1/Go the script hosting the proxy script.
2/Download and study the proxy script, find the final else-if case for identifying the actual proxy server and port.
3/Put my user name alongwith *domain* and put it in the settings.xml[this was the part that took longest amount of time to find]

And maven got to see the light of the internet!

It is important to note that maven does not support NTLM authentication(I assume this was the problem) although there are tools(cntlm), which I tried working for 5-10 minutes but did not get through.

The missing software oath!

We as software creators, affect lives of everyone.
Be it a lawyer/doctor/government/police/reporters and what not.
All of them have an oath they take acknowledging with their conscious the work they are supposed to do would be done with best spirits and with best intentions.
Although at the ground, it might not be true but atleast as a ceremony they have something to swear by!

Coming to the profession(an occupation requiring special knowledge) of software development and related works, we do have no such promises to make or oaths(commitment to tell the truth!) to take!

Maybe all related software professionals are assumed to lie or are assumed to be true.
If we all are liars, then we might not have his wonderful profession, as good things rest on good souls and get bad name from a few unfortunate few.

What place do you belong?

The agile India Scenario

The extreme programming wave initiated by Kent Beck et al in 1999 and since then the mature world programmers have embraced that change. A lot many clones started from that movement like agile itself, and the much widespread like scrum and lean.
Although these methodologies(or approaches?) had existed since long time, I remember reading somewhere that motorola had these practices in place since the 1960’s.

Flash-forward to India, I do not know who or when was the first project here was done with the wisdom of sound agile practices? But since I stepped into the professional way of writing software(means I was paid for what ever I did or did not), I was fortunate to see a genuine mix of these practices from the very start.Moving on to different software vendors, I notice that India per say is yet to embrace agile in spirit.

I do not travel at all, but looking around the small sample of professionals(incl self claimed agilist’s) I am dis-heartened to say the least, when I see my self surrounded by a lot of certified SCrUM(pun intended).
No doubt it has made its mark and helped realize XP too, ever since I got to know about XP, I had(still do) predicted the end of the software manager(with MBA) as a career.
The point that I want to make across is that these managers have misused the insights from agile practices to abuse the Indian developer. I have seen(and heard) *only* Indian managers who have been doing this to their Indian counterparts.
I dare say if they are given a mix of developers from different geographies, they would not do the mistake of exploiting more work in lesser time.
That is like a blind person blessed with more powers.

That being the problem around how do I( or we?) as the Indian developer in the clutches of the Manager (with MBA) cope with it?

Ahh! Its a complex mix out there.There are managers without MBA also.
Need to get back to the drawing board and start afresh!

Apache Maven-A review

What is it?

Simply put, I would say its sort of build tool, similar to another Apache project Ant. The Apache page for maven here gives a more detailed description:

” Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project’s build, reporting and documentation from a central piece of information.”

Searching for developer owned dev and deploy platform!

It has been long time I have been wanting to get rid of hard disk failures at home.
For this, the only solution that hit me was use a wireless network storage (WNS) system at home and things would be fine.
That still would need to be dependent on power from the same place where I use the WNS, so not quite a scalable solution.

So here I announce the search for such a service, where ,
1/ I remotely login
2/ I can setup my desktop environment
3/ I can checkout/clone any public-ally hosted project.
4/ I can test-develop-deploy the complete application
5/ I can host the application for the world to enjoy!

Any service providers you come across, please so share here.

~rohit.