General

The three qualities of a successful manager

Recently a project manager I know requested me for a performance feedback. I have read a couple of books, articles, worked under different managers, have about 5+ years of experience in the field and I started to think back on all this material to answer the question, what makes a good project manager? Who were the project mangers that I was always eager to work for and more importantly why?

As I started to think about this, there were three recurring themes that I noticed in all the people I liked to work for.

  1. Being a good person
  2. Being Competent
  3. Willingness to learn, and dive into the depths of any given problem

1. Being a good person

Think about this for a min, who are the people that you are most willing to work for?

  • Cranky
  • Taking you always for granted
  • Never hear a word of praise from them
  • Never willing to help you or anyone
  • Unwilling to ever hear what you have to say
  • Stubborn, my way or the high way attitude types
  • Leave you to slug it out while they are at out on vacation

If you have a choice will you be willing to work under such type? If your lead has the above qualities will you be giving 100% to the success of that project?

2. Being Competent

In order to be a lead, it is not just enough to be a good programmer; in fact that is just a starting point. I do not believe that leaders are born, they are made, one needs to train himself to become one and there is a ton of material to do this (books, articles, blogs ….) and learning from others, having a mentor definitely helps.

I have worked under managers, who were excellent programmers, they could hack out sed and awk in there sleep! But when it came to time management or managing direct reports, they were just down right terrible. If you can?t manage your own time, how can you manager someone else?s time?

3. Willingness to learn, and dive into the depths of any given problem

How can one lead if they can?t solve anything? And how do you solve anything if you are not willing to learn what it is? I find these types really annoying, types that are never willing to listen. They never get a good feel about what is going on and you end up going to multiple statuses meeting and creating numerous reports. And these are the types who will freak out about the tiniest problems.

Unfortunately you cannot recognize a good one until you have worked for a bad one! When you work for a good manager things are a breeze, you very rarely end up working on a weekend, things just seem to click and fall in place and you feel good about your project.

Anyways, I think I can rate the PM based on the above 3 qualities

General, Tech

Reading and Writing Java Property Files With Ruby

Created a simple Class in ruby to help reading and writing property files

class JavaProps
attr :file, :properties

#Takes a file and loads the properties in that file
def initialize file
@file = file
@properties = {}
IO.foreach(file) do |line|
@properties[$1.strip] = $2 if line =~ /([^=]*)=(.*)\/\/(.*)/ || line =~ /([^=]*)=(.*)/
end
end

