Functional programming in Scala

I’ve completed the Coursera course Functional Programming Principles in Scala, with a Verified certificate! Going through the course was a nice experience. It felt a-lot like the university years, including even finishing assignments at the last moment.. Even though I already experience on functional programming and some in Scala, I did learn quite a lot. The course was a refresher on functional programming, which I learned at the university. Also, some functional programming principles I knew how to apply in Haskell, now I know how to use them in Scala.

Geplaatst in Methodology Getagd met , ,

Going to do functional programming

I’ve learned about functional programming during my university years, with Haskell as primary language. I considered functional programming as quite elegant, but also impractical. I felt I could get practical results more quickly when using Java or C# than using Haskell. Sometimes I used functional constructs like immutability, separating action from calculation or transforming and trying to limit the side-effects of functions. Usually this ended up in remarks from colleagues, ranging from ‘just accept java isn’t functional’ to ‘I don’t understand this code’.

Older, and more experienced at, and sometimes wearied of,software development, I’m getting to change my mind about how practical functional programming, as well as the inpractactically of object-oriented programming.

Some insights:

  • Distributed software, SOA, services get much more understandable with functional patterns rather than with  object-oriented patterns. What if you have to call multiple services, where each call depends on the result of another service? You don’t want to block your software while doing a service-call? And how do you handle errors? What to do about nullpointerexceptions? Using reactive programming allows you to handle these problems a lot easier, and then you start doing functional programming already .
  • Software-architects like to split up software in ‘layers’. When using an object oriented language, this leads to translation of objects living in one layer to objects living in another layer, to avoid objects having behavior that belong in one layer ending up in another layer: like persistable domain objects ending up in the UI-layer or business-logic in a service-layer. I am quite fed up with yet another Dozer implementation. And xslt almost looks like a functional programming language, with a very verbose syntax.
    Instead of discussing what belongs in which layer and wetter or not a domain-object should be anemic or not: lets separate behavior, data and logic altogether. Functional programming languages allow that more naturally and readable.
  • Reusability is often desired. Lots of reusable components are created at many companies. Rarely they’re used. Software that is reused most successfully consists mostly just of a set of functions, having little or no state.
    I rather have a function validIban then a class BankAccount with some method setIban or worse that may throw a validation error and a whole lot of other methods I don’t want.
  • When enterprise-system, software grows, so grows the complexity. Nowadays people try to handle the complexity by adding testers, architects, functional/business analysts, information analyst, requirement engineering, ESB, SOA, middleware etc. All in vain, bugs still occur and software becomes unmaintainable legacy quickly, adding the need to add yet another software system.
    To truly handle software complexity, software must be of high quality and written in a highly expressive language.
    Failed releases, software caused system-outages and software bug related security-flaws should not be considered a given we have to live by. TDD or automatic tests (not the same), clean-code, continuous deployment and similar practices may help. In the end I think a functional, pure, language may be our only hope.

My goal will be for the coming year to both use and learn functional programming (fp) a lot more, explain it to other people and hope to popularize fp or ride the wave when functional-programming becomes more popular.

More bold, or maybe foolish, I take up my personal challenge to create something practically useful in Haskell.

Geplaatst in Ideas, Methodology Getagd met , ,

Demonstrating using GWT-RequestFactory and Spring togetter

I present a sample-project that demonstrates using the GWT RequestFactory together with Spring.
Lees meer ›

Geplaatst in Technology Getagd met , ,

Scala to extract XML from SOAPUI-project file

I’ve created a small scala-script to extract messages from SOAPUI. Writing this was surprisingly easy, and certainly faster and more pleasant then processing the SOAPUI manually.

Geplaatst in Technology Getagd met ,

SQL Performance

If you have to access persisted data, of course, you do not have to necessarely use SQL. But in case you do, knowing something about SQL-performance helps.
I just did a this 3-minute test on SQL performance (for Oracle), with 4/5 score. Pretty fine.

The answer I failed was about multi-colomn indices. When you have a index containing multiple columns, if you use one of those columns in a where clause, the index is used. However, the index can only be used efficient if you use at first column.

Geplaatst in Technology Getagd met ,

Friend of Eclipse

I just became friend of Eclipse. The new version Kepler is available for friends of Eclipse, which is a good reason to do something I planned to do before.

 

Geplaatst in Various

Hoe je baan te behouden bij introductie van Agile

De organisatie waarvoor je werkt besluit Agile te worden. Dat klinkt eng! Ongetwijfeld betekent dat een reorganisatie en dus dat mensen ontslagen worden. In deze tijden van economische tegenspoed zou het jammer zijn als mensen zonder baan komen te zitten, dus laten we eens kijken wat mensen in de softwarewereld, die gewend zijn aan Waterfall, PRINCE2, TMAP of CMMI zouden kunnen doen als hun organisatie besluit Agile te worden.
Lees meer ›

Geplaatst in Methodology

Gesture

Lots of SF movies and futerist though that the future interface of the computer would be voice: talking to your computer like it was a human. Nothing less is true: the future are gestures to the computer? Why, now that people have smartphones, they could communicate with each other using video-calls – the videophone of the past. Rather than that, many people just post text messages to each other. People prefer to text to other people, why would they even use voice to talk to a computer?

Of course the best interface, next to typing commands to a computer, would be using gestures: just subtle move your hands in front of your screen to get things done.
A few start-ups already have the technology available: Meet the Nimble-Fingered Interface of the Future

Geplaatst in Technology

Lean overheid

Quite a while, my top posting was about waste at the government.  Now something more positive on waste, and other lean subjects: I recently read the book ‘Een lean overheid‘. The book is in Dutch, and gives a nice introduction on using Lean in government organizations.
Unlike other lean books, translated to Dutch or not, it’s written specifically for the Dutch government. I guess most of this information is relevant for Dutch speaking readers, for those that speak English only: I am very fond of using lean at the government. Some people at the UK government seems to be getting it, as well as the US government. Hopefully the government in the Netherlands catches up soon!

Geplaatst in Reviews

Filesystem notifications in Java

Inspired by an OS that went in oblivion some years ago (BeOS) operating systems as Windows, Linux and MacOS all have ways to monitor directories for changes built into the filesystem: meaning if a directory is changed because a file or directory is added, removed or changed you can get an event. There’s need for running a program that periodically monitors the directory (nor does the OS do that, it’s build into the filesystem). Software like Dropbox and other filesyncing products use this, so whenever you change or update a file it’s immediately updated to the ‘cloud’.
The name of the API’s for the listed OS’s are:

There are a number of open source libraries that allow you to use that API in Java, not all cross-platform. Fortunately, since Java 7 watching directories is now part of the default java.nio.file API.

Geplaatst in Technology

Google

Bol.com