29 November 2008

CodeExplorer Intellij IDEA plugin

CodeExplorer looks like an interesting IntelliJ IDEA plugin, will try it out... tried it out, useful for visualising method calls within a single, or a few, classes

Alex Miller on use of the final keyword

Another Java Excel library

Came across another Java library for Excel, from TeamDev who seem to produce an interesting range of products

TeamDev — Java components & Java libraries. Java web components, Java AWT component, Java graph library & Java lib & API
# JNIWrapper enables access to native libraries and components from Java code without using JNI. The technology supports Windows platforms, Mac OS X (Mac PPC/Intel) and multiple Linux platforms.
# ComfyJ provides bi-directional communication between the Java platform and COM technologies (Java – COM Bridge), in pure Java language.
# JExplorer enables you to embed Microsoft Internet Explorer into Java applications as either a visual or non-visual component. It gives you full access to the native browser API, while requiring no specific knowledge of COM technology. It’s easy to integrate Java & Internet Explorer using JExplorer.
# JExcel enables effective integration of Microsoft Excel workbooks and spreadsheets into Swing-based applications. This is a powerful Java Excel bridge.
# WinPack is a free add-on to JNIWrapper enabling access to the Windows native API and libraries from Java code, entirely in the Java language.
# JxCapture is a cross-platform library providing a comprehensive Java screen capture API.
# JxBrowser enables seamless integration of Mozilla Firefox browser into Java AWT/Swing applications on Windows, Linux, Mac OS X (Intel and PPC-based) platforms. JxBrowser makes creation of a powerful Java browser is easy and simple.

Some development points by Miško Hevery

Guide: Writing Testable Code | Miško Hevery
Flaw #1: Constructor does Real Work

Warning Signs

* new keyword in a constructor or at field declaration
* Static method calls in a constructor or at field declaration
* Anything more than field assignment in constructors
* Object not fully initialized after the constructor finishes (watch out for initialize methods)
* Control flow (conditional or looping logic) in a constructor
* Code does complex object graph construction inside a constructor rather than using a factory or builder
* Adding or using an initialization block

Flaw #2: Digging into Collaborators

Warning Signs

* Objects are passed in but never used directly (only used to get access to other objects)
* Law of Demeter violation: method call chain walks an object graph with more than one dot (.)
* Suspicious names: context, environment, principal, container, or manager

Flaw #3: Brittle Global State & Singletons

Warning Signs

* Adding or using singletons
* Adding or using static fields or static methods
* Adding or using static initialization blocks
* Adding or using registries
* Adding or using service locators

Flaw #4: Class Does Too Much

Warning Signs

* Summing up what the class does includes the word “and”
* Class would be challenging for new team members to read and quickly “get it”
* Class has fields that are only used in some methods
* Class has static methods that only operate on parameters

08 November 2008

03 November 2008

Hazelcast - sounds similar to Terracotta - distributed Java

Hazelcast
* Distributed implementations of java.util.{Queue, Set, List, Map}
* Distributed locks via java.util.concurrency.locks.Lock interface
* Distributed implementation of java.util.concurrent.ExecutorService
* Support for cluster info and membership events
* Dynamic discovery
* Dynamic scaling to hundreds of servers
* Dynamic partitioning with backups
* Dynamic fail-over

A few things you can do with Apache commons-lang, Apache commons-io and Google collections

SuperScheduler - Java scheduling library

SuperScheduler
Main features of Super Scheduler

* It fully supports distributed computing environment. You can schedule and run tasks on any machine in the network at any time, either on application server machines or on client machines. Many instances of Super Scheduler can run at the same time while a task will run once and only once at the scheduled time. All instances of Super Scheduler share up-to-date information automatically and promptly (default is two seconds).
* It fails-over. If any instance of Super Scheduler is down or busy, others will pick up the tasks.
* It is scalable. if one instance of Super Scheduler is too busy, you can always add another machine to run another instance of Super Scheduler. All instances of Super Scheduler load-balance themselves in a natural way.
* It provides Doer and Talker modes, allowing tasks be fully managed and monitored anywhere in the world.
* It supports many types jobs: Email, FTP, Java, and Operating System. It also supports workflow job, composite job and retry job as well.
* It detects missed tasks and sends alarm email messages.
* It has a built-in GUI tool for scheduling and monitoring tasks. Monitoring windows refresh themselves automatically and promptly. It allows you to suspend tasks, reactive tasks and run tasks immediately.
* It allows you to visually set Workflow job.
* It logs major task related events. It provides history facilities.
* It supports a running period for all tasks.
* A tasks runs on a desired machine if specified.
* All tasks can be programmatically controlled by simple Java API or any other program (like C/C++).
* It provides very flexible schedule terms: minutely, hourly, daily, weekly, monthly, on specific week days and at specified times.
* It provides very comprehensive holiday/weekend policies and facilities providing choices of Next business day, Previous business day and Skip. Any change to holidays will take effect automatically and promptly.
* It provides a lightweight daemon for non graphic environment.
* It provides a Role Based Entitlement management.