#Helpfull to string
def to_s
output = “File Name
#{@file} \n”
@properties.each {|key,value| output += ” #{key}= #{value} \n” }
output
end

#Write a property
def write_property (key,value)
@properties[key] = value
end

#Save the properties back to file
def save
file = File.new(@file,”w+”)
@properties.each {|key,value| file.puts “#{key}=#{value}\n” }
end

end

General, Tech

Books I want to read in the next 6 months

General, Tech

Use of Fit Test to cover Use Cases and Scenarios

We have been using fit tests in my organization for some time now, I think fit test can sometimes be indispensable ,

We were designing an internal accounting system, we had a lot of complex use cases, and a lot of different scenarios. We needed repeatable tests that would test all the scenarios whenever we add new code. We also needed documentation that could explain the system flow, enter FIT tests,

We designed and developed fit tests that could reset the datbase and run a fit test and cover all the use cases, take a look at the following FIT TEST ( sorry I had to name it .html.css , else Jroller would not allow me to upload).

When you read the fit test it is almost like reading documentation, with Red and Green colors in the tables. Apart for a way to show the users how the system meets the requirements , it is also a great way to show someone new how the system flow works.

Tech

Dabbling with Ruby

Started dabbling with Ruby this weekend, after a colleague introduced me to it,

I am amazed at some of the features in Ruby.

It was easy to start off, just used the one click windows installer,

then installed the eclipse RDT and I was up and running.

My fist stab at it was, to use it to output every month start andend date

between 2 given dates

## Returns The number Of Days in a month

def numOfDaysInMonth(date)

if(date.strftime(“%m”)==”02″)

if(date.leap?)

return 29

else

return 28

end

else

monthDaysMap = {“01″=>31,”03″=>31,”04″=>30,”05″=>31,”06″=>30,”07″=>31,”08″=>31,

“09”=>30,”10″=>31,”11″=>30,”12″=>31}

return monthDaysMap[date.strftime(“%m”)]

end

end

# Yields Each Month(start and end Date) between 2 given dates

def eachMonth(startDate,endDate)

while(startDate < endDate)

newDate = startDate+(numOfDaysInMonth(startDate)-1)

yield(startDate,newDate)

startDate = newDate + 1

end

end

And the next was to print start and end date of each year in 2 given dates

# Returns the number of Days in a year

def numOfDaysInYear(date)

if(date.leap?)

return 366

else

return 365

end

end

#Yields each year (start and end date) between 2 given dates

def eachYear(startDate,endDate)

while(startDate < endDate)

newDate = startDate+(numOfDaysInYear(startDate)-1)

yield(startDate,newDate)

startDate = newDate + 1

end

end

and some tests

eachMonth(Date.new(2000,01,01),Date.new(2005,01,01)){|startDate,endDate|

puts startDate.to_s()+” “+endDate.to_s()

}

eachYear(Date.new(2000,01,01),Date.new(2005,01,01)){|startDate,endDate|

puts startDate.to_s()+” “+endDate.to_s()

}

The output

2005-01-01 2005-01-31

2005-02-01 2005-02-28

2005-03-01 2005-03-31

2005-04-01 2005-04-30

2005-05-01 2005-05-31

2005-06-01 2005-06-30

2005-07-01 2005-07-31

2005-08-01 2005-08-31

2005-09-01 2005-09-30

2005-10-01 2005-10-31

2005-11-01 2005-11-30

2005-12-01 2005-12-31

2000-01-01 2000-12-31

2001-01-01 2001-12-31

2002-01-01 2002-12-31

2003-01-01 2003-12-31

2004-01-01 2004-12-31

Tech

Spring 1.2 Java 5 Based Transaction Annotations

Colin Sampaleanu posted an excellent article on Spring 1.2’s Java 5 Based Transaction Annotations, if you want to follow this approach but don?t want the DefaultAdvisorAutoProxyCreator to pick up every available Advisor in the context, here what you can do

<bean name=”defaultAdvisor”
class=”org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator”>
<property name=”usePrefix” value=”true”/>
</bean>
<bean name=”defaultAdvisor.transactionAttributeSourceAdvisor”
class=”org.springframework.transaction.interceptor.TransactionAttributeSourceAdvisor”>
<property name=”transactionInterceptor” ref=”transactionInterceptor”/>
</bean>
<bean id=”transactionInterceptor”
class=”org.springframework.transaction.interceptor.TransactionInterceptor”>
<property name=”transactionManager” ref=”transactionManager”/>
<property name=”transactionAttributeSource”>
<bean
class=”org.springframework.transaction.annotation.AnnotationTransactionAttributeSource”/>
</property>
</bean>

Create you DefaultAdvisorAutoProxyCreator as mentioned but give it a name (defaultAdvisor in this case) and set the usePrefix property to true.

Then in all the advisors that you want to be picked up, change there name to have ‘defaultAdvisor.’ prefix.

The usePrefix property tells the DefaultAdvisorAutoProxyCreator to apply only those Advisors that have a prefix of its own name.

Alternatively you can also use the AdvisorBeanNamePrefix to tell the DefaultAdvisorAutoProxyCreator what prefix to consider.

Tech

Hibernate

Found an interesting feature of hibernate that I wanted to share. The problem is I wanted an instance of one of the subclass and not a proxy.

When you define a mapping for an object like say

<class name=”SomeClass”>

<many-to-one name=“account” column=“ACCOUNT_ID” not-null=“false” cascade=“all”/>

</class>

And if Account Class itself can have subclasses

<class name=“asrs.core.account.model.Account” table=“ACCOUNTS” discriminator-value=“null”>

<subclass name=“asrs.core.account.model.PersonAccount” discriminator-value=“PERS”>

<subclass name=“asrs.core.account.model.EmployerAccount” discriminator-value=“ER”>

</class>

When you get an instance of MyClass from hibernate, the under lying account MAY BE an instance of Hibernate generated subclass of account in other words a proxy that delegates all method invocations to a different instance and the type will not be one of the concrete class (i.e PersonAccount or EmployerAccount) but of type Account.

This may not be necessarily a bad thing, but in my situation, I needed a concrete sub class of Account.

To overcome this problem the solution is when you define your mapping do the following

<many-to-one name=“account” column=“ACCOUNT_ID” not-null=“false” cascade=“all” outer-join=“true”/>

Setting outer-join to true, cause hibernate to fetch eagerly even if proxying is enabled (lazy =true)

Uncategorized

Too Many Properties: Is there such a thing?

One of the batch applications that we have uses a properties file for getting configuration parameters. This file which started so innocently with just a couple of properties, like the throttle, the logging level and so on, through the years (4 to be precise) has now grown into 30 + rules gigantic file.  Which leads me to ask, Too Many Properties: Is there such a thing?

 

Part of the problem is it is so easy to add something to it, there is already a piece of code that handles all the reading and loading of the properties checks to see if everything is set, so when someone has to add a new configuration like where the bindings files is or what is the name of a queue is, it is so easy to add to the already present file.

 

At what point do you start using a table in the database, 50? 100?  Or like the question How many licks does it take to get to the center of a tootsie roll? will never know ?

General, Tech

Java Certification

I finally completed my Java Programmer Certification last week. I highly recommend “Sun Certified Programmer & Developer for Java 2 Study Guide- Kathy Sierra, Bert Bates“, ISBN 0072226846. It is actually a fun book to read, and covers all the topics.

I also, recommend to http://www.jchq.net/, maintained by Marcus Green, he has an exam simulator on his site (http://www.jchq.net/phezam/login.php), what you get on the actual exam will be very close to what you get in this simulator (In my case I got higher in the actual exam 🙂 no complaints there).

And you should also shoot some rounds at Java Ranch Rule Round up game http://www.javaranch.com/roundup.jsp