[Machine Vision, Illumination] [Java, J2EE] [LabVIEW] [ORACLE] [C++] [C#] [Aspect-Oriented Programming] [Embedded] [XP Agile CI]

Java

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
  • Sun.TutorialGenerics are a purely compile time feature.
    • Generics, an advanced feature of Java 1.5, allow type checking to make sure you fill your Collections and ArrayLists with only the types of Object you intend.
    • All of the Java Collection classes (e.g., HashMap, ArrayList, and TreeList) only contain generic Objects.
    • Java 1.5 compiler performs implicit casts on generics both on the way into the collection and on the way out. This is done so to let the programmer avid casting in his code.
    • Removing the cast from inplementation of generics would create a vulnerability in the JVM that could be exploited maliciously.
  • Autoboxing: when Java expects an object but receives a primitive type, it converts that primitive type to an object; int primitive is converted to Integer object, for example.
  • Another feature lacking in Java before version 1.5 is variable-length argument lists. These arguments are resolved as a primitive Array.

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]



Feedback:


Ajax, Java and PHP snippets.

[Ajax ] [Java IE ] [Java IE ]

Integration Notes

[Machine Vision, Illumination] [Java, J2EE] [LabVIEW] [ORACLE] [C++] [C#] [Aspect-Oriented Programming] [Embedded] [XP Agile CI]

[ CAN 2.0 (Bosch basic specification) ]