6

On Boosting My IDE(A) – Jetbrains IntelliJ IDEA is fast again

Posted by Michael Hunger on Aug 7, 2008 in development, java

Performance Problems
After struggling for some time with the performance problems with recent IDEA versions on my clients workstations, I’ve finally found a solution. After upgrading from version five the performance of IDEA began to degrade.
I had many hangs and a general sluggish feel.
Read more…

Tags:

 
0

On Finding The Anykey

Posted by Michael Hunger on Aug 4, 2008 in development, fun

Finally I’ve found it: The mysterious “Anykey” is living under the strange name of “QuickFix” in your IDE of choice.
a black key with an Any imprint
Pressing Alt+Enter (Cmd+Enter) in Intellij IDEA or Ctrl+1 in Eclipse enables you to program on a “per example” basis. You can do

introduction of variables, fields, classes,
renaming
changing method signatures
completing structure
surrounding code with live template
importing dependencies
and much more …

IntelliJ IDEA QuickFix example

and much more just by pressing the “AnyKey” at any offending piece of code. Especially the ton (600+) of intentions of IDEA fixes almost each possible syntax problem using a single key.

Kent Beck used the AnyKey (QuickFix) when describing the Refactoring By Example.

You can find further keystroke reference cards in the help menus of your IDE.

DZone made up a nice collection of refcardz:
IntelliJ IDEA DZone Refcard
NetBeans 6.1 Refcard

Tags:

 
68

On LEGO Powered Time-Tracking; My Daily Column

Posted by Michael Hunger on Aug 1, 2008 in development, fun, lego

I’ve had troubles with time tracking my worktime for all the years. I always found this to be a tedious burden and inconvenience. So one morning in my blue hour (reading in a cafe before work) I spent the time pondering the alternatives.

I started listing software and realworld solutions to timetracking that are possible and tried to contemplate if they would (or had) worked out for me.
Read more…

Tags:

 
0

On “The Productive Programmer” by Neal Ford

Posted by Michael Hunger on Jul 28, 2008 in code, development

I’ve been reading Neal’s blog for a while. So I’ve been looking forward to the book. (I even accidentally ordered it twice – one was the pre-buy at amazon, which I forgot about).

I spend the last two days reading the book and found it quite helpful. There are a lot of concrete tips and examples for immediate use and daily improvement of your mechanic skills. Many of the experiences regarding the effective use of the tools at hand that he describes are well known to me. I can’t really understand how developers are not keen to improve their productivity.
Neal’s book is a good addition to the PragProgs masterpiece. It concentrates more on the mechanics and on some principles of productive software development. So the triad of values-principles-patterns got a son named mechanics.

What I missed in the book was:

  • a comprehensive list of the notes at the end.
  • Christopher Alexanders appearance as one of the philosophers.
  • the notion of cheat sheets/refcards
  • references to Martin Odersky’s Scala the scalable language
  • references to Kent Becks “Implementation Patterns” (especially in the SLAP section)

As being a developer myself I was a bit disappointed by the quality of the examples (the solutions not the starting points) and a bit by the correctness of the text (typos). I spotted several errors, some bad designs and some uninformed choices even on the first read of the book. I’ll post them to the errata page.

Neals suggestion of an online repository at productiveprogrammer.com of productive programmers tools, tips and mechanics is a great idea. I’d really like to join this effort.

Tags:

 
0

On Queuing, Security, Routing and Traveling after QCon 2008 London

Posted by Michael Hunger on Mar 16, 2008 in conference, fail, traveling

