Friday, November 27, 2015

Setting basic response http headers for REST resources on a simple Vertx Rest based app #vertxio #vertx

I am new to Vert.x but as a Java developer (die hard) I find it much more enjoyable and promising comparing to NodeJS or whatever - Reactor based frameworks/libraries. So I was going through implementing a very simple Restful API, using Vert.x.

My problem for today is that I wanted to include some certain HttpHeaders in most (all) of my , responses. For example set the Content-type to "application/json". In the future maybe add some others.

I was kind of wondering around as a Vert.x newbie, then I kind of realized that what is was eventually suggested in this blog post (See the use of BodyHandler) would actually work for me.

So I had my main VertxMain java app where I register my MyWebVerticleApp.

Then I have created a small handler, I call it BaseResponseHandler, that eventually adds the HttpHeader in my responses.

Then in my MyWebVerticle I just register the handler to be invoked all the time, in the router chaining.

Friday, November 13, 2015

Devoxx Belgium 2015 - Final thoughts #devoxx

Well yet another Devoxx is over for me, it must the 5th of 6th time (or more) can't remember to be honest. It's 3 years since my last one, so it was kind of a come back :).

Devoxx (Belgium) is growing, actually it is the first time that I have seen so many people. The venue must have increased the overall amount of attendees (3500?). That also means that it was the first time that some times, I did not managed to enter some talks due to the vast amounts of people waiting. Amazing and kind of a bummer, when you wait in line and then you cant go in. 

The biggest change, just introduced this year is this. Yeap it is real, all the talks are already available online, in high quality. It is becoming a trend I guess these days, the same happened with JavaOne 3 weeks ago, you can find all the sessions here.

By the way I have composed a smaller public list in youtube, with a certain selection of talks that I managed to watch and some that I missed, so you can try my list as well. 

This year I think I made a mistake, I skipped the first 2 University days. It seems that there were more talks or people that I would like to watch in the first 2 days than in the rest. So it was kind of a small disappointment for me.

It is more than obvious, especially after the 'release almost instantly to youtube thing', that developer conferences are eventually becoming the place where you get to see some important people, get in touch with the community, do networking rather than accessing content which seems to be a secondary priority.

This year I was happy enough to see again good old friends from the global Java community and say hi, hear about their status in person and let them know about my new establishment, away from Greece that is. At the same time though, I kind of missed a lot of familiar faces as well, so yes I did get to see a lot of 'stars' but also a large group was not there. I am not sure if the dates and the fact that Devoxx Belgium is so close to JavaOne or JavaZonze, relates with the above. 

In the past 6-7 months unfortunately (or fortunately depending on how you see things), I got the opportunity to do more research on technologies, try things, rather than get to my day job and code or maintain some legacy stuff.  Which was kind of cool but not exactly my type of thing. So I was already full of new content, fed either by free content from recent conferences or some subscriptions to 'e-learning' sites. So, this year I did not took so many notes on things to try or consider.

When it comes to technology trends, of course Devoxx is mainly a Java Developer's conference so Java is relevant in this context. As you will watch is some talks, we are entering a phase where technology trends are eventually hitting us more and more often, we are kind of overdosed not every 5 or 10 years but almost every year or half a year with the next big thing. I can still remember a couple of years, about alternative jvm languages,javascript & javascript etc. This year it was all about, functional programming, micro-services, containers . These are the trends.

I am very relieved that there are a lot of people out there (either in their talks or talking with them),  are trying to build a wall of rational (as I envision it) , trying to impose things like ' think before you buy or jump the next big thing',' technology A or technology is not going to fix your bad project' ...fighting the silver bullet culture.

That is all, I hope that next year I will be able to make it more conferences, actually I very tempted to try if possible Devoxx London. See you there maybe or in a talk @ Luxembourg where I currently live. 

Keep coding and loving Java  :) 

Devoxx Belgium 2015 - Conference Day 2 #devoxx

This is my short review of the day.

Java 8 is slowly increasing its adoption rate. I think this is a good thing and this is what the speakers and many people from the industry suggest.  In Java 8 we have a tone of new language features, some of them are being demoed a lot in these recent years (e.g λ expressions), but there are more stuff, maybe less fancy that can make our day to day coding, especially in the JavaEE space more productive. Solid talk about all these new features that we can all use as of today. When it comes to the use of  async, and streams within 'contained' code bases, personally I think that this is a paradigm mismatch and at the time being, they are not adding anything special neither making stuff simpler.

One of the best talks today. Tony Printezis was member of the jvm team back in the Sun Microsystems days, in these last 2 years he has been part of the JVM team within Twitter. Yes Twitter heavily relies on the JVM, a fork of the OpenJDK that is being modified or patched by this small team of 4. Th service code of twitter is mostly written in Scala, and runs on thousands of JVM instances! He provided us with some very impressive metrics regarding their platform usage (of course this is Twitter). He elaborated on some of the most interesting garbage collection and performance errors/bugs spotted during high peaks and how they managed to solved the problems either by patching the JVM or changing the configuration. The Twitter JVM team is following the main-stream releases of OpenJDK and occasionally gives back fixes. Currently they have not plans on releasing (open sourcing) their modified version. 

Α very interesting talk by Mario Fusco where he tried to explain that switching from the O.O to functional mindset and programming is not rocket science. In some sense he is right but I still believe we have a long way to go and it might the case that functional programming is not a silver bullet. He  compared with real code examples, the 2 approaches. There were some cases where I was kind of lost with the examples and notes around the the 'Monad' pattern. Some of the examples were featuring the JavaSlang library, which seems a very nice thing to check and consider if you are about to go this road. 
CDI 2.O is coming 

A talk from the spec lead  Antoine Sabot-Durand and  José Paumard around the things to come in the CDI 2.0 spec. A lot of things are already published + some draft releases. I like CDI, the more you use the more you love it so my only comment is- release it asap and let's all hope is going to be 'implemented' by vendors soon enough.

I've red some stuff all these months around the MVC 1.0 spec (the Spring MVC equivalent in the JavaEE world). I was very curious to find out some more details. I have to be honest, after the talk I kind of felt that there might be cases where I will have to remember my action based framework days. It felt that we are going back in time in this case, re embrace action based frameworks (which were totally fine, Struts believer here). Maybe I'm just a bit in favor of JSF in it's current state? I dont know, I left the room thinking of the days where we needed to code a paginated table...using actions and a lot of javascript. Do we really need to have now yet another action based framework? Time will tell.

On a side note I have been following Ivar Grimstad's work, especially one his project called Snoop, a service discovery 'module' for JavaEE code, which I think is a very cool.

The best talk for me today. Thank god there are people out there, like Milen Dyankov , that talk about the principles of good software engineering in times where every buzz word can be inherited by developers or managers and promoted to the holy grail of everything, the one solution that will make things right in your old or crappy project.

Thank you Milen Dyankov that you pointed the obvious, that microservices is not a holy grail, that no matter if we do microservices, or monoliths or soa or whatever, we need to have clear, simple and modular architecture. People still tends to forget this thing.

So when this talk is out in youtube, in a couple of hours, spend some time and play the first half. Save it somewhere and the next time your colleague or your manager starts buzzwording around, send him/her the link!