Wednesday, 14 November 2012

Faster, Better, Cheaper

Software Architecture or Project Management or anything in general in life is all about making trade-offs. We always need to choose from the available options. We have to compromise on something to gain on other things. Which one to loose and which to gain is the process of making trade-offs.

In the software development out of the three options faster-better-cheaper we can only choose any two. If we want our product to be ready immediately with better quality less bugs we need to spend more money on it. In this case we gained speed and quality, however we loose on price. At the same time, if we do not have much budget we needed to settle for either slow development time or on quality.

In the architecture, if my software wants to serve with fast response I need to scale the system. I can scale either horizentally or vertically. This involves cost. Ofcourse, code refactoring or tuning can improve the system's performance upto some extent but to really improve performance the system has to be architected with load balancing or caching mechanisms. In order to provide quality of service (QoS) like 24x7 availability, we need to plan for failover strategy. There are various options to choose (active/passive, load balancing, caching etc) depends on budget.

At one point we cannot get all of three choices. Correct balance is important when making trade offs. The most important thing is to involve stakeholders of the project during deciding the trade offs. Their involment is critical because they are the people who actually use the system in future.

For example, if we are dealing with marketing department, they needed the software faster in order to go to market asap. For them it is time to market scenario. If they have budget, more people can be involved in the project and can be completed faster with better quality. If the project is internal for few staff, company may not provide super budget, in this scenario we can compromise on speed. We can deliver software in reasonable timeframe with limited resources.

In the architecture or project artifacts, either architect or project manager should document the gains and trade offs he/she considered and the reasons behind these decisions. The architect or PM should also take stakeholders approval of these artifacts. Anything in document can save us later point of time in projects when something happens to the project in chaos. Documenting decisions is always a good practise rather than verbal communications.

Tuesday, 25 September 2012

Project Manager, Business Users - Technology

How much technology a project manager should know? Is it just enough to know what's happenning in the team? Or more in the level of Solution Architet? Again there are different perspectives and variations. Let's consider a practical scenario and we'll see how each person in different roles act.

Let's say there happend to be a production problem in the middle of the night (if you are in the pub drinking during that time, don't take the call :) ) (say around 2 am, I like this time because this is the time I get calls) and it is serious issue and needs immediate attention. The below are the possible things each role can do if they get a call.