Sitting a mere 200 km from home, 7 hours late by now and hopefully there at dawn, I’ll try to recapture the events of this day.
After the last day of the exciting QCon week ended on Friday, I used the time on Saturday morning to buy some family gifts in Covent Garden. Taking the Gatwick Express from Victoria, I arrived about one and half hour before my flight was scheduled to leave. Checking in at the check-in computer was no problem at all. The second step in the procedure was to proceed to the Fast Bag Drop. I looked around but could only see hundreds of people queuing at “Bag Drops” on both sides of the terminal hall. A staff of 6 was handling the large amounts of luggage the people wanted to drop quickly. So the obvious approach was to put all passengers of all departing flights together in a waiting queue and handle them with the same priority. Great idea. After waiting too long, there was a staff member yelling for passengers to Pisa. My flight was scheduled before the one to Pisa, it had about three quarters of a hour to liftoff. I asked her for assistance, she told me that the boarding for the BA flights is done a 3/4 hour before liftoff. Although she tried to phone her way through – no chance. So I had waited all the time in vain and missed my flight. I promised myself never to take any luggage except hand luggage on the next one-week trip.
I was directed to the ticket sales counter for assistance. As this was the only direct flight to Dresden for the day, I had to be rerouted. So she typed all the possible combinations she could think of into her terminal – is there no software for calculating routes? I suggested routing to Berlin and to travel home from there by train. As they don’t have internet access at the ticket counter, I was sent to the shopping area to look up the train connections myself. Unfortunately, the last train to Dresden leaves Berlin (capital city!) at 9 pm, thank you Deutsche Bahn.
The alternative routes were: getting from Gatwick to Heathrow and flying there directly to Berlin, arriving at 10:15 pm, or flying from Gatwick via Zurich to Berlin and arriving at 9:45 pm. As she didn’t want me to be queued again I was directed to a “special care” express counter. For the first time ever, my bagpack was not manageable by the luggage transport system (because of the straps). So I had to declare it as oversized luggage, which took only another fifteen minutes as the poor woman before me had some problems with the guy at the luggage counter.
Next was security. The usual taking cosmetics bottles from women stuff was even topped this time. After the regular security checks we’re all used to, there is an additional x-ray scan of your shoes at Gatwick. So all passengers took off their shoes to have them x-rayed. I don’t know what they expect to find in there except terrible smells. You could have taken everything from the shoes when crossing the distance between the two security checkpoints.
Just before boarding I called my wife who was desperately expecting my return as being ill and pregnant herself, she had to take care of our ill little daughter for the entire conference week. She told me that the public transport staff in Berlin was on strike. Fine.
The flight to Zurich had only a one-hour delay, so nothing special. The only funny thing was the woman next to me doing some brain exercise on her Nintendo DS and cursing all the time. Getting the boarding card in Zurich was also no problem. When walking to the Gate of the Lufthansa flight, a friendly gentleman redirected all people to another exit. “It’s shorter and nicer that way.” I was quite suspicious. The solution to that weird behaviour was that Swiss airports do security checks even on transit passengers. But no shoe scanning this time. And no one took my MacBook Air to be a “device”, as Michael Nygard had experienced in the US.
So arriving in Berlin, I took the fortunately still operating bus shuttle from Tegel Airport and managed to get via the cold and closed-down main station to the east-station where I’m now sitting at McDonalds(R) “McCafe(R)” waiting for my train to depart in about 3,5 hours time.

Update: The train from Berlin was half an hour late, this was some official rescheduling but neither the information screens nor the ticket machine knew of this. Another problem was the train having been in the station over night with heating switched off and doors open, so it was cooled down to a very low temperature and the heating could not catch up. This caused me to add another layer of clothing to be able to sleep within the train. When I arrived in Dresden it rained, no surprise there.

Lessons learned:
* arrive 3 hours before departure at the airport
* travel light with hand luggage only
* don’t expect airlines being able to understand queuing theory and staff capacity
* clean your shoes for security scan
* don’t trust Swiss when they speak of shortcuts
* forget about returning home on time when you’re needed most

Tags:

 
0

On Toys @ QCon London 2008

Posted by Michael Hunger on Mar 13, 2008 in conference, fun

Its very funny how many guys are interested in your laptop if its a MacBook Air. I actually spotted only one other at the SpringSource Booth. At Monday I got awarded the Canadian maple leaf tag by Kirk Pepperdine, who forced me during the next days on several occassions to show off :)

The benefit was that a lot of people got the chance to actually hold in in their hands and have a closer look at the slick thing. And yes I’m a proud big child showing around my latest toy. I expect the situation to change until JAOO 2008, we’ll see.

Tags:

 
0

On RESTful programming @ QCon London 2008

Posted by Michael Hunger on Mar 13, 2008 in code, conference

As the Haskell session with Lennart Augustsson was unfortunately canceled, Mathias and I decided to attend the Architectural Implications of RESTful design talk by Peter Rodgers of 1060research. It was very insightful.

