Functional Thinking

„Funktional Programmieren heißt, man schreibt, was gemacht werden soll und nicht wie etwas gemacht werden soll.“ Neal Ford beschreibt in einer Artikelserie auf developerWorks, wie man auch als auf Objektorientierung-gepolter Java-Entwickler Konzepte der funktionalen Programmierung verwenden kann, um seinen Java-Code lesbarer, verständlicher und damit leichter wart- und erweiterbar macht.

Thinking functionally (Teil 1)
Thinking functionally (Teil 2)
Thinking functionally (Teil 3)
Immutability
Coupling and composition (Teil 1)
Coupling and composition (Teil 2)
Functional features in Groovy (Teil 1)
Functional features in Groovy (Teil 2)

Weitere Artikel sollen folgen.

Veröffentlicht unter Java and Quality, Java Basics | Verschlagwortet mit | Hinterlasse einen Kommentar

Grails is getting Maven support

According to a recent blog post of Grails project lead Graeme Rocher, Grails is getting Maven support in the form of a plugin.

Currently, Grails uses Maven repositories for dependency resolution, but the build system of a Grails application uses Gant. For Grails 3.0 it is planned to establish Gradle as the build system of choice, as Gradle is getting more and more popular.

But as Maven is already widely used in the Java world, Graeme wants to provide Maven as an alternative build system.
There will be an initial plugin providing basic Maven support soon, which will be compatible with Grails 2.0.
A more refined integration will become available later, but it will probably requiere Grails 2.1.

Veröffentlicht unter Build, config and deploy, Groovy and Grails | Verschlagwortet mit , , , , , | Hinterlasse einen Kommentar

Firebug 1.9 released

Firebug

The popular web developer tool Firebug has been released in version 1.9.

The new features include:

  • Firebug panel docking
    it is now possible to dock the Firebug panel to any of the four sides of the browser window.
  • Syntax error position
    Firebug now shows not only the line of an error, but also the exact position.
  • Support for JSON responses
    JSON responses are now supported, including a partial copying of tree elements to the clipboard.
  • Console log output linked to origin
    All console messages are now linked to their origin (file+line).
  • More tooltips while debugging scripts

The full changelog is available at hacks.mozilla.org.

Firebug 1.9 is compatible with Firefox 5.0 – 11.0

.

Veröffentlicht unter Java Web Frameworks | Verschlagwortet mit , , , | Hinterlasse einen Kommentar

Knockout JS 2.0.0 released – Dynamic JavaScript-UIs using Data Binding

The Knockout JS Team recently released version 2.0.0 of their JavaScript data binding framework.

Knockout JS is a small Javascript library that offers declarative data binding for your HTML code. It enables you to separate you HTML code from your data and UI logic, offering automatic UI refresh and dependency tracking.
I’m going to write an introductional blog post on KnockoutJS soon. In the meantime, check out the great introduction video of the creator Steve Sanderson.

The new features of version 2.0.0 are:

  • Control flow bindings
    You don’t need a template engine like jquery-tmpl any longer. Simply use the new control flow bindings if, ifnot, with, and foreach.
    <ul data-bind="foreach: products">
        <li>
            <strong data-bind="text: name"></strong>
            <em data-bind="if: manufacturer">
                &mdash; made by <span data-bind="text: manufacturer.company"></span>
            </em>
        </li>
    </ul>
    
  • Containerless control flow
    You can now avoid using a container element for bindings like foreach by using the new comment-based control flow syntax.
    <ul>
        <li><strong>Here is a static header item</strong></li>
        <!-- ko foreach: products -->
        <li>
            <em data-bind="text: name"></em>
        </li>
    </ul>
    
  • Access to parent binding contexts
    You can now access properties that exist at the upper levels of binding via the new pseudo-variables $data, $parent, $parents and $root.
  • Cleaner event handling
    There is now a cleaner, more declarative syntax for event handling bindings that does no longer require to write inline function literals.
  • Binding providers
    There is a new binding providers API to extend the default data binding mechanism. It acts as a general extensibility mechanism.
  • Throttling
    It is now possible to limit how often change events are fired (e.g. only one change event per 500ms). BTW, ko.dependentObservable has been renamed to ko.computed.

For a full list of all new features see Steve Sanderson’s blog entry.

There is also a Grails Plugin available, but as Knockout is just a single JavaScript-File, I would recommend to include it in a Grails project directly without a plugin.

Veröffentlicht unter Groovy and Grails, Java Web Frameworks | Verschlagwortet mit , , , , , | Hinterlasse einen Kommentar

FF9 GWT DevMode Plugin

There is a preliminary ff9 developer mode plugin available for testing, get it here:

http://www.mediafire.com/?831pp1kk5p8kgjd

Source: https://groups.google.com/forum/#!msg/google-web-toolkit/wElYN-Thi2M/TCgLDSNRusEJ

Veröffentlicht unter Java Web Frameworks | Verschlagwortet mit , , , | Hinterlasse einen Kommentar

Spring Framework moves to GitHub

The spring framework moved to GitHub:

Today we’re happy to announce that the Spring Framework has moved to GitHub!
As you’ve probably noticed, nearly every other Spring project has already made the move, and those that haven’t will soon.

In this context, there is an interesting post about „social computing, what to do when things get complicated…

 

Veröffentlicht unter Build, config and deploy, Spring Universe | Verschlagwortet mit , | Hinterlasse einen Kommentar

Project Jigsaw – jdk8? – big picture?!?

Mark Reinhold (Chief Architect of the Java Platform Group at Oracle) just published a „document“ titled „Project Jigsaw: The Big Picture — DRAFT 1„, his words:

This document is an overview of the current state of Project Jigsaw, an exploratory effort to design and implement a module system for the Java SE Platform and to apply that system to the Platform itself and to the JDK.

To put it into context: this is draft 1 of the big picture, that comes after draft 12 of a jigsaw module-system requirements document. Why two documents? Is draft 12, although more complete, deprecated now?

One of goals of jigsaw – among many others, to many other IMHO – is to provide a scheme of some sort for versioning. Is this the way to go concerning versions? When it comes to documents and versions, one is not leading by example, not, not really… I am following the jigsaw from a public point of view for a while now – but I can’t tell you where to find versions 1 to 11 of the requirement document, and I find it somehow frightening to see a draft 1 on a related topic coming along. The „still to come“ topics at the end of the document can be found at draft 12 of the requirements documents.

To be honest, I have a bad feeling on all this modularization effort targeting jdk8. If I take a look at lambda (nice post here), we have a state document, a JSR and a plan to integrate it into the JDK source. Sure, we have voices complaining that it is too much, too little, to late – but hey – there is something to build upon. It is in a state we can actually believe it is coming. This feels far more solid that anything – everything – regarding jigsaw and modularization. We do not even have a JSR for modularization, as stated in the jdk 8 JSR!

Now back to the big picture document. It does not report the jigsaw status, and it is by far not as complete as the requirements document draft 12. But it does explain the syntax of module definitions on a more precise way, and does recap some of the big picture goals of jigsaw.

Big picture, the design principles:

(1) Modularity is a language construct
(2) Module boundaries should be strongly enforced
(3) Static, single-version module resolution is usually sufficient

Sounds good, but (1) is the whole point of adding modularization to the jdk, or we could just stick to OSGi. A modularization that is not enforced is not (read enforcement here), so we all agree on (2). That we are going to need split packages loaded in a common class loader because of the mess in the jdk (see java.util package) goes against (2). From the requirements document, draft 12:

In support of platform modularization, it must be possible to declare that the types defined in a specific set of modules must be loaded by the same class loader.

But (3) is something that I really do not get. Again, from the requirements document:

Multi-version support should only be enabled when type collisions can be detected and reported as errors. This most likely means that it cannot be enabled for run-time linking since detecting collisions is nontrivial.

Seriously – just one version at runtime? The whole point of versioning and modularization is that we HAVE version collisions, and we are witnessing repackaging of all sorts circumventing our version conflicts. This is why we started using something like OSGi, despite of all the doing, tooling and architectural pain.

If we can have only one version resolved, we aren’t getting any better than with  ivy or maven dependency management and dependency mediation. By the way, the new Big picture is messing around with the terminology we are used to: from maven, spring – and somehow from common sense – we know „scopes“ as where to use the artifacts/ components (runtime, compile-time, test-time, etc.). Then we have different life cycles: maven defines a concise project lifecicle. Every single component model defines its own component life cycle, and regarding modules (at the same level of granularity) we have a bundle life cycle defined by OSGi. In this context, take a look at „Phases“ in the big picture…

Big picture, the phases:

Compile time
Install time
Run time

There is not much to comment here. I just have the strong feeling that this is not enough, too late, to little? The big picture turns out to be a very small one. If you really need modularization today, take a look at the really big pictures drawn by maven, spring, osgi. Even GWT – nothing more than a web framework – does provide its own little module system.

On his blog „there’s not a moment to loose“, Mark described how cool it would be to have a small memory footprint, modularized jdk. That was 2008. Lots of things changed since than.

Veröffentlicht unter Build, config and deploy, Java Basics, Java modularization | Verschlagwortet mit , , | Hinterlasse einen Kommentar