Q. What a developer can do?
A. A developer can login to the server, check logs and spends time understading what could have happend. Once problem is understood, he/she can see if this problem can be fixed remotely (assuming at 2 am you're at home doing remote login). If problem cannot be fixed from home or brain not responding, he/she convinces user who called by telling them that they can only fix at office hours.  

Q. What a senior developer can do?
A. Whatever a developer will do + he/she will think what could've caused the problem and how to fix it in terms of design. Also how to permanently eliminate this error in near future.

Q. What a solution architect can do?
A. Whatever a senior developer can do + he/she thinks of a mitigation strategy to eliminate this kind of errors in the midnight, and thinks about a plan and process on how to provide permanent solution to avoid this error and many other errors relavant to this error in terms of architecture etc.

Q. What a project manager can do?
A. He/She immediately calls any one from above 3.

This is what happens in most of the companies I've worked. A project manager's duty is go look after project in terms of cost, estimations (team lead help needed in this area), task allocation. And each person in team answerable to project manager.

I know a manager many years back. In order to explain problem and solution we applied to the problem, we needed to teach her programming language we used. For example, if there was a problem, say a NullPointerException, we added null check to fix it, if we say there was an exception and we added condition to avoid it, she used to ask us, what is exception? what is null? etc questions. Quite irritating, but she is a manager. So we gave her a Java crash course in 5 minutes to her and explained the issue in detail. Man, she learned so much technology in crash courses almost became solution architect theoritically.

Putting bias aside, a project manager should have 70% management skill and 30% technology skill. That's why I always like to work under Solution Architect's supervision rather than pure management type people.

I also don't like to interact with business users, the moment we try to explain why certain things cannot be done with certain technologies (like controlling their browser settings from our servers, weird!!) they stop the discussion complaining 'its too technical'.

Because of all these experiences, I decided to stick to technical career path eventhough I am getting PMP training offers at good discounted price. I prefer to manager servers rather than managing people. At least, servers will follow your orders!!

Finally, a joke I remember about managers. Here it is:

A man goes into a pet shop to buy a parrot. The shop owner points to three identical looking parrots on a perch and says, "the parrot on the left costs 500 dollars".

 "Why does the parrot cost so much," asks the man.

 The shop owner says, "well, the parrot knows how to use a computer".

 The man then asks about the next parrot to be told that this one costs 1,000 dollars because it can do everything the other parrot can do plus it knows how to use the UNIX operating system.

 Naturally, the increasingly startled man asks about the third parrot to be told that it costs 2,000 dollars.

Needless to say this begs the question, "What can it do?"

 To which the shop owner replies, "to be honest I have never seen it do a thing, but the other two call him boss!"

(copied from http://www.workjoke.com/managers-jokes.html)

Tuesday, 4 September 2012

How to become 'Solution Architect'

Every Java developer's aim (mostly) is to become 'Solution Architect' because of the glamour this word has (another motivating factor is decent pay). I am also a Java developer and sometimes I try to relate my experience and knowledge to assess where I stand. Definitely long way to go to become Solution Architect. I have few thoughts on how to become Solution Architect. I am sharing few of them.

Before that, I want to make it clear what is Solution Architect in my own terms. Who is Solution Architect:

- A developer who is ready to code.
- A designer who is ready to draw UML diagrams.
- A coordinator who talks to project stakeholders to get requirements (functional & non-functional).
- A translator who translates business needs to technical requirements and vice versa.
- An estimator who can estimate project's cost and man days.
- A troubleshooter who can debug a problem and provides mitigating strategy (or solution).
- A process improver who suggests ways to improve process and productivity.
- A mentor who is ready to share his knowlege with his team and enlightens them.
- A person who have deep knowledge and experience in one technology and comfortable knowledge on other technolgoies.
- A good presenter with good presentational skills.
- Finally someone who takes blame if things go worse.

Ofcourse above criteria is very vague and differs from organization to organization. Well, how one person can develop so many qualities. I read somewhere that to become Solution Architect the best way is to act like one. So one developer thinks he/she is a Solution Architect what will happen?

 In positive terms, the thinking process changes, its totally a different perspective. As a saying goes... "A developer is concerned with what will happen when user clicks a button, an Architect is concerned with what will happen when 10,000 users click a button."

If you assign a task to a developer all his focus is only on coding, he will start coding right infront you and a hurry to deliver the code. However if you think an architect, instead of opening up your IDE you will surely ask questions.

Questions could be related to funtionality, maintenance, design, security and performance etc. Also you try to give best refactored code with patterns used whenever applicable. This is the difference. The best way to become Solution Architect is to think like one. Give best in what ever you do. Think of all aspects of a system not just code.

Since architecture is the basis for project and business, it should have solid foundation. If architecture is not scalable the risk is severe because rest of the system components are going to rely on the architecture. So the architect should fully undetstand stakeholder needs and try to leverage their needs with cost and timeline.

Becoming architect is not just a week's work and we cannot become architects by sitting in caves or by attending trainings. Its a continuous process. We constantly need to update our knowledge beyond our skill areas. We need to show great enthusiams to solve problems and we must have good patience with positive attitude. I always believe that Solution Architct is a role rather than a designation.

For all of the developers who wants to become architects, Good luck and bon voyage!

Monday, 25 June 2012

Java error message 'code too large for try statement'

I thought we can put any number of lines in between try and catch. After all its a programming language and it can execute whatever we give. However, until recently I got an error which scold me by saying 'code too large for try statement'. Basically the problem is our fellow programmers using JSP includes and parent JSP has try block which includes several JSPs (using include file directive) and catch block which has some exception handling stuff. I modified one of the included JSP and added few lines of code. This caused the above error. After little study I found that Java language has a limitation on the size of a method. That limit is 65535 (number of bytes the code occupies). This behavior may be different from compiler to compiler or server to server. I didn't dig it to that extent to find out the behaviors of containers. But one day I will do! The solution is to refactor and modularize the code. Also try to use jsp dynamic includes rather than static includes.

Tuesday, 13 March 2012

Completed IBM Certified Solution Designer - OOAD

I completed two certifications from IBM which covers Object Oriented Analysis and Design. To achieve IBM Certified Solution Designer there are two certifications to be passed.

1. IBM 000-833 - Analysis (passed with 86%)
2. IBM 000-834 - Design (passed with 83%)

Analysis certification is about how to analyse requirements, modelling and basically focuses on understanding the problem domain. I learned very good concepts on analysing problems and modelling. Design certification focuses on deriving a solution from the analyzed behiviour.

These certifications also gives touch on RUP and Iterative Development which I believe every Software Project Lead should have knowledge about to successfully run projects. The material in these certifications does not focus on a specific technology or implementation and mainly focuses on analysis and design techniques.

The best framework for implementing applications, more specifically web applications using the techniques covered in the above certifications is Spring.

I am happy that now I am IBM Certified Solution Designer for OOAD. Next target my dream subject Web Services and SOA.

Tuesday, 6 March 2012

PHP Installation Error

I recently installed Apache 2.2 web server with PHP 5. The installation of both were successful. However when I created a index.php with phpinfo() and tried to access the page the PHP script was not executed instead of that I saw the PHP code in the browser. After couple of days I stopped the Apache web server and restarted and then I couldn't start it and got the following errors.





First error (marked in red) is due to the lack of file php5apache2_2.dll in the Apache2.2 directory. I copied this file from PHP installation directory to Apache installation directory. I tried to start Apache with httpd. I got the second error.



Second error (marked in purple) is due to lack of path in the Apache configuration file httpd.conf (localted in conf directory of Apache installation folder). I updated the path by giving correct PHP installation location for variable 'PHPIniDir' in httpd.conf file. I am able to start the Apache successfully. I accessed index.php and I can see the page!

Wednesday, 22 February 2012

Preserving special characters - Java I/O

I was assigned a bug where a standalone Java programme is writing some content to XML files. The content has few special characters (eg: vulgar fraction one fourth) and during write process the special characters are lost. The end XML file has question marks ('?') in the place of special characters. I suspected that this problem might be related to encoding. After reading a bit more about Java I/O and encoding I found a solution.

1. First I found out the default encoding used by JRE while writing to XML files by using the following code:

OutputStreamWriter out = new OutputStreamWriter(new ByteArrayOutputStream());
System.out.println(out.getEncoding());

The output in my case is 'ASCII', then I established the fact that the encoding is ASCII and doesn't support unicode characters.

2. Here is my old code which uses default encoding.

BufferedWriter out = null;
out = new BufferedWriter(new FileWriter(filename, true));

3. Here is important part where we can specify the encoding we need, in my case its UTF-8. The following code specifies the required encoding when writing files.

Writer out = null;
FileOutputStream fos = new FileOutputStream(filename, true);
out = new OutputStreamWriter(fos, "UTF8");

out.write(buffer.toString());

out.close();

Bingo! After the changes the special characters are properly displayed in the xml.

Wednesday, 1 February 2012

IBM 833 Cleared - Object Oriented Analysis

I wanted to complete IBM Certified Solution Designer (OOAD/UML) certification ever since I came to know about it. The certification contents are very useful and can be applicable to any programming language. The main focus is on Analysis and Design in RUP way. I always believe that solving a problem is a two step process. First we need to fully understand the problem beyond doubt. Second we need to design a solution which shall attack the root of the problem and implement/fix it for good. This certification achieves that or at least gives guidance on that.

I did coding for almost 8 years in Java, and I thought it's the time to move to upper step by focusing on designing. How to shine in software design? By learning to design. As I am lazy and do not want to get my hands dirty without any aim or goal, I am doing this certification to improve my design skills. I also learned very good points on Architecture and it's implications, impact on design etc. There is simply too much valuable stuff which I do not know!

So, I cleared IBM 833 (part 1 analysis) with 86%. I am preparing for IBM 834 (part 2 design). The certification objectives also focuses on RUP and Iterative development which is useful for developers who are potential Project Leaders.

Thursday, 5 January 2012

New Year - 2012

One year gone in life! Exactly after one year on the same day (5th Jan, 2011) I started blogging and I kept my blog for an year :) The year 2011 showed the fear of loosing job. Though I didn't loose my job, I was almost on the edge of it. People saying the world is going to end in 2012, despite of the trouble times 2011 gave, I should say I started this year with confidence, motivation to achieve something. I decided to complete IBM 833 and 834 as a first step to my Solution Architect dream. I am doing good spiritually and prayed to God to give better 2012. Also thinking of H1B this year or next year, but will have to see how it goes. I also want to brush up my Spring, Hibernate stuff and SQL for any potential job openings along with my designing skills.

Briefely, things I've done in 2011 in random order:

1. Changed 2 jobs, currently in 2nd job. This 2nd job also quite boring. Just a system which takes big xmls and parses and dump data in db. Thats it. No exciting stuff.

2. Visited universal studios in Singapore. Nice experience and good one. My kid enjoyed it! We loved the new transformers ride especially.

3. Worked on couple of Spring, Hibernate projects, got to know Spring and its power.

4. Quit smoking many times, still struggling with cravings for cigaratte.

5. Learned car driving and stopped in the middle due to $ problem!

6. Attended few birthday parties and gained few kilos of weight.

7. Joined gym and did some workout.

8. Received relatives at Singapore airport, escorted them to sight seeing places, took care of their kids. Did heavy weight lifting with their luggage (few hundred kilos).

9. Visited piligrams in India. Nice trip though some glitches.

10. Got angry on my kid and wife few times, trying to control anger when my kid does funny things.

11. Watched many many movies, and looking forward to watch more in 2012.

12. Played Modern Warfare 2 and Modern Warfare 3 fully, and playing them again!

13. Bought DSLR camera and iPad2. Thanks to iPad 2 my son got addicted to it :(

14. Just writing one more point, as I consider 13 as bad luck number.

Ah, movies, the best thing I enjoyed in 2011 are movies. I watched each and every movie released in Singapore during last year. Also copied around 800 movies from colleague into my 1TB HDD and watched. The tears of the sun became one of the best movies. After watching that movie I regretted for not becoming commando.

I also enjoy war games and became fan of Modern Warfare series. I always likes stealth missions and sniper guns. I want to explore some other games like Portal, Mirror's Edge etc.