• Home
  • Events
  • About
  • Why functional programming really matters – episode one

    January 12th, 2015

    This is why functional programming really matters:
    it provides new options for incremental development.

    How do we develop software? One line at a time.

    All software development is incremental. We have learned to embrace this fact and use it to our advantage. We start small, seek feedback, learn fast, and change direction as we go.

    This requires means to develop incrementally, which at first sight looks like a simple task. After all, software is soft and can be changed any time. But whenever we touch existing code we may introduce subtle new errors and we have therefore devised a whole series of methods and tools to mitigate that risk. Between them are:

    • object encapsulation to limit the error scope,
    • test-driven development,
    • static code analysis, refactoring, and other tools.

    When we have to change and recompile existing code in order to proceed, we call this approach intrusive.

    Of course, the best would be if we could apply increments non-intrusively: without touching any existing code at all! This is sometimes possible.

    • Modular architectures allow to just add new components or services.
    • In object-oriented systems we can use subtyping to add new implementations for existing abstractions.
    • With dynamic languages, we can add new capabilities to existing classes.

    But all of these options have their limitations. They either work only for anticipated extensions or they come at the expense of increased complexity or weakened type safety, which in the future makes it harder to extend the extensions again.

    We would certainly profit if we had more ways of extending software safely.

    Functional programming comes with such new options as John Hughes has shown in his seminal paper “Why functional programming matters“. He puts it in terms of modularity and new “glue” for combining modules: high-order functions  and lazy evaluation.

    tic tac toe

    tic tac toe

    The paper is now 25 years old but still offers a lot of fresh insights. The examples are presented in the Miranda language and to fully appreciate them, I translated them to Frege (a Haskell for the JVM). His line of argumentation accumulates in the last example: a generic solution for playing board games. A running implementation plus the full source code for a simple tic tac toe game is available here.

    Following the paper while implementing the game led to some unexpected experiences that we will talk about in this series of blog posts.

    Episode One: Be infinitely lazy and defer all work

    A board game is a series of mutual moves, each resulting in a new board position. Since there are many possible moves and a number of possible reactions by the opponent, the possible unfoldings of the game form a tree of board positions.

    Depending on the game rules, that tree can be infinitely large.

    The natural way of modeling this in a lazy functional language like Frege or Haskell is to not care about the size of the tree at all but only about how to construct it.
    We keep focussed on generation task and defer the limitation work to later.

    Here is the construction for an arbitrary payload “a”. Children of each node recursively arise from making Nodes for all the payloads that “a” can unfold to.

    We do not care about a base case to stop the recursion or limit the size of the tree but note that calling buildTree will neither exhaust memory nor computation time.
    Laziness in the language cares for constructing children only when needed.

    This is now something that we can specialize for a given data type Board and a function moves that unfolds to all boards that result from applying a valid move.

    The spezialization needs no subtyping and is yet fully type-safe.
    We have extended the system non-intrusively and we will do so again for limiting the size of the game tree.

    When an evaluation of the tree shall be limited to a depth “n” we simply prune the tree at that depth. That code is independent of our special game use case and can therefore work on nodes of arbitrary trees. Here is the recursive definition.

    To make a pruned game tree we use function composition (.) for the generation:

    Note that we still haven’t materialized the tree! A user of the pruned tree can never look below level 5. No children below that level are ever evaluated, and thus – thanks to laziness – never get constructed.

    Laziness allows us to work incrementally not only from generic tree generation to specialized logic and data types. We even apply pruning conditions non-intrusively “from the outside”. We didn’t need to anticipate the need for pruning.

    We never had to go back to previous code to change it. We did not even re-compile!

    This is it for episode one. Stay tuned for more episodes.

    Dierk König
    @mittie


    Links:

    Episode 1
    Episode 2
    Episode 3
    Episode 4
    The paper Why functional programming matters

    The full source code. Play the game here.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • DZone
    • Y!GG
    • Webnews
    • Digg
    • del.icio.us
    • DotNetKicks
    • Facebook
    • Google Bookmarks
    • Newsrider
    • Twitter
    • YahooBuzz

    Workshop: Modern Development with Java 8

    January 5th, 2015

    Java Programming 8 makes life easier. This is the belief of Richard Warburton, Raoul-Gabriel Urma and James Gough. They give a 2 days workshop about Modern Development with Java 8″. It will take place in February 17-18, 2015 in Basel. You are kindly invited to participate.

    At the end of this workshop, you will be familiar with the cutting edge programming approaches and be ready to use Java 8 on your day job.

    At a glance:

    • Topic: Modern Development with Java 8
    • Trainers: Richard Warburton, Raoul-Gabriel Urma, James Gough
    • Date: February 17-18, 2015
    • Location: Canoo Engineering AG, Kirschgartenstrasse 5, CH-4051 Basel
    • Price: 1´650 CHF (JUG member will get a 10% discount)

     

    Please find the content of the training days on our website.

    Registration:
    Please use the registration form on our website or send us an email to services@canoo.com.

     

     

     

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • DZone
    • Y!GG
    • Webnews
    • Digg
    • del.icio.us
    • DotNetKicks
    • Facebook
    • Google Bookmarks
    • Newsrider
    • Twitter
    • YahooBuzz

    Java Performance Workshop | December 2-5, 2014 | Basel

    October 22nd, 2014

    Java Champion Kirk Pepperdine will give a Java Performance Workshop on December 2-5, 2014 in Basel. He will provide you with techniques that have been proven to improve your ability to find and fix performance bottlenecks. During the four-day workshop you will learn:

    Java Performance_Button
    • Quickly identify the root causes of poor performance in your applications
    • Eliminate conditions that will prevent you from finding performance bottlenecks
    • Find critical supportive evidence before deciding on a potentially expensive course of action
    • Find performance issues before they make their escape into your production system
     
    Please find the content of the training days as well as price information on our website. JUG members will get a 10% discount.

    Registration:
    Please use the registration form on our website or send us an email to services@canoo.com.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • DZone
    • Y!GG
    • Webnews
    • Digg
    • del.icio.us
    • DotNetKicks
    • Facebook
    • Google Bookmarks
    • Newsrider
    • Twitter
    • YahooBuzz

    Minor Release – Canoo RIA-Suite 2014 Update 1

    September 9th, 2014

    We are pleased to announce that Canoo RIA-Suite 2014 Update 1 (v 8.0.1) is available for download now. This is a minor release for Canoo RIA-Suite 2014. It includes some bug fixes and feature requests. Please see the release notes for more details.

    In case if you have any questions please send an e-mail to our sales department: ulc-sales@canoo.com.

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • DZone
    • Y!GG
    • Webnews
    • Digg
    • del.icio.us
    • DotNetKicks
    • Facebook
    • Google Bookmarks
    • Newsrider
    • Twitter
    • YahooBuzz

    Member of Eclipse openMDM® Working Group

    July 30th, 2014
    openMDM_working_group_gruendungsveranstaltung_20140611

    The Eclipse openMDM® Working Group members convene for their inaugural event on July 11, 2014 at the Audi premises in Ingolstadt.

    The automobile manufacturers Audi, BMW and Daimler have announced the establishment of the Eclipse openMDM® Working Group. Under the umbrella of the Eclipse Foundation they aim to advance the development and distribution of open source tools for the measurement of data management internationally. Canoo Engineering AG is one of the founding members.

    Experiments, measurements and simulations are in widespread use in the automobile industry, together with a multitude of measurements and meta-data. Documenting these data has been simplified thanks to the ASAM ODS Standard – an industry-wide recognized format for data storage. The goal now is to likewise facilitate the development of ASAM ODS based software for the evaluation and management of measurement data. To this end an open community comprising 30 vehicle manufacturers, suppliers and service providers has developed the modular method and software system openMDM® over the past few years. The Eclipse openMDM® Working Group, founded in July 2014, is currently further developing the system and aims to establish it as an international standard.

    Driving the development of openMDM®’s software components

    The Eclipse openMDM® Working Group supervises and controls the requirements placed on reusable openMDM® software components. In the case of new functionality, enhancements, as well as the maintenance of existing components, the Working Group instigates corresponding Eclipse open source projects. Likewise, planning and finance are enacted through the Working Group. It has a stake, moreover, in the quality assurance of the software components and provides tools for configuration and version management.

    The first Eclipse open source projects have already been launched. The openMDM® core system is being enhanced on the basis of the new openMDM-5 Architecture. Work is furthermore being carried out on software components for web front-ends and rich clients.

    Consortium of automobile manufacturers and software companies

    The Eclipse openMDM® Working Group includes the so called driver members AUDI AG, BMW Group and DAIMLER AG. They regard openMDM® as a strategic platform which enables software applications in the field of experiment and measurement data management to be implemented rapidly and cost effectively. The founding members further include the software companies Canoo Engineering AG, GIGATRONIK GmbH, HighQSoft GmbH, science + computing ag and Peak Solution GmbH. The Eclipse openMDM® Working Group is open for the uptake of additional automobile manufacturers, suppliers and service providers. Prominent industry players worldwide have already announced an interest in joining.

    Committees coordinate the Working Group’s activities

    The Eclipse openMDM® Working Group’s tasks, responsibilities as well as its composition are stipulated by the openMDM® Working Group Charter. This specifies amongst others that a representative from the board of ASAM e.V. is part of the Steering Committee Working Group.

    Here you can download the official press release of Eclipse openeMDM® Working Group:

    Download press release (German)
    Download press release (English)

    Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
    • DZone
    • Y!GG
    • Webnews
    • Digg
    • del.icio.us
    • DotNetKicks
    • Facebook
    • Google Bookmarks
    • Newsrider
    • Twitter
    • YahooBuzz

    css.php