Stuff about software development, agile and testing
Thursday, December 13, 2007
scala book is out
Thursday, November 29, 2007
jruby closure decompiled
private static ByteList __18 = ByteList.create("in closure");
.....
.....
public IRubyObject closure0(ThreadContext threadcontext, IRubyObject irubyobject, IRubyObject airubyobject[])
{
Ruby ruby;
IRubyObject irubyobject1 = (ruby = threadcontext.getRuntime()).getNil();
DynamicScope dynamicscope = threadcontext.getCurrentScope();
IRubyObject _tmp = irubyobject1;
do
{
try
{
threadcontext.setPosition(__15);
return _17.call(threadcontext, irubyobject, RuntimeHelpers.constructObjectArray(ruby.newStringShared(__18)));
}
catch(org.jruby.exceptions.JumpException.RedoJump _ex) { }
} while(true);
}
RedoJump exception is used to simulate ruby redo
Tuesday, November 27, 2007
inpsect gem file
Here is a small script to inspect any gem file
require 'yaml'
require 'rubygems/source_info_cache'
Gem::SourceInfoCache.cache
spec = Gem::SourceInfoCache.search('#{gem}')
p spec.to_yaml
You could also use Gem::SourceIndex to spec out locally installed gems
Sunday, November 11, 2007
Tuesday, October 23, 2007
hudson rules
We use Anthill Pro for our continuous integration build and it has all the bells and whistles you expect from big CI tool these days. But Hudson has only those basic things that you need to setup a continuous build environment. I was able to setup within 15 mins using my existing ant build file. Now when I compare with other tools they seemed to be over-engineered and difficult to setup and use(Let me know if I am wrong). Did I mention it has some cool plugins.
Wednesday, September 12, 2007
ejb 3
Friday, September 7, 2007
xml bites again
I haven't and just because 90% of java work is j2ee stuff they are tied to it in spite of the dislike. If you have noko niko calendar of your team all you will see is :( . Apparently it took 1 day for me to integrate one external ejb with our module. I don't consider myself a j2ee expert but honestly how good are collection of xml configurations when every time you change something you have to redeploy. All I want is to compile and run my tests, is it too much to ask? . If you have a big project like us then you are screwed because every XML change requires jaring, redeploy and restart of your application. Its quite a big cycle when you have no compiler watching for your deployment descriptor errors. I am not sure whether Websphere application developer or Weblogic workshop have any sophisticated logic to validate your DD's before even deploying it.
Anyways do we really need all these descriptors to deploy some manage beans? Introspection and clever defaults could solve all the problem and it doesn't need a CS degree to figure that out, maybe some practical experience.
Honestly have anyone used any 3rd party ejb components or followed all the j2ee roles? If Java at all wants to make a component market a reality make it easy for developers.
Thursday, September 6, 2007
Fluent Interface
Especially if you are building web application you leave the UI part out of the test unless you integrate your UI test tool like selenium with fitnesse but you still miss the readability for tabular test structures. When we get story in BDD(Behaviour driven development) format and acceptance criteria in Given-Then-When style I expect to see my test in following pattern.
"Given products exists when I search product by name then user expect to see all matching products" do
test "goto product page and search for product code '100'
now number of matching products found is '10' "
end
Doing something like this Ruby is possible and in fact Dust is doing something very similar. But achieving something like this in Java is a challenge. Fluent Interface is one of the easiest way to do achieve DSL like look in Java and its quite easy to implement too. Lets consider the following selenium unit test
public void testGivenProductsExistsWhenISearchProductByNameThenUserExpectToSeeAllMatchingProducts() {
goToProductPage().andSearchForProductCode("100);
assertThat(now().numberOfMatchingProductsFoundIs("10"));
}
Its not cool as ruby DSL's but its close and quite readable. Some of our test now looks like this and rest of the team loves it.
Sunday, August 26, 2007
Five different ways to test equality
equal? returns true if receiver and the parameter object have same object_id. Object ids are unique and its not shared among the objects. This method should not be overridden
== returns true if the receiver and parameter object has same values. This is most intuitive and should be overridden in your sub-classes
eq? Like == it compares objects but is more strict about type. Only reason this exists is to compare Hash keys
=== This is used for Switch Case statement. It compares target in case statement with each selectors. You can override it to control the way case statements are matched inside the switch block
=~ Pattern matching (Side note: In Erlang = does the pattern matching)
== and =~ does have a negated version and since ruby is a great language if you implement == you != for free, isn't that great.
Next time when you have to equate objects you know which one to use
Tuesday, August 21, 2007
Ruby open classes
One of the thing that Java programmers should get over is you cannot know a class in Ruby completely. In Java we could say that I know the String class, I know how many methods are there and what are those methods etc but in the world of open classes you never know. There is no replacement of communications, in ruby world its more important talk about your work with other teammates and unit testing of course.
Tuesday, August 14, 2007
netbeans ruby support
If you are used to eclipse or intellij, you know how hard is to live without auto-completion, debugging and refactoring. Textmate is cool and simple but netbeans ruby support is probably best right now. It actually uses string pattern matching to list out all the options and its pretty fast. To download ruby only version go to link
Friday, July 20, 2007
eval vs define_method
Please remember "with more power comes more responsibility".
define_method is much cleaner way of defining methods in meta world and gives much more readability.
Tuesday, July 17, 2007
Starbucks does not use two-phase commit
Based on my previous experience I could say that messaging solutions is not straightforward to implement especially if you haven't done it before. Its a exotic world of xml messages, its has its own patterns and challenges.
Friday, July 13, 2007
Software rewrite and big bang theory
Managing multiple version of any product is tough and intricate and if the product is poorly written, you have a mess in your hand. Refactor or rewrite is a debate we participate in all the time. Let’s not go into that again right now. Let’s pretend that we have decided to rewrite our product….hoooray. But rewriting the whole product in a one bang is not only ill-advised but a project doomed to be failure.
So what should we do then? Take small steps. If you have a big, unmanageable product in your hand, figure out the core/important services/components that need to be rewritten (maybe in different technology). Integrate those components with your existing product as soon as possible and release it. If you have many existing clients, releasing quite often could be an issue. Maybe hosting your new solution as a service (SaaS) with data centers might solve that problem. This could also be very lucrative to customers because they don’t have worry about any infrastructure/administration issues any more. This might cost you more money but you know what! you will always have a working software.
Sometimes you cannot avoid having multiple version of same product, especially when you are transitioning from old messing mud ball architecture to something more manageable. But rewriting in one big bang is an illusion which results in a 200 member team project with no end date (I am serious).
Tuesday, July 10, 2007
Duck Typing
...Don't check whether it IS-a duck: check whether it QUACKS-like-a duck, WALKS-like-a duck, etc, etc, depending on exactly what subset of duck-like behaviour you need...
Its funny how we advocate the same thing in Java in spite of being statically typed , when we talk about programming to interface not to implementation. As long as it QUACKS, WALKS like a duck, we shouldn't care about its type.
Sunday, July 8, 2007
To do list
Now I need to out-source all my tasks :)
Thursday, June 28, 2007
Web UI prototyping
Let me guess,
- we don't know what color code you are using?
- no html code to start with?
- fonts, borders other style sheet properties are up for interpretations
- and any more...
I think its very important to see that developers get a cleanly built static html page to start with. So that they can plug-in their dynamic parts to it.
Wednesday, June 27, 2007
Ever wondered how virtualization works
Check out this video. Its really cool
http://channel9.msdn.com/showpost.aspx?postid=163022
Ritual vs Standups
I feel like ritual when I attend the meeting every morning. I could feel very subtle differences between this type Standups and Status meeting. The bigger and better benefit of it is to have a shared commitment across the team and to get a positive feeling. If some pair is having a problem it becomes teams problem and the whole team should try to solve it.
Unfortunately umpteen times it remains as status meeting. I believe we should be proactive enough to say NO to such meetings because if it is just about status we have card wall.
I am working on how to make my team more insightful and proactive about standups rather than just one morning ritual.
Tuesday, June 26, 2007
Conway's Law
Any piece of software reflects the organizational structure that produced it.The reality is, it doesn't matter what methodology you are using to develop your software, without communication and organizational overhead, its a ship sailing nowhere.
Labels
- agile (4)
- agile testing (1)
- build tool (1)
- design (1)
- DSL (1)
- duck typing (1)
- eclipse (1)
- ejb3 (1)
- Fluent Interface (1)
- grails groovy (1)
- groovy (1)
- gwt (1)
- hacking (1)
- haskell (1)
- java (1)
- javascript (1)
- jvm (1)
- languages (1)
- mac (1)
- pipes (1)
- programming (1)
- qa (1)
- rant (2)
- ruby (6)
- sas (1)
- scala (3)
- scripting (2)
- software rewrite (1)
- statically typed (1)
- testing (4)
- two phase commit (1)