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.

Working for free is always a bad idea

As you might know (or not) besides of Software Development I’m also passionate about photography. You can check my Instagram and website if you want. But this post is about my experience in “free freelancing” in both industries.

In software it was waaaay back when I was back in Poland and I had no experience whatsoever. I’ve done few websites “for portfolio”. It was fine. Scope we discussed was done. Problem starts when free job starts to need to be supported with more work.

As with my experience in both industries people will always want more than you’ve agreed on. And it’s not that much about making things for free as making it without “paper” which says what is the scope of contract or agreement.

What I see now is that expectations if not defined are always way bigger than what was told at the beginning. And you, as person doing the job, will always be the bad guy who is doing bad job not delivering.

And I’m not saying it’s good to not deliver. It’s good to deliver more than expected. For sake of having a happy client it’s needed. But when you don’t have specified what really is “the job” you can’t say you’ve done what you were asked for. And trust me, even when you all you were asked for there will be more.

And I know I’m maybe bitching about stuff but tbh I have only 24 hours a day and IMO when I want and I’m spending time doing something for you I’m expecting at least gratitude that I’m doing it and some understanding when we don’t have strict rule on either side and any of us can be caught in more or less relevant to “the job” stuff which can make delays in delivery.

This is what happened recently and as I follow the rule of failing fast my solution is to do things always with written rules. It can be for free if l like it. But with written delivery size and time. Just to avoid unnecessary misunderstandings.

Programming assingment #1 – Booking tickets

This entry is part 1 of 1 in the series Programming assignments

Programming is fun. Often I have problem to find a issue I want to solve. With that in mind I start to publish my programming assignments I’m making for myself.

Today we will have simple microservice to manage concurrent ticket bookings for “events”. Let’s say Iron Maiden announces small concert for 100 people on all their social media channels with specific time of booking. Our problem is to handle big spike of traffic at the time booking become available.

Acceptance criteria:

  • Application creates event with poll of tickets of specific size
  • Application allows to reserve a ticket(s) for 1 hour
  • Application allows to transform reservation into real ticket
  • After Reservation times out and spot is available for other user
  • It’s impossible to reserve more tickets than available in the pool
  • After last reservation is transformed into ticket event is closed

I’m leaving proper communication of error out of scope but it’s always good to have framework which allows to communicate about state of the system to external clients.

I’m leaving rest up to you how you want to implement solution for this problem.

As always in software there is no one good answer as it’s “possible” to handle this kind of problem basically in any language with out without external libraries or services.

If you have any questions don’t hesitate to ask. I’ll do my best to answer as soon as possible.

Enjoy and good luck coding!