The basic principles of the talk were:
1) all resources are named by an URI
2) resources are immutable and copied
3) you can construct arbitrary URI which present a computation and use other URIs as parameters
(e.g. active:imageOperation+operation@fllcc:/doc/rotate45.xml+image@http://imageurl)

With these precodition Peter showed a kind of functional programming approach. You just write (or have tools write) your programm (function, expression) as a cascade of URIs.

It was a real eye-opener, just like in a functional programming languages your functions don’t have sideeffects and therefore an URI presenting an expression is always referrring to the same value (as long as the resources used are really immutable, one may propagate changes). So it is very easy to cache them based on usage count and expensiveness of computation. Even with a very limited dynamic cache this kind of program runs faster that the traditional imperative one which is recomputed over and over.

Another advantage is that you address cross cutting concerns by partitioning the address space of the URIs and putting zones around them which contain the aspects (AOP, e.g. security, transactions).

So with a very simple approach and a powerful runtime used for routing, caching and executing or retrieving the resources pointed to by the URIs – NetKernel it’s another tool in our polyglot language toolbelt.

Tags:

 
0

On Agile Mashups @ QCon 2008

Posted by Michael Hunger on Mar 13, 2008 in agile, conference

So I attended another agile session on the mashup of agile methodologies. Unfortunately it turned out to be just a basic introduction of the different agile practices. The real mashup of practices regardless of the borders of the methodologies I expected was not presented by Rachel. I.e. something like Kents XP graphs depicting which practices (and principles) depend on each other and which have positive impact when used together, etc.

In my opinion the Agile Coach should be responsible for knowing all the agile practices, introducing the relevant ones to the team, helping them using and evaluating and improving their use of the practices and enable them as a self-empowered team to decide what works best for them. The coach also bears the responsbility of keeping the use of practices consistent i.e. having the team use an increasing part of the “pattern language”.

Tags:

 
0

On Fearless Change – Tutorial @ QCon London 2008

Posted by Michael Hunger on Mar 12, 2008 in Uncategorized

This year’s qcon I decided to attend no technical tutorials but more development process oriented ones – i.e. Agile.

On Monday I was delighted to attend Lindas tutorial. It had a very personal touch, was very interactive. She presented the patterns for introducing new ideas into organizations using a play with us participants as actors. Actually this was the story of herself introducing Design Patterns back in 1996. During the discussion many of the subtleties of the patterns (i.e context and forces) were addressed. Having us contributing by playing and asking lots of questions helped a lot to really absorb the essence of the patterns. It was a lot of fun.

The introduction of the pattern concept (reference to Christopher Alexander and his great book which i recently finished rereading was also very engaging).

One of the most important points she made during the tutorial was, that these patterns for changing the attitude of people can be used and misused to introduce ideas regardless of their moral value. So they are very powerful.

And the tutorial helped to solve real problems. In the First Aid Clinic part we used the stuff just learned to give three of us advice how to approach difficult situations they currently have at work.

Most of the patterns of change are deeply rooted in human behaviour. So all the knowledge that was gathered by brain scientists back all the patterns rediscovered. After the tutorial we stayed for a while to further discuss some of these things.

Linda is a great speaker with deep understanding and lots of wisdom to share. Thanks a lot for the tutorial.

Books recommended at the tutorial:
Fearless Change
A Timeless Way of Building
Predictably Irrational: The Hidden Forces That Shape Our Decisions
The Tipping Point
Gang of Four – Design Patterns
Patterns of Software Architecture (1,4,5)

 
0

On Closures in Java

Posted by Michael Hunger on Dec 3, 2007 in Uncategorized

While reviewing Martin Fowlers upcoming DSL book I started thinking (again) about closures in Java and the current overly verbose syntax for Single Abstract Method Interfaces. And then there was the blog entry of Anders NorĂ¥s about Deferred Execution and Kicker Methods, both relaying to the DSL stuff I just read.

So starting with a SAM closure.

new Closure() {
    public Integer eval() {
       return input.length();
    }
}
closure.eval();

So I thought about the Java Instance Initializer Block, which is executed before the constructor is called.

class A {
{
   initializer code;
}
... constructor and class body ...
}

So, combining the Anonymous inner class with the initializer Block gave me.

new Closure() {{
     result=input.length();
}}
closure.result

the problem is that the code there is evaluated when defining the class and creating the anonymous instance, so there is no deferring possible.

Using a SuperClass for the closure which basically does this.

class Closure {
    public R eval() {
        return newInstance().result;
    }
    private Closure newInstance() {
        try {
            final Constructor syntheticConstructor = getClass().getDeclaredConstructors()[0];
            return (Closure) syntheticConstructor.newInstance(createParams());
        } catch (Exception e) {
            throw new RuntimeException("Error creating new instance of closure", e);
        }
    private Object[] createParams() throws IllegalAccessException {
        final Field[] fields = getClass().getDeclaredFields();
        final int fieldCount = fields.length;
        final Object[] params = new Object[fieldCount];
        params[0] = fields[fieldCount - 1].get(this); // enclosing Instance comes last
        for (int i = fieldCount - 2; i >= 0; i--) {
            params[i + 1] = fields[i].get(this);
        }
        return params;
    }
    }
}

I didn’t think so but it is possible to create additonal new Instances of Anonymous Inner Classes, you just have to watch for the synthetic constructor and the reference to the enclosing class. If you don’t use constructor parameters to pass into the closure, you’ll have to support all the referenced final outer variables, so passing parameter is certainly more useful.

so the result is:

new Closure() {{
     result=input.length();
}}
assertEquals(10,closure.eval());

to reduce noise one can skip the generics and cast the types accordingly.

non final input data can be done be creating a constructor in the closure which takes vararg arguments of declared generic types and
keeps them in protected final fields for reuse in the expression block;
The remaining problem is that one has to use non primitive Objects as integrated final local variables.

I put the complete code on my website.

Copyright © 2007-2012 Better Software Development All rights reserved.
Multi v1.4.5 a child of the Desk Mess Mirrored v1.4.6 theme from BuyNowShop.com.