Friday, September 25, 2009

whoNeedsArchitect

http://martinfowler.com/ieeeSoftware/whoNeedsArchitect.pdf

My fav quotes from this article --- this is what I often bring up in our lunch conversations with fellow QSI'ers!

I think that one of an architect’s most important tasks is to remove architecture by finding ways to eliminate
irreversibility in software designs

Software is not limited by physics, like buildings are. It is limited by imagination, by design, by organization. In
short, it is limited by properties of people, not by properties of the world. “We have met the enemy, and he is us.”

“Architecture is the decisions that you wish you could get right early in a project.” Why do people feel the
need to get some things right early in the project? The answer, of course, is because
they perceive those things as hard to change. So you might end up defining
architecture as “things that people perceive as hard to change.”

Thursday, September 24, 2009

Agile Methodology - Similiar to Creating Shareholder value

I have been involved in several projects now that had used Agile methodology for project management or a derivative of this method. In these projects I have assumed several roles - Developer, Team Lead, Designer, Architect and BA in a few cases.

Something I have realized is Agile method is similar to the notion in public companies - "creating shareholder value". Agile software development has iterations - 2 to 4 weeks long and then we provide improved version of software / product to the client. The client also prioritizes the new features to be developed and / or defects to be fixed. This is similar to what public companies do - a quarter can be considered as an iteration at the end of which the money matters are shared with the shareholders and  a new iteration begins. The profits the company makes is the product the shareholders are concerned with. The shareholders directly or indirectly have a say in how the company would improve profits or make new money (similar to client deciding on new features).

This idea of shareholders value creation is dangerous as well. The company tends to focus on short term gains and loose sight on long term plans. A similar thing may happen in Agile projects where lack of proper documentation, design and architecture due to short term goals (short iterations) may plague a system in long run. Of course there are exceptions - there are well run Agile projects and there are well run public companies that make profits.

Just a thought !

Wednesday, September 23, 2009

ERROR in Eclipse - Access restriction: Class is not accessible due to restriction on required library


I get this error in Eclipse when I use the @PostConstruct and / or @PreDestroy annotations. To get rid of this error in Eclipse change the "Forbidden reference (access rules)" level to Warning or Ignore.

Thursday, September 17, 2009

B2B - Back to Basics Series

I have conducted a dozen or more interviews now in my career so far for different roles on projects - Developer, Sr. Developer and Team Lead. I make it a point to ask about OOAD and Design patterns in all these interviews. However in many cases than I would have expected the candidate was not able to explain the a OOAD principle (like SRP, DRY etc) or design pattern. I think understanding of these core concepts is much more important than the knowledge every API.

I am going to start writing this B2B series here on my blog. In this series I will write about the fundamentals, basics of Computer Science, Software Engineering, OOAD etc that we learned many years back in school and still use in our professional life. However lot of times we forget lot of these things while dealing with the day to day work. Hopefully someone other than me finds this helpful

Happy Coding !

Friday, September 11, 2009

Apache's 11 technologies that changed computing in last 10 years

I found a nice article on eWeek.com about the 11 technologies that changed computing over the last decade and to technologies that would probably be dominant in the next decade.
http://www.eweek.com/c/a/Application-Development/11-Apache-Technologies-that-Have-Changed-Computing-in-the-Last-10-Years-469693/

Wednesday, September 9, 2009

Moved to blogspot

