Thursday, 1. May 2008
Donald Knuth, the advocate of literate programming, gave his opinion on code reuse from an interview by Andrew Binstock
I also must confess to a strong bias against the fashion for reusable code. To me, “re-editable code” is much, much better than an untouchable black box or toolkit. I could go on and on about this. If you’re totally convinced that reusable code is wonderful, I probably won’t be able to sway you anyway, but you’ll never convince me that reusable code isn’t mostly a menace.
In my view, literately programmed code should be visible for every programmer through its evolution, so literate programming doesn’t cope with OCP well. I guess it is why he prefer “re-editable” code to reusable black box code. But I think benefits of information hiding can be sacrificed in no case.
Monday, 7. January 2008
I listed up what I did last year as a developer.
- Analysis: One of my research areas during graduate years was software analysis in design phases. Last year, I took a deep interest in code-level analysis, even runtime analysys. PMD and FindBugs were my friends. They are open-source projects and I added some rules (Checking is performed based on pre-defined rules) for my project at company. Performance is our main concern; I investigated our products with JProfiler. I compared Java profilers: JProbe, Yourkit Java Profiler, Eclipse TPTP, and JProfiler. Being friendly with these tools takes longer than expected. IMHO, JProfiler is the winner. To fully understand and utilize Profilers, I studied Java memory model and Java concurrency deeply.
- Python again : I met python in 2000, but hadn’t used it for several years. Last year, I met it again. I made some simple games using pygame library, and made very convinient tools for testing. It generates simulation input data and extract meaningful output from logs and then export them to MS excel or XML files.
- PHP: PHP is the only language I newly learned in 2007. I have to use it because my personal project (at home) is on a hosting service that provides only PHP. The project depends on PHP GD library.
- Javascript modules: I like YUI. YUI code is my mentor regarding JavaScript. Prototype is not bad.
- GUI unit test: If somebody argues that GUI is not suitable for automatic test, I can say he/she is wrong. I used UISpec4j for Java GUI testing and the result was satisfactory.
- Coverage: I compared coverage tools: Clover, JProbe coverage, Emma. Clover is better than others, and I used it. Coverge goal in my project is over 90% of line coverage, I could meet the goal with the help of test harness including UISpec4j.
- Continuous integration: I constructed continuous intergation environment at company. Anthill OS is a open-source CI tool. I changed it to add features such as unit testing/coverage/static analysis reporting intergation.
- Books: The 3 books I loved most in 2007 are Effective Java, Java concurrency in practice, Ajax in action.
- Community: I joined (or started activities) some developer’s communities such as JavaRanch, JavaLobby, and Artima. Especially in JavaRanch, there are many gurus I really appreciated. I posted comments and sometimes helped others resolve problems. I started my own blog.
Monday, 17. December 2007
Some criticize AOP for its lack of application area. It is difficult to find useful AOP examples except very limited functions such as logging and transaction. Furthermore AOP is a not unique solution for the specific functions and we have done well without AOP.
Surprisingly, I found an assertion saying that “AOP is the only way to do it” from “Debugging and Optimizing Swing Applications” appeared in JavaOne 2007 technical session. If it is true, it is a very good news for AOP evangelists (including me!) who seek really useful AOP applications. Unfortunately, I can say it is not true. The author argues AOP can detect Swing threading violation: Code that affects GUI components should be executed within event-dispatch thread. But A rule SW_SWING_METHODS_INVOKED_IN_SWING_THREAD of Findbugs, static Java code analyzer, also can help check the violation. In fact, static checking is more appropriate than dynamic checking for those violation because the violation stems from location of specific code lines.
I really anticipate the day when someone will find a really useful and unique solution that uses AOP for a specific problem.
Thursday, 6. December 2007
Following compatibilities should be considered in evolution of existing API.
- Contract compatibility
- Binary compatibility
- Source compatibility
The contract compatibility is independent of programming languages, but the binary compatibility and source compatility may not. Designing Eclipse APIs appeared in EclipseCon 2006 provides general compatibility issues with Java examples. It also provides 13 questions on Java binary/source compatibility. It was not easy at all for me and I could learn a lot from the material.