Tuesday, September 06, 2016

Making Sense Of Symbols In Scala's Collections API

Scala comes under a lot of criticism for the leeway it gives to the use of symbols. A criticism I can understand, since if abused, can easily lead to codebases that might be difficult to read at first glance.

But even with that, I still think the criticism is aggrandized, because when it is all said and done, symbols are still very valid and capable tools for capturing and expressing ideas. Especially when they can do so in very crisp and mathematically fashion without introducing the overhead/need for verbal processing.

"But it is almost impossible to google these symbols"! The complaint goes...

True, but when you think about it, this isn't an inadequacy of Scala, but the inadequacy with most search engines and their inability to deal with symbols in search queries.

To deal with this drawback, I have learnt to use http://symbolhound.com/ whenever I hap upon a symbol in Scala which I want to search. Symbolhound.com can deal with special symbols and does not escape them like Google et al. does.

Wednesday, August 24, 2016

Replaying Events in An Axon Framework Based Application

This post, shows how to replay events from the event store, in an event sourced application built with Axon Framework.

Note: This post applies only to 2.x versions of the Axon Framework, as the implementation of the event processing aspects of the Axon changes significantly with the version 3 release.

If you are not familiar with CQRS and/or the Axon Framework, then consider starting off by reading Exploring CQRS Architecture with Axon Framework, which is a series of post that explores the CQRS architecture/pattern and how the Axon Framework can be used to build applications according to the stipulations of CQRS.

If you’ve read these series of posts, or you are already familiar with CQRS/Axon Framework, then feel free to continue with the rest of this post.

Monday, June 27, 2016

Understanding Implicits in Scala

I knew about the maxim: "Implicits are evil" way before I started learning and using Scala. So by the time I started running into them in codebases, I was already biased. It was thus easier to raise my hands in despair at the "magic" that is implicit and just condemn their existence.

Obviously such a view is not healthy. So I decided to do what any sane human would do: If I am going to continually bitch about something, I should at least know some one or two things about what I am bitching about.

This post captures my understanding of how implicits work in Scala thus far. Not in the sense of how they work at the compiler or implementation level, but how they work in the sense of what they do and how to reason about them when encountered in a codebase.

It is not about when to make the decision to use or not use implicits. Or how to use them "tastefully". My current level of mastery of the Scala language does not permit me to make such pontification. Hopefully in the nearest feature, a post like this would follow.

Should in case you were like me a couple of months back, and just want a clue about what the hell is the magic going on with implicit, then you will find this post useful.

So let us get right to it.

Friday, April 29, 2016

Difference Between Value, Factory, and Service in AngularJs

There are various ways to create Objects in JavaScript. A couple include:

Using Object literal notation: Reference

var carObj = {
  model: "Mercedes-Benz CLS Coupé",
  getModel: function() {
  return this.model;
  }
}

console.log(carObj.getModel()); // prints Mercedes-Benz CLS Coupé

Monday, April 25, 2016

Exploring CQRS with Axon Framework: Closing thoughts

...and this post, is the final one, in the series of posts on Exploring CQRS with Axon Framework. It is a summary of my thoughts on CQRS as a pattern and the Axon framework as a tool used in achieving this pattern. If per chance you have not read the other posts in the series, I will recommend starting from the very first post: Exploring CQRS Architecture with Axon Framework: Introduction

That said, I proceed into the details of this post.

Saturday, January 23, 2016

Exploring CQRS with Axon Framework: Overview of the Testing infrastructure

After a long break, I am finally getting around to picking up on the series: exploring CQRS with Axon Framwork. This post, which is on testing, is one of the two remaining posts left to wrap up the series. The aim is to follow it up, as quickly as possible, with the concluding post.

If you have not been following the series, I would advice to give the other posts a read before continuing with this post. You can start here: Exploring CQRS Architecture with Axon Framework: Introduction

As already mentioned, this post looks at the infrastructure the Axon Framework provides for testing. Just like the other posts in the series, it is accompanied by the exploringCQRSwithAxon project on Github. The Application is a trivial one, meant to further illustrates the content of the posts.

Thursday, October 29, 2015

Exploring CQRS with Axon Framework: Applying Event Sourcing

This post is part of the series of post on exploring CQRS architecture using Axon Framework. It looks into combining event sourcing within CQRS using Axon Framework.

The previous posts in this series has explored the various components of a CQRS application and in Introducing Domain Events and Event Handling, we are able to put everything together. We did all that without bringing in event sourcing, showing that it is possible to have a CQRS architecture easily without introducing event sourcing. But in this post, we do just that: introduce event sourcing.

There is a project on Github (exploringCQRSwithAxon) that accompanies these series of posts. It is a trivial application where we can perform debiting, crediting and transferring of money between two dummy accounts. The code in the project is meant to help illustrate the application of the Axon framework to building CQRS application.