vertx.io – a lightweight and high performance application platform for the JVM

Recently, I’ve been working on a project that gave me a chance to get back to JVM world and take a nice look into its current state. Having spend a lot more time in .NET world last decade, it was very refreshing to experience it again. Highlights for me are working with Groovy (very nice and easy, but powerful and fast) and vertx.io application platform.

So… I simply love and admire the design of vertx.io; although it provides powerful set of features – it uses asynchronous messaging and reactive programming principles it makes most of required infrastructure glue code disappear, by providing right abstractions and lightweight APIs that never get in your way. For example, it provides a choice of two types of execution environments: event-loop (ala NodeJS) or thread pool based – so that developer can organize the code accordingly to the nature of the task at hand.

Here is the more complete list of the features straight from the their website:

  • Polyglot. You can write your application components in JavaScript, Ruby, Groovy, Java or Python, and you can mix and match several programming languages in a single application.
  • Simple actor-like concurrency model. Vert.x allows you to write all your code as single threaded, freeing you from many of the pitfalls of multi-threaded programming. (No more synchronized, volatile or explicit locking).
  • Vert.x takes advantage of the JVM and scales seamlessly over available cores without having to manually fork multiple servers and handle inter process communication between them.
  • Vert.x includes a distributed event bus that spans the client and server side so your applications components can communicate easily. The event bus even penetrates into in-browser JavaScript allowing you to create effortless so-called real-time web applications.
  • Vert.x provides real power and simplicity, without being simplistic. Configuration and boiler-plate is kept to a minimum.
  • Vert.x includes a powerful module system and public module registry, so you can easily re-use and share Vert.x modules with others.
  • Vert.x can be embedded in your existing Java applications.

Vert.x is licensed using the Apache Software License Version 2.0, see the website for full documentation and project information. Author’s twitter handle is @timfox <- HT

Tagged with: , ,
Posted in Development

Monads in C#?

VisualStudio 2015 and C# 6.0 are out available for preview!!

I decided that a good way to do that would be to try implement a couple of monads in C#. Monads offer a very nice way to separate core logic from the boilerplate code. They are used quite a lot in many programming languages, and in C# they are foundation for Linq. So, I was wondering how easy/hard it would be to implement them in pure C# (not with Linq) and would they end up being practical to use in a OOP language like C#?

Disclaimer: this really is a simplified and incomplete attempt – for a complete and more through take, you should go ahead and read more detailed blog posts here or here:

First, a basic intuition about monads:

monad = data container + some computation + public interface (‘From’ and ‘Bind’)

  • Data container – in C#, simply a class
  • Computation – repetitive logic that can be extracted from the main/core operation
  • ‘From’ – function that wraps a value inside the monad – in C#, constructor or static factory
  • ‘Bind’ – function that applies main/core operation within the context of internal computation

Lets try to implement two simple monads:  Maybe (Option) and Writer monad.

Maybe monad’s internal computation checks for ‘null’ values, making top level code path clear of null checks.

Writer monad’s internal computation allows to accumulate additional information as we progress through chain of operations, hiding away explicit logging statements from the top level code path.

Code?

and here is how it is used:

You can get full source code by going to this GitHub page. I may continue to play around with this, potentially add other monads and more complex examples of use…

Tagged with: , , ,
Posted in Development

resto: a little api playground that just might work…

soon…

Tagged with: , ,
Posted in Development

Distributed Systems and the End of the API

Originally posted on The Quilt Project:

This is a written (expanded) narrative of the content from a talk I first gave at PhillyETE on April 23rd, 2014. It mostly follows the flow of the presentation given then, but with a level of detail that I hope enhances clarity of the ideas therein. The talk’s original slides are available, though the key illustrations and bullet points contained therein are replicated (and somewhat enhanced) below. When audio/video of the talk is published, I will update this page to link to it. Discussion about this piece has taken place on Hacker News, reddit, and Lobsters.

I have two claims of which I would like to convince you today:

  1. The notion of the networked application API is an unsalvageable anachronism that fails to account for the necessary complexities of distributed systems.
  2. There exist a set of formalisms that do account for these complexities, but which are…

View original 7,490 more words

Tagged with:
Posted in Development, distributed systems

Either monad to the rescue…

Lots of programming problems can be modeled by pipe-lining data through series of sequential or parallel processing steps. This data flow allows us to separate computational tasks into meaningful modules and
get more focused code base that is easier to debug and reason about. For example, a pipeline with three steps that takes input ‘req’ and successfully process it, would look like this:

success-pipeline

And if at any stage there is error during the processing, we would skip the rest and return error…

erro-pipeline

Now, there are many ways to implement error handling, but this can easily end up in a messy combination of conditional statements and/or throwing and catching exceptions to stop processing. This adds noise to the real code logic and makes composing tasks harder… I’ve recently started to use Either monad to help with this this problem and am very happy about the results:

Here, I’m using Either implementation from the nice functional library Falktale

Till next time…

Tagged with: , ,
Posted in Development

functional refactoring: love when this happens

So, nice… ;)

Tagged with: ,
Posted in Development

RESTfull APIs screen-cast

Tagged with: , , , , ,
Posted in Development

Building Killer RESTful APIs with Node

Tagged with: , , ,
Posted in Development

Simple example of functional refactoring

I received a couple of request to show more examples of using functional techniques after my ‘Functional JavaScript’ workshop at Cowerks.

So, I’ll be putting out some examples – simple and to the point… Hopefully ;)

Tagged with: ,
Posted in Development

Slides from my “Functional JavaScript” workshop @cowerks

Tagged with: ,
Posted in Development

Error: Twitter did not respond. Please wait a few minutes and refresh this page.

Follow

Get every new post delivered to your Inbox.

Join 337 other followers