I have moved my blog to from www.daveayan.com/blog to this space.
Blogspot has a lot more features obviously than the out of box liferay blog. Please update the book marks and add some comments or provide your reactions.
I will be shutting down my site (http://www.daveayan.com) in a couple of months as well and try to come up with another, better looking site.
Thanks

Thursday, August 6, 2009

TestNG + EasyMock - OutOfMemoryException

As much as I liked TestNG and Easy mock a few months back I am starting to hate it as well. We have a suite of around 500 unit tests (maybe just a bit less than that) and we get OutOfMemoryException. We get these running locally and on running on Hudson CI. On further research I found these two links that explain this problem. BTW we run with JAVAOPTS -Xmx128m. Increasing the memory does not help, I dont know why.
EasyMock OutOfMemoryException

TestNG OutOfMemoryException

Too bad the TestNG defect is open for almost 10 months and not fixed.

For now we segmented the unit tests into two groups - unit1 and unit2. This is working well, however I anticipate issues now with the corbertura reports that we want out of CI. Also, next time we hit the wall on unit2 we will have to start a new group - unit3 ... Arrrr !

Thursday, July 23, 2009

Up Next - Spring Certification

I would start preparing for Spring Certification starting this week. I would like to try and get the exam done in next three months.
It is an extensive exam with no proper study notes or mock exams and need 76% to pass. This will be fun.
Go Spring !

Wednesday, July 15, 2009

Liferay book by Jonas Yuan

I got an oppurtunity to review the new book from Packt publishing - Liferay Portal 5.2 Systems Development by Jonas Yuan.
 A few words about this book.
This is a nice begineer to intermediate to semi-expert level book. The book begins with a nice overview of the liferay portal system and WCM and introduction to JSR 286 portlets. The author then gradually raises the bar with more details on how to develop portlets, manage pages, and customizing the portal.

My favorite chapters of the book were the chapters on Social Office, Staging & Publishing and using common api.
Actually the social office chapter was quite a surprise. The author has given good treatment to the topics explaining them in sufficiant detail for a beginner and at the same time making it relevant to the advanced users. The author has also explained the events and hooks very well.

One more thing that I liked about the book was that the author explains how the code works out of the box and then how to customize it. I liked the "Whats happening?" sections of the book

One of the things I do not like is that there are a few sections in the book like "Using SCORM" that do not talk about the topic in detail. This raised the expectations but then quickly brought them down looking at just a few lines of explanation. However there were not a whole lot of such topics.

All in all I would recommend this book to anyone who wants to get started with Liferay and get a good handle on the system.

Thursday, July 2, 2009

Hibernate - Annotations vs XML

Recently I was involved in a healthy discussion at my work on using Annotations for Entities. We have a Java web application with Spring MVC, Hibernate and Entities with hbm.xml files. Entities with XML work well however there is an interest in the team to use annotations. Here are my thoughts - pros and cons of each approach. I have used both approaches, however I like using hbm xml files over annotations for entities. That said I do like the use of annotations in Spring MVC, TestNG, or on service layers to mark transactions.
Why stick to hbm.xml files?
  1. Well, if we think back to days before hibernate, when we used JDBC we had the problem where the SQL code was embedded in Java classes, thus causing many maintainability problems. With Hibernate xml files we got a clean way to keep them seperate - the entity pojo's were free of the sql clutter. With Annotations in Entites we are going back to that same model !!!
  2. Entities are cross cutting code - they are used in all layers, starting from DB all the way to JSP in many cases. Cross cutting logic should not have code that looks more biased to a certain layer.
  3. If you are working in a team that is split into Backend Dev team and frontend dev team then the front end team does not need to see all those annotations. Well what would be the argument if frontend team wants to add their own View specific annotations to entities for ease of use?
  4. If you have a code base that takes long time to compile and build (fortunately for us it takes a few seconds), having an hbm xml file is better. No need to recompile.
  5. If you have to migrate from xml to annotations on an existing ongoing project what is cost justification to use annotations?
Why move to Annotations?
  1. Well, as my collegue at work explains, it improves maintainability by having only one file
  2. As Paul Mazak would say, the mantra is "less code characters", helps in long run.
  3. Annotations are cool ! Learn some new stuff
Well in the end it is a religious debate and fun as well. I will stick to hbm xml so far, playing with Annotations as I get an oppurtunity for new development.

Tuesday, June 30, 2009

PMP Exam

Passed my PMP exam today finally - what a ride it was.

It was tough, the real exam questions were very different from the mock exams I had been preparing with, in terms of the style, definitions used etc. There were a few new terms as well, that I never read of before.

Luckily the time was more than enough. I was able to run through all the 200 questions in 2 hours, 30 mins. For some of the questions I did take a lot of time to think as well. At the end I had around 25 questions marked for review and 4 not answered. The next 90 mins were enough to review and complete them all. I still had 23 mins remaining before I clicked "End Exam".

After I clicked "End Exam" I was asked for an optional survey. I wanted to fill the survey in good faith but who wants to wait 10 more mins to see a pass / fail score? They should have asked for the survey after showing the score.

Anyways, after the exam we went and watched a movie and had nice dinner at Chipotle. End of a saga and begining of a new one - whats next?

I want to take a bit of a break and then go for Sun Certified Java Web Services Developer or Sun Certified Enterprise Architect. Not sure yet which one to pick. And of course not to forget - keep an eye on those PDU's needed to keep PMP credential.

Caio

Thursday, June 11, 2009

No getters and setters

To design good software working with Domain language and making it part of Object's is very important. One way to get this, I think is to get away from the "get" and "set" polluted code.

consider this code:

public class Person {
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
private String name;
}

We would end up using this code in its simplest form like this:
Person theOne = new Person();
theOne.setName("Neo Anderson");
System.out.println(theOne.getName());

Instead we can easily modify this code to make it more "domain driven"
public class Person {
public String name() {
return name;
}
public void nameIs(String name) {
this.name = name;
}
private String name;
}

Our new code would be:
Person theOne = new Person();
theOne.nameIs("Neo Anderson");
System.out.println(theOne.name());

you can tell this is more english like code as well. You can easily read line 2 in the code there as "The one's name is Neo Anderson". You can easily read line 3 as "Print the one's name"

I believe in this approach. The easiest way implement this approach is:
1. If you have a private variable names "varName", your getter method would be named "varName"
2. The setter method would be named "varNameIs" .... append with an Is

Wednesday, June 10, 2009

Eclipse: Run a single unit test method

In eclipse if we have a junit test class with several methods in it we can run a single method test. Select the method name, right click and run as junit test. The setup and teardown are run well also.

This technique, however, does not work with testng tests. Eclipse will run all the test methods.

Tuesday, June 9, 2009

TestNG and EasyMock

Unit Testing is pretty cool once you get a hang of it and have the right tools to play with it. I started using TestNG and EasyMock recently. TestNG has this neat feature that allows us to partition the tests as unit, integration etc. EasyMock is not as easy but not bad.

Some problems I faced with unit testing were that sometimes a single unit test would run fine when they run from eclipse, but when the suite is run on CI they would fail. Most of the times the problem was that a easymock object was created and reused in its stale state

Saturday, March 28, 2009

Liferay 5.2.2

Liferay 5.2.2 was released in the end of Feb 09. Since then I have been playing and comparing it with 5.1.2. Here are the few things I think:
Pros:
- Journal Content renamed to a more appropriate Web Content
- More support for google adsense and google gadgets
- Nicer and more intuitive looking Control Panel for all the admin portlets
- Database configuration is now using portal-ext.properties instead of ROOT.xml
- The deploy and data directories are now not in user home. Instead they are at the same level as tomcat server itself
- There is just one built in / prepackaged compary - 7cogs instead of 11 Liferay companies 5.1.2 had
Cons:
- Larger zip file with tomcat 5.5 because it includes JRE now. (Well this will be a pro as well because now we dont have to worry about installing JDK on a machine that might not have root access)
- Build and startup takes a long time - as such it is a much heavy application now.
The cons list is not a big one and the pros are pretty good. I think however I will still stick with 5.1.2 and watch out for 5.3. The important change I would like to see is 5.3 being lighter weight and without its own JRE

Saturday, March 21, 2009