| Construction tips |
|---|
| Test Driven Design |
| Design Patterns |
|
Core J2EE PatternsDeepak Alur, John Crupi, Dan Malks J2EE Design and DevelopmentRod Johnson Design Patterns by Andrew Kuzmin, 2003-2007 |
| Generics |
For comparison: Microsoft introduced the idea of generics in .NET 2.0, therefore recognized that deriving classes from the Object class and casting them introduces performance cost and eliminates benefits of type checking at compile time. Generics are particularily important for collection classes. .NET 2.0 generics can be applied to delegates, interfaces and methods. .NET 2.0 generics are defined with CLR. That is a significant difference when comparing to templates. With templates the source code in given language was required at compile time. Defining generics in CLR permits that generics class is used by code written in VB, C++ or C#. .NET 2.0 supports constraints within templates:
public class DocumentManager<TDocument>
where TDocument:IDocument
{...}
Inheritance and delegates can be used with templates. Sample implementation of method called by delegate:
public delegate TSummary Action<TInput, TSummary>(TInput t, TSummary u);
public static TSummary Accumulate<TInput, TOutput>(IEnumerable<T> coll, Action<TInput, TSummary> action)
{
TSummary sum = default(TSummary);
foreach (TInput input in coll )
{
sun = action(input, sum);
}
return sum;
}
// then invoke the method as follows:
decimal amount = Accumulate<Account, decimal>(
accounts, delegate(Account a, decimal d){ return a.Balance + d;} ) ;
|
| Apr 12, 2003
Sun: About Microsoft's Delegates It is unlikely that the Java programming language will ever include this construct. Sun already carefully considered adopting it in 1996, to the extent of building and discarding working prototypes. Our conclusion was that bound method references are unnecessary and detrimental to the language. This decision was made in consultation with Borland International, who had previous experience with bound method references in Delphi Object Pascal. We believe bound method references are unnecessary because another design alternative, inner classes, provides equal or superior functionality. In particular, inner classes fully support the requirements of user-interface event handling, and have been used to implement a user-interface API at least as comprehensive as the Windows Foundation Classes. |
| Software Tools |
|---|
| Software Testing |
|
[ApTest Manager] [AppLabs] [IBM's Software Testing Best Practice [Ignite for Java] [Atomic Objects, Mock Objects - Model View Presenter design pattern] [Presenter First] [CISCO - network testing tools - reference] |