Posts tagged ‘Programming’

September 22, 2012

Eclipse Task Tags Meaning

by Jay Jonas

TODO, along with FIXME and XXX, is known in Eclipse as a task tag, and is indexed by the IDE to let you find the spots marked with those tags easily. You can edit such tags in the Eclipse Preferences -> Java -> Compiler -> Task Tags.

This is the list for default Eclipse Task Tags and their meaning:


Comments that mark something for later work, later revision or at least later reconsideration. ODO comments should be considered a very useful technique, although like all good things on Earth, there’s certainly potential for abuse.


A standard put in comments near a piece of code that is broken and needs work.


A marker that attention is needed. Commonly used in program comments to indicate areas that are kluged up or need to be. Some hackers like `XXX’ to the notional heavy-porn movie rating. Use it to flag something that is bogus but works. Use FIXME to flag something that is bogus and broken.

ZZZ   /* This tag is mine!  ; ) */

Sometimes I like to use this marker for a stuff that was commented as deprecated just to remind me what happened there. However, when I’m sure, I delete it along with the code.

// TODO Need to optimize this before the end of the world.
// FIXME This won't work if the programmer is missing. 
// XXX This method badly needs refactoring: should be decaffeinated.
// ZZZ This was useful before the Y2K Millennium Bug.

From Sun/Oracle's Java code conventions, section 10.5.4:

July 17, 2011

Eclipse API baseline warning

by Jay Jonas

In case you encounter the warning “An API baseline has not been set for the current workspace” you can disable this type of warning.

Eclipse Problems View

In order to solve this, you go to your Eclipse Preferences and then select Plug-In Development/API baselines.
Here you can set an API baseline or set missing API baseline to Ignore.
An API baseline defines an eclipse API against which your code is compared and checked for compatibility.
To se an API base line, click on Add Baseline… and in New API Baseline dialog select the path to eclipse installation you intend to use as your baseline.

Rebuild the project afterwards.




January 14, 2011

Dishonest Programming

by Jay Jonas

David Brady, from Javalobby News, their weekly newsletter, wrote a interesting article about Dishonest Programming. I took this excerpt, wrote it down and put it on my desk. If you are a developer, you should read it too.

Honesty Tip #1:
Name functions for what they really do. You’ve been taught to write foo munging code by drawing a box on the paper and labeling it fooMunger() and then writing the code. Okay, but when you’re done, go back and read your code. Is it really fooMunging code, or does it also do something else? If you’re spending 80% of your method checking error conditions, your method is clearly less concerned with munging foos than determining whether it should munge foos. Congratulations! — you’ve written an event handler. Rename it to onMungeFoo() or handleFooMungeRequest() or whatever, and extract the code that ONLY munges foos to mungeFoo().

Honesty Tip #2:
Let your yea mean yea and your nil mean nil. Don’t set up code to cleverly create side effects. EVERY effect is a side effect! Name your code for the intended side effect and document any other side effects. Don’t name your code for the unintended effect, especially if you think you’re cleverly creating an abstraction. (If the abstraction is really good AND other code will use it unchanged, you may create an abstracted method but you should still not use the abstraction in your other code. Write a wrapper method that explains your intended effect, like:

bool isLegalOverride(Foo a, Bar b) { return !areSimilar(a, b); }

Honesty Tip #3:
Don’t pee on my leg and tell me it’s raining, and don’t write a public accessor to a private member and tell me that member is still private. If an object is completely and utterly accessible from anywhere in the application, it’s a global variable.

Honesty Tip #4:
Don’t try to trick the compiler into giving you what you want. You’ll only trick your coworkers (and probably yourself). Tell the compiler what you want and write code that makes it give it to you.