One of the most profound insights I have learnt about OO is that class design — the shaping of classes & types — is best informed by what processing needs to do, rather than the ‘kind’ of entities it goes between.
What we are talking about here is behavior, rather than trying to categorize entities at rest. Program code only acts by being executed; classes & interfaces (types) are a mechanism to despatch that execution to specific methods.
This shows that OO is really about active behavior, rather than any other arbitrary notions of classification.
But shouldn’t inheritance just follow Entity Properties?
At this point, we’ll address a common interjection — what about bean-style entities, and their properties? Surely inheritance should just follow these! Continue reading
Since Java 6, a mechanism was introduced for Java code to automatically discover “plugin” service implementations for JARs within the classpath.
As well as being used by Java to find XML parsing & Image IO implementations, it’s an interesting mechanism & can be used to make user applications extensible too. Continue reading
Two weeks in Gurgaon engaging with and mentoring the Indian team. An amazing & vibrant country.
Real software sees entities (Customer, File etc) involved in multiple interactions. Simple OO examples model behavior in entity classes directly, but this becomes tangled as behaviors & interactions increase; and results in broken inheritance structures.
Instead of modelling these all in the entity, a more advanced OO approach considers separating behavior from the entity. We’ll consider key principles in this multi-part series. Continue reading
HttpClient has long been popular for implementing outbound HTTP in Java. URL requests, HTTP remoting & service access are all common usecases.
For developers of HTTPS client applications, one scenario is common: wanting to test HTTPS connectivity, without needing a CA-signed certificate on each developer’s local appserver. Continue reading
Oracle 12c’s new feature is pluggable databases (PDBs). This has been introduced to improve support for cloud & multi-tenancy, and keep up with SQL Server. However, our trial found Oracle’s PDBs less than ready for production use. Continue reading
Exception handling in Java is crucial for reliability, but a common source of bloat & prone to miscoding. However, dealing with exceptions correctly can be surprisingly easy.
We cover 10 “foundation” best practices to simplify your coding & help you handle exceptions correctly. Continue reading
Oracle, with lead engineer Brian Goetz, have launched an experimental OpenJDK project to bring long-awaited features to the Java platform.
Major enhancements to generics & new ‘value types’ are planned. Highlights include:
- Value Types; highly-efficient small ‘objects’ without inheritance.
- Reified Generics; retaining their actual type at runtime.
- Generic Specialization; List<int> would be valid & highly efficient.
- ‘volatile’ enhancements.
The effort is named Project Valhalla. Here’s a preview: Continue reading
With the move to annotations for use of Spring, many projects have become based on component-scanning, auto-wiring and property-placeholder injection — an ‘implicit’ approach to configuration.
However, it can still be very useful to specify ‘explicit’ configuration. This gives us control of top-level application config & enables extensible configuration using the Strategy pattern.
Gaining control of configuration is crucial to enable per-customer/ per-application customization. Continue reading
Java 8′s ForkJoinPool & parallel streams are receiving some serious attention now. They seem a sophisticated concept to parallelize work, but some are warning of serious limitations.
Edward Harned of CoopSoft, in particular, has analyzed the Fork/Join design implemented in Java. Continue reading