From PHP to Java #2 – Development speed

In my previous article I was hyped about getting insane throughput in my first app. Today I started another app and development speed, using quite difficult architecture, surprised me again.

Spring Boot

As you could expect after previous entry I’m focusing on Spring Boot as it delivers everything more or less out of the box so I don’t need to worry that much about additional tools. It’s also similar-ish to Symfony2/3 so I feel close to home.

Building new app today

Last Thursday I visited London’s Java Meetup which was about CQRS applications, event sourcing and how to use it in microservices. Great talk which motivated me to try to build Event Sourced app.

There is nothing better for the weekend than building application in language and environment you don’t really know what well using difficult technology you’ve never used before. Should give me weekend or two of fun playing with it.

Sadly my project, Java and tools said

no

what’s actually good thing.

Spring & Axon Framework

It’s now 14:23 and I’m basically done with fully event sourced API part with enough materializers to create all views needed for the MVP. It’s kinda crazy for me.

Configuration of Axon Framework (CQRS framework for Java) is very easy. Few services registered in container … I mean Beans registered in Application Context and it’s done. Domain objects working as Command Handlers, listening to events and JPA (like Doctrine) read layer based on MySQL. Everything worked on first run and as it suppose to.

Event sourcing has great part in development speed and I don’t need to care about database at all and I don’t even think about it before I finish all domain processes. After that there is time to reflect what I want to show to the user. What views I’ll have in the application. And how I want to put those data so they will be easy to read.

Amazing. Again.

Conclusion

I’d really like to find some downsides, things I won’t like in Java. I know about Websphere and old “Application Servers” ways and that they are terrible but it’s past. Currently I feel like Java is taking back ground after years of being “slow” and “too corporate”.

I remember doing research years ago, when I was looking for language to learn after seeing no future in Delphi. I’ve chosen PHP as it was growing and for being nice and fast to develop websites. Java felt “too big for task”. Today it seems to be other way around.

From PHP to Java #0 – Beginnings are hard

As I’m slowly working my way up from PHP to Java. I think I can write few words about my experience on that topic.

For now I know basics of basics of the language. It’s not that different and more or less the same with different markup in every language. You can’t reinvent loops of variables :P

Difficulty starts now when I want to write simple app in good way. Currently i’m using Symfony 2, Doctrine, Tactician Command Bus and Twig. Switching to do the same thing in Java means I need to choose similar libraries from java world. Another reason I have to use them is market. To get a job you have to know your tools. You have to know the best tools. And you have to know them well.

Now I’m in the stage when “I have no idea what I’m doing” but after research I decided what will be my starting point.

Web framework – Spring Boot – simplified version of Spring. No XML in favour of annotations and code configuration. From what I see it had good feedback from community and it’s similar enough to Symfony 2 to let me get some results in reasonable time.

Database – Hibernate – The heaviest ORM in Java, probably. But it was a source of inspiration for Doctrine 2 and few years back I was working with it’s .NET clone so I hope I will have only problems with configuration and markup.

Command Bus – Axon Framework – Here is the tricky part. Axon is a huge step from DDD light where state is saved on every request to Event Sourcing. Maybe it’s possible to simplify but I’m not sure at this point. Also Google and Stack told me it’s production proven by banks etc so it can be good direction even when learning curve will be very steep.

Templating – Thymeleaf – Default for Spring Boot. Not bad XML-like markup. For what i need it’s Googleable to extend templates and create reasonable DRY structure of template files.

It’s a lot for a first step into new technology. I spent last month-ish trying to figure out if I can make it in smaller chunks but I can’t see a way where I’m not doing dummy “hello Hibernate” examples.

Plan is to write clone of my ftrack-ddd app on the stack I mentioned in this post. As much as it will be possible I’ll be writing posts about my progress.