Tag Archives: java

(first ever!)Drive-In conference: Java edition

This year is a different one. COVID has changed the world drastically. What seemed usual before is considered as something to avoid these days. Regular in-person meetings may even be prohibited. The most conferences in the world were postponed, moved online, or even cancelled. This was the destiny of jPrime 2020 as well – we have decided to cancel it, since we truly believe that for a community conference live interaction is one of the most important parts. We sincerely hope that humanity will find the cure for this awkward disease and quite soon everything will go to normal. …normal in terms of 2019, not the new “normal” we have right now… and in 2021 we’ll have our jPrime conference back

As a result, all of the community activities almost frizzed. All of the in–person meetups were cancelled. Some of them went online with a variable success. Some big (even payed) conferences like Joker and Jpoint moved totally online with quite big good feedback.

In BGJUG we were a little bit “hibernated”. After 5 really intence years of community meetups and conferences we gave ourselves a summer break.

This relax time helped us to recharge our batteries and get prepared for some new activities!

Earlier this year some of the isolation restrictions were removed and we could return to semi-normal life. One of this “semi-normal” activities became the Drive-In cinemas – often seen in the western world, but quite rare in Eastern Europe. Actually it is very good combination between safety and “real-life” experience. The spectators are sitting i their cars, the snacks and drinks are delivered on request, the sound is directly transmitted to the cars via FM radio.

Our colleagues from EPAM Bulgaria have tested the idea to use this Drive-In cinema to deliver talks, and everything went smoothly! So they offered to us to make a joint event specially for the Bulgarian Java User Group. This was an opportunity not to miss!

We have started the preparation in August and on 30th of September 2020 this event became a very successful reality!

i’ll be quite honest – all this preparation was thrilling! I missed it so much!

For this type of conf there are several restrictions. Since it is an open air, it should be dark outside. Fortunately in September it is getting dark earlier. We had to fit in the slot 19:30 – 22:30. We have decided to make 4 sort time slots each 30 min. long. We have also tried to test different presentation formats:

– live

-semi-live

– .. and prerecorded

We had two great local speakers who came specially for this event (one of them from another city). They have delivered their sessions live.

Together with Adam Bien we have made a live prerecording of his talk with a small community of listeners in a confcall. This brought the “live feeling” in his talk. It is great honor to have him at our Drive-In conf!

And our special virtual guest Dr. Venkat Subramaniam has prerecorded specially for us his talk!

We had pop-corn beer and hot–dogs available for free for our attendees! Huge thanks to EPAM for sponsoring everything!

Let us take a look how it all happened!

Some preparation:

Kick-ing of the conf!!! (I am nicely parked by the regulations)

Image
Image

With a good social distance!

Our first speaker Kostadin Golev presenting live about good coding practices!

Our attendees are carefully listening in their cars

Food and beverages available all the time!

Image

Our first experiment – a semi–live prerecorded talk by the great professional and speaker Adam Bien. I am happy there is some my voice recorded there and transmitted to the audience. It was really very “live experience”!

For the attendees who came without cars, there was a special lounge with a good social distancing. To be clear, it is allowed not to wear masks at open-air events in Bulgaria.

Our next speaker came Stefan Angelov from Plovdiv to share with us some knowledge about Java and Deep Learning!

And as our final speaker we had the honor to have Dr. Venkat Subramaniam, who delivered a wonderful talk about some new features in Java 15! The audience was thrilled!!!

Everything went soothly! We were fully booked and all the park places were taken! We are really happy that people came from different cities, not only Sofia! We had attendees from Burgas (~400 km), Plovdiv, Dobrich (~500km), Haskovo, Vidin, Stara Zagora, Veliko Tarnovo… Many of them made their long way specially for this event!

Image

But all the good thing come to an end. 22:30 sharp we have closed our first ever Java Drive-In conference. As some of or speakers were prerecorded, we are holding their signs, .. to make them semi–present 🙂 Huge thanks to our speakers!!

It was like a breath of fresh air! A great new experience with all the safety precautions! Finally the long events pause is over!

I have received a lot of requests like “When is the second edition?” “We want next such event ASAP!”. Even some some speakers wrote me “When is the CFP for the next edition?”. This makes us very enthusiastic!!!

Huge thanks to EPAM Bulgaria, who were the generous sponsor of this event! THANKS A LOT!

I have made some research.. looks like we are the first in the world to make a Java Drive–In conference! It is a great new “pioneer” feeling! It is priceless! We love this innovation!

By the way, we have invented a Drive-In way of applause! Just take a look how awesome it is!!!

(thanks to EPAM and BGJUG for the photos)

WebAssembly for Java developers

What is Webassembly

A lot of things have changed since the first web page was published. Back in the days it was a static text file with some html markup. For the last so few decades web pages evolved to some really thick clients allowing a lot of interaction and having a lot of functionality running in the browser on the client side. There was only one issue in this evolution – the only way to develop this functionality was using JavaScript. This scripting language, designed exactly 24 years ago, was not designed to be used to build such heavy or involved functionalities. As a result, today’s web faces a lot of performance issues and is really bound to one and only technology. Modern browsers sometimes do real magic to speed up the performance of web pages, but it is obvious, We should not try to work around the technology limitations by throwing more hardware, compute and memory resources at it. Every time we load a web page, we load HTML, CSS and JS data, we parse it, create AST, optimize it, compile or interpret it. It is a huge waste of resources.

Since it is really hard to break de-facto standards, W3C has created an extension technology called WebAssembly. We should be clear here – this is not a full replacement of JavaScript, but an extension, focused on high performance.

So, according to Wikipedia, WebAssembly (often shortened to Wasm) is an open standard that defines a portable binary code format for executable programs, and a corresponding textual assembly language, as well as interfaces for facilitating interactions between such programs and their host environment. The main goal of WebAssembly is to enable high performance applications on web pages, but the format is designed to be executed and integrated in other environments as well.

Wasm code (binary or bytecode) is intended to be run on a portable virtual stack machine (VM). The VM is designed to be fast, to parse and execute than JavaScript and to have a compact code representation. A Wasm program is designed to be a separate module containing collection of various wasm-defined value and program types definitions expressed either in binary or textual format (that both have a common structure).

Except in a virtual machine, wasm can also be compiled to native binary (with 3rd party compilers), and this is an easy way to release something that is not usually native as native, as long as it doesn’t require heavy runtime libraries.

WebAssembly is a fairly new technology and its development is in progress. But there already is an MVP (Minimal Viable Product) implemented in the most of the browsers and available out of the box. But, to make it really worldwide standard, we need some more time!

There have been around 40 programming languages reported to support Wasm as a compilation target. Java and Kotlin are among them!

https://hacks.mozilla.org/2017/02/a-crash-course-in-assembly/

Various tutorials are available in YouTube and other platforms for better understanding WebAssembly. It is strongly recommended to get more acquainted with WebAssembly before reading this article.

What about Java?

Let us try to create a WebAssembly from Java code. For this we have several options.

One of them is JWebAssebmly, which is is a Java bytecode to WebAssembly compiler. It uses Java class files as input. That it can compile any language that compile to Java bytecode like Clojure, Groovy, JRuby, Jython, Kotlin and Scala. As output it generates the binary format (.wasm file) or the text format (.wat file). The target is to run Java natively in the browser with WebAssembly.

To export a Java function to make it accessible from JavaScript, you must add the annotation de.inetsoftware.jwebassembly.api.annotation.Export.

As a result the following wasm will be generated (text representation):

To import a JavaScript function to make it accessible from Java, you must add the annotation de.inetsoftware.jwebassembly.api.annotation.Import. The method can be declared native or can have a Java implementation which will be ignored on compiling.

The project is very young. It is only version 0.1 so there are a lot of limitations.

Another option will be TeaVM.

We can set it up as s regular maven/gradle dependency:

Write some Java code of the stuff we want to export as a Wasm binary. @Export annotation tell us that this function will be visible from JavaScript

With a maven plugin we specify where to export the generated WebAssemblies (take a look at the TargetType):

Then just prepare the html file:

And the JS file:

And we are done! Now we can code in Java, compile it to wasm, and run it on the client side!

You can play with this code here https://github.com/dalexandrov/WebAssemblyFromJava

How about Kotlin?

They did it their own way. Since Kotlin has an experimental project Kotlin/Native, which has the compilation target of LLVM, it serves as a base to generate wasm binary out of it.

We should only specify a build target of “wasm32” in our gradle build script and as a result, on the output, we should get wasm binaries and a JavaScript wrapper to work with this assembly.

This project is still experimental and there are a lot of thing to be done. Unfortunately, the documentation is also “in progress”, so you will need a little hacking to play with it. But it is a lot of fun!

Can we use Webassembly from Java?

On the other hand, Java can also “consume” WebAssembly, or to be more precise GraalVM can do this.

In his article Aleksander Prokopec has announced that GraalWasm currently implements the WebAssembly MVP. Further reads here: https://medium.com/graalvm/announcing-graalwasm-a-webassembly-engine-in-graalvm-25cd0400a7f2

As a conclusion..

As a wrap up, we can say that WebAssembly is a very young, but a very powerful technology. It is still in MVP stage, with a lot of specs yet to be implemented (like multithreading, SIMD, etc).

But even now WebAssembly can run with speeds up to 1.2x native. And even now we can offload many server-side activities to the client’s browser and avoid performance issues. And we are able to do this from Java world.

Additional resources:

My talk about Webassembly and Java https://www.youtube.com/watch?v=93z9SaLQVVw

Further reading about Wasm and graalVM https://github.com/neomatrix369/awesome-graal#wasm

Thoughts on microservices: Throwawayware.

Картинки по запросу throw away this

Microservices.. yes, nowadays they are everywhere! In my previous post I’ve shared my thoughts that sometimes just a monolith can do the required task without being cut into microservices. But it is wonderful if microservices are the most suitable solution! This is definitely lovely!

First, we’ve got a lot of benefit it provides to us, second, we’ve got a great technology support to implement them – there are a lot of frameworks and platforms helping us develop some really good microservices.

The most of the conference talks I have recently seen are basically “Hello world” talks. The main message is “Hey, look how easy it is to create a microservice!”, “Just few annotations, and you are up and running!”. How great this is!

But when it comes to real life, most usually between start of the project till the first really useful microservice there is at least one sprint. More often three sprints. You’ll say – “That is ok! We are serious people doing serious enterprise!”. I still ask myself – “What can be so huge in one microservice, that it may require several weeks to be created?”. “Why then this service is called MICRO?”

I’m not sure if there is an official definition of a microservice, but a well-established idea is that it is a piece of software which is designed to perform only one single function, but in the best possible way. It should communicate with the rest of the world with the most lightweight protocol possible, like REST. So, if we have a login functionality, a microservice should be able to login a user in the most fast, easy, reliable, secure way. Only login and nothing else. For logout there should be another service. The size and complexity of such a service are not in scope of micro, they can be of any scale. Technically, there should be only one function exposed, but what happens under the curtains are just implementation detalils.

This is why, the most of such services become really complicated, often even overengineered. From my experience, at the end of the day, each microservice in enterprise webapps becomes a usual three-tier application. It has its “UI” simplified to REST endpoints, it has its business layer with several services interfaces and their implementations, an infrastructure layer to talk to DB and other services. The interlayer communication is done via value objects. As a result, a usual call of a function of this microservice ends up with several data coping from one value object to another (in one of such microservices I’ve seen up to 14 of such hops). Why would you do this? The typical answer is if some part of the service changes, we will change only this part of it. Fair enough. If in return I ask, how many times in your life have you ever changed one of the tiers without affecting the others? Тhe answer is usually – never.

Once again, nothing wrong here. The complexity of the implementation of a microservice is orthogonal to the interface it provides.

Another question: how many times have you ever received a fully functional “freezed” interface definition? The spec that never changes? A guaranteed never to change document? In my case – never!

The changes are coming constant or even increasing speed. Even in terms of one API version. You may say: You are doing it wrong! You should plan more carefully, you should rethink your spec versioning policy etc. And you will be completely wright!

But.. there is something called real life! There are business needs that require quick reaction, quick change, quick time to market!

Looks like this constant change is just inevitable. For my 13 years in software development there were practically no projects that had really smooth stable development. A least every sprint there were some “tiny” spec changes, causing all codebase to suddenly go red. I’m sure I’m not the only “lucky” having this.

How should we solve this kind of problems in the microservices world? Its quite time consuming to create beautiful, complex, nicely architectured, (at least) three-tier microservices without frozen spec. As I already said, those spec changes usually require changes in all of the layers. This is hard! Most of us thought that’s just the way it is. Software development is hard.

But this situation kept me bothering. May be there is a way to expedite this change reaction? May be a microservice should be micro in all aspects? I mean really tiny? With as less internal abstractions as possible? Really tight coupled inside? When I’m writing this, I have a feeling I’m breaking the law. It is like I’m cancelling everything I’ve learned from the CS courses in the university. Why don’t we throw away all of the … tiers? Make it a really tiny one-tied micro monolith? A microlith? So that the object or even a direct line with data we receive from the infrastructure we transform to JSON object in one single class? With all the business logic also included in this one and the same class? You are absolutely eligible to say – “are you nuts?” What if the infrastructure changes? What if the Rest API changes? What if the business logic changes? You have to rewrite everything!

And then I suddenly say – “Yes! We will rewrite this service from scratch!”. Luckily, a lot of code in the service can be just generated. So, yes. We will rewrite it from scratch! We copy/paste. We do all the possible anti patterns. Only to make it work according to the spec and pass the tests! “But isn’t it a lot of effort?”. My answer is – “Pretty much the same as changing all of the classes in all of the three (or more) tiers!”. And people usually say – “Hmm…”.

This may sound really strange, but through several last projects, writing some really ugly small one tier microservices with really almost no architecture and no refactoring, then rewriting this from scratch saved me a lot of efforts. I have even created a name for this piece of software – “Throwawayware!”. Try to say it quick!

The next question that usually comes is – “Do you put this ugly thing in production??”.

My answer is: – “Ok, you got me! No, this does not go to production! May be sometimes..”. What actually goes there?

Putting this ugly little thing in production will be just catastrophic. That’s why I’ve tried some mixed approach.

First of all, we usually develop the tests to follow the contract. Yep, although I’m not a big fan of TDD, I think this is a good place to use it. Adjusting the tests to follow the spec and the contract is always the first priority to us!

Then we usually have 4 to 10 iterations on each microservice in this ridiculous “throw away” way. Funny thing is that up to 50% of the services do not even survive through those iterations! At some point the service may come obsolete even before production. This means that we usually save a lot of efforts for not creating something complex for something that will never be used (“Bingo!”).

Then when the service gets through those several iterations, we consider this service as “survivor”. At this time usually, the spec stabiles as well. And we do the same for each API version.

Just like the Garbage collector in JVM.. Haha! Yep, like the GC! Lovely!

For the survivors we usually make some really complex refactoring, or rewriting it completely new. We try to make their code really readable, expandable and maintainable. Quite often from the usage of those “throw away” implementations we can see some before unpredicted usage cases, like for example the pressure it should hold, or security, or fault times etc. This may end in three-tier architecture, but with really nicely designed layers.

Looks like this “two stages approach” works really well! Funny thing is that it fits perfectly in our SCRUM cycle. May be, I’m wrong, but this approach saved us a lot of effots and helped us establish good quality implementations in shorter time. In three projects so far.. We’ll see how it goes!

Any critic is welcome though…

Trip Report: DevoxxUA 🇺🇦

Картинки по запросу devoxx ukraine

In the beginning of this year I was quite skeptical, that I will make more then 2 conference, including the one I’m part of – jPrime.

But the end of the year was definitely very intense. After coming from St. Petersburg I had the pleasure to speak at several local events, including the oldest and most prominent local conference OpenFest. It was a great opportunity to meet not only Java programmers, but also to talk about different platforms and languages as well.

As I was in Oslo and St.  Petersburg Ukrainian guys Andrii Rodionov and Oleg Dokuka approached me and invited me to submit a talk to the inaugural Devoxx Ukraine. So I did it, and very soon I’ve received an email saying I was accepted! Actually I was quite happy, since I haven’t been to Kiev for more than 5 years already.

The girls from the organisers helped me a lot to get all the invitations and was able to enter Ukraine without any problems!

By the way, that was the first time I had a direct flight to a conference, without any layovers. This is so much great! I’ve started appreciating this fact!

The conference takes place in a beautiful congress centre “Parkoviy”,

with a beautiful view of the Dnipro river. Well.. at this moment it was a foggy day (like the most of the days in November in Kiev)

The venue itself is very nice and modern..

There was even a car parked inside!

The entrance (or I would say – “the portal”) was extremely cool!

Actually the theme  of the conference was like “You are in a spaceship!” which is really lovely.

Unfortunately I was there only for the second day. I’ve missed some cool sessions like the keynote by  the famous scientist Lawrence Krauss.  It’s also sad, that I’ve missed the BOFs at the end of the day, I’ve started enjoying them a lot. I like this live discussion that happens in between.

But what I definitely really enjoyed was the first session of the day two – “Software Engineering Theory vs. Practice: A Song of Ice and TireFire” by Baruch Sadogursky and Evgeny Borisov.

It’s not very much technically oriented, but the topic about the “Technological maturity”  of a company is something I really have to dive in. I often find myself asking why we need this or another technology to solve current problem. Is the technology we’ve chosen able to solve this problem in the most efficient way and are our teams ready to implement it. Definitely a good talk!

Now I’m looking forward to see the videos of the talks I was not able to see. There were a lot of them running in parallel, the choice was hard!

As for my talk… the was a challenge for me: I had to talk in parallel with awesome Orkhan Gasimov, Doug Stevenson, Nakul Mishra, Reza Shiftehfar,  Mary Grygleski .. and Dr. Venkat Subramaniam. But I was sincerely surprised when I had my room completely packed with extra chair and people standing..

So I’m very grateful for all people that have attended the talk! I hope that the attendees will find good application of the technology in their projects!

I’m happy to have received this awesome comment!

And as always – conference is meeting great people! And finally meeting them in person!

Like Michael Simons! Finally we have talked to each other in real life!

And Rafael Benevides with Dr. Venkat Subraniam

And many many more!!

As I was late to the lunch after my talk, I was arranged a special very Ukranian lunch made of borsch, vareniki and salo!

This definitely made this event very special for me! I’m really grateful to Alina and Irina for arranging it for me!

It was a wonderful conf. Made with all of the Devoxx traditions!

I had a lovely stay! I’m very grateful to everybody who made it possible!

Bye bye, Kiev! Till the next time I hope!

 

Trip Report: Joker 2018 🇷🇺

Image result for jokerconf

It will be a bit strange to call this blog post a “Trip Report”, bearing in mind that I’m fairly local. Yep, technically I’m living in two homes – St. Petersburg, Russia and Sofia, Bulgaria. So coming to Joker was kinda switching home, but to make it more unified I’ll still call this post a “Trip Report”. A trip report to Joker Conference!

There is one disclaimer I have to make: in this post I do not follow any timeline. Here I just want to share some thoughts and emotions.

So, what is Joker Conference? This is Russia’s biggest Java event, which usually takes place at October/November  in St. Petersburg.  The city itself is now unofficially considered as a technological hub, accommodating a lot of IT offices and foreign representations. Like Oracle for example, they used to have a big R&D office in it. You may be surprised, but Java ME for example, or the biggest part of lambdas in Java 8 were created in St. Petersburg. Now, for some reasons, there is no more R&D, but some other activities. Still a lot of banks, telecoms, retailers, aerospace etc have some quite big R&D offices in St. Petersburg. The Universities produce a lot of very qualified developers to satisfy the huge needs for that.

So, as a result Joker is a big conference. There are usually about 1500 attendees.

The conference is run by JUGru group, and it is absolutely professionally organised.By professionally I mean that conference organisation is their main job. Joker was the first one guys&gals have made, now there are more than 15 conferences they manage. And they  are not only Java oriented.

This was my fourth Joker Conference, and I kind of see its evolution.

For me it all started back in 2015 when it was held in one of the hotels and it was sincerely crowded, but starting from 2016 the conference moved to the Expoforum – a huge expo center near the Pulkovo airport.  This venue definitely has opened some new possibilities like convenient transforming auditoriums, big expo and dining area. The venue is really one of the best I’ve seen in my vast “conference junkie” career.

The stage is cool!

And there is a lot of attendees!

The conference has mixed Russian/English set of sessions, so the speakers were also mixed local and foreign. The audience is mainly local. By local I mean Russian/Belorussian/Ukrainian/Kazahk – or in other words Russian–speaking. But the quantity of foreign speakers grows constantly trough the years, and I consider this as a good sign. All the visa barriers are handled gracefully by the JUGru team.

Russian conferences tend to focus on more hardcore topics. Just introduction talks receive the lowest scores. Russians prefer hardcore stuff! Yes, the talk should be hardcore, with a lot of deep dives, algorithms and case studies. If you can describe, for example, why your JVM consumes few bytes (or gigabytes) more than expected, and you know what experimental flag to put in the JVM params to stop it from doing this, describing in implementation details why this actually happens – this will be a cool talk! You may say, oh, isn’t it kinda JVMLS? Not exactly, dissecting Spring Boot or some Micronaut or Microprofile stuff is the expected topic. Not just knowing that the framework/technology can do this or that, but how actually it does it, and what are the corner cases causing unexpected bugs.

Yes, hardcore is highly tolerated! Why am I saying this? Actually I know this from the source. This year I had the honor and privilege to be invited as a member of the program committee. We had a wonderful team of eight – Gleb Smirnov, Victor Polischuk, Andrey Kogun, Oleg Anastasiev, Vladimir Sitnikov, Ivan Krylov, myself and first Valentina then Daria, to select the best possible talks for this conference. So, we were able to preview all the submissions, make rehearsals, make corrections in the talks, sometimes even redo the talks from scratch. Yes, you’ve got me right. On this conference (or actually on all JUGru conferences) the committee actively works with all the submissions and the speakers themselves. If you submit your talk to Joker – be prepared, that in few days someone from the committee will contact you and ask you for a rehearsal.

Many foreign developers  find this weird. They usually say: “Hey, hey man, I gave my talks at JavaOne, Devoxx etc. I had my rooms packed. Why should I do a rehearsal?”. But at the end of the day, those who accepted to rehearse usually say: “Damn, that was so much useful! And the feedback you gave me is so valuable! And that was totally for free!”.

As a result – the content is very strong and nicely prepared!

This is one of the key aspects that makes this conference kind of unique – a very intense content preparation. Usually the committee starts its work half a year before the conference, and active rehearsals are made until almost the last day before the conference.

By the way, there was even special time slot for direct interaction with the program committee.

Image may contain: one or more people, people sitting and text

Another thing I’ve seen only on Joker are the discussion zones. Every speaker, after giving his talk, is usually invited to answer questions about his talk or continue the discussion. This usually lasts for an hour.

Image may contain: 2 people, people standing

Image may contain: 2 people, people standing

In case of Dr. Venkat Subramaniam and Josh Long those discussion zones have lasted up to three hours. People had so many questions, and they both were answering them all that time!

This year’s conference continues its growth not only in terms of quantity of attendees, but also in terms of activities. There were two additional stages set in the expo area, so that the companies a the booths are able to present some quickes at the breaks.

The booths were also full cool stuff.

Image may contain: 5 people, people on stage

Image may contain: 1 person, crowd and indoor

Btw,  unlike other conferences, it’s not easy to win a prize at these booths. To do this, you have to solve several weird programming problems, most of which are like puzzlers.

Image may contain: 6 people, people smiling

There were also so called experts areas set, where every attendee was able to ask the strangest questions  about certain technology to the coolest programmers and solve their concrete issue! .. Or ask them to sign a book!

Image may contain: 7 people, people sitting

Everything was done to keep everybody busy till the late night (literally) the day one ended up with several cool BoFs. Together with Shelaev, Pangin and Chuyko we have hosted one of them regarding moving to Java 11.. And it was pretty cool! We had a very good discussion, with a lot of interaction, … and we were forcibly stopped, since this could have run all night long! I’m not totally sure whether the Java 11 was considered as a game changer, but one day we will have to migrate to it. The main discussion about it was, as expected, should we pay starting from now???

Image may contain: one or more people, shoes and crowd

Image may contain: 11 people, people sitting, crowd and outdoor

The activities at the conference hadn’t been strictly about knowledge but fun too, like a big exhibition of retro computers and games everyone could try playing.

As always the greatest part on each conference is meeting great people! I’m definitely happy I could meet Sebastien Blanc.

So much great to meet Gerrit Grunwald! I think the last time we have met was in SFO in 2015!

Together with the coolest Tagir Valeev watching Andrey Pangin’s talk.

With the so cool JBaruch (as a JFrog)!

It was great to meet with Ivan Uglyanslki from Novosibirsk!

A great honor for we was to meet in person Robert Scholte – one of the maven creators! It was also great to discuss the future of maven with him!

And we all had a lot of fun!

I liked a lot talking to John McClean not only about Functional programming but about Irish music as well.

https://twitter.com/DataDuke/status/1053722000223596549

This is the most OMG picture I’ve ever taken:

It was very interesting to talk with foreign speakers not just about the technology, but also about Russia. The most of the speakers are for the first time in the country, and it is very delightful to hear that they like the town of St. Petersburg a lot! Some of them have said: “They show us different thing on the TV..”

And by the way (yes, yet another by the way), on this conference I was not only part of the committee, but also a speaker. I gave a talk about Microprofile.io based on the tutorial we have done together with Ivan St. Ivanov from our BGJUG. My session was scheduled as last of the day one.  Surprisingly the room for 700 people was almost packed! Never thought so many people would like to dedicate their time on Friday evening for the ” bloody enterprise”.

Image may contain: 1 person, eyeglasses

I would like to say huge thanks everybody for coming! I hope this will be useful for your next projects! I liked the phrase several people have said – “Oh, this microprofile is like the light in the tunnel for the enterprise! This is great! It is so cool the technology is evolving so fast! And the community is there to help!”

At the end of the second day, as a final nontechnical keynote we all have listened to a very both interesting and strange talk about people’s digital mental health by famous in Russia Dr. Kurpatov.

Image may contain: 1 person

Actually there were a lot of take-aways for me from this talk. I still keep training my personal multithreading, but at the same time I train the concentration on a particular important task I have to finish on time with great responsibility.

And the last but lot least thing I should mention – just before the conference, the previous day the world’s greatest java speaker Dr. Venkat Subramaniam gave  his wonderful two (technically almost three) hours jug session. I was very happy to meet him after he came to jPrime to Bulgaria earlier this year. It was absolutely great to have his book signed for me! I’m feeling blessed now!

fbt

As expected, it was fully packed on this event!

Just to mention that this event took place at the Oracle office in St. Petersburg. Like every other building there it looks like a palace!

Image result for келлерман центр

 

So, Joker was great! As always great! Getting more and more great!

Thanks Andrey!

Thank you Alexey!

And thanks to the team! It was huge honor and pleasure to be part of this event! Hope to see you next year!

Image may contain: one or more people and crowd

Cheers!

And St. Petersburg is just amazing in autumn…

Image may contain: tree, outdoor and nature

See you soon, beautiful home!

Image may contain: sky, cloud and outdoor

Trip Report: JavaZone 2018 🇳🇴

Hmm, too few posts. I definitely have to change this. In my defence I’ll say, that only for this summer I’ve visited 12 countries. But you will argue, that for example Josh Long (my hero) made 12 countries only for this week, and he still has written several blog posts for this time. And you a right, I’m too lazy, I have to post more often!

Finally I’m in the local Starbucks, my cappuccino is ready, looks like it’s a perfect time to remember one of the greatest adventures of this year so far – JavaZone 2018!

When earlier this year, in May, I have received this email telling me that my talk “Java and the GPU: unlock the massive performance” was accepted for this year’s edition of JavaZone in Oslo, Norway, I literally jumped out of mu chair shouting out “Yes!!!”.

Visiting this conference was definitely one of my dreams, I’ve heard so many good words about it! Now finally this dream came true. Huge thanks to the committee for accepting my talk!

Finally September has arrived, I’ve landed in Oslo and literally fell in love with Norway from the first site!

An express train brought me from the airport directly to the Oslo central station for only 19 minutes. You may ask – so what? Actually the airport is about ~60 km away from the city and we were cruising with more 220 km/h. And those trains are scheduled to make this route every 10 min. This so cool!

For this conf choosing the train was the best choice, as the venue – Spectrum arena is just next to the central station. The hotel was there as well. So we were perfectly located.

Oslo welcomed us with a grey rainy weather

But just 20 min later it was beautiful and sunny, like in every northern town

In the evening we were invited to the speakers dinner that took place in a beautifully located restaurant with some stunning views of Oslo!

Oh, thats Chris Thalinger also making some photos of this wonderful sunset. By the way it’s raining.

Definitely a wonderful place to relax before the conference. We stayed there until late.

The next day was the first day of the conference. The first thing I saw was the looooong queue of the attendees.

The good (or may be the bad) part was that my talk was scheduled on for the second day. So the first day I had a chance to explore a little bit.

The conference organisation, or I may even say “architecture” is totally different from all other conferences I have attended. The venue is a huge arena, where big concerts take place. There is a big central area where you can find a lot of software company’s booths.

 

Just take a look how big is it and how many people are in!

The conference kick-off was lovely with some guitar players

sdr

The coolest part is that practically all the booth serve their own food all day long! Yes, yes.. you can have food all the time, all day long.. all two days! There was only one major problem for me – I couldn’t taste it all! I haven’t had enough capacity! Definitely OMG.

But not only food, but tons of other cool activities

One of the unique features of JavaZone are the 8 parallel tracks. Yep, 8! That’s a lot! The rooms are themselves not very big, but that makes the cozy.

That’s me attending Vlad Mihalcea’s great talk.

And like every conference the main reward is actually meet and talk to people! Hey, that’s Chris (..and Doug)!

My good friends Simon, Simon, Phillip and my new friend Jennifer

Finally could meet Sharat Chander in person!

Awesome hardcore JVM company of Doug, Volker and Steve

The discussions we had were really useful to me!

At the end of the day we had a wonderful hangout with David, Vincent and Matthew

Then actually came the funny part. My talk was scheduled for 9.00 the next morning. I was sincerely wondering who will ever be interested in GPUs and massive parallel computation so early in the morning? I was a bit nervious wen my talk was approaching.

But I was ready!

So I was expecting a maximum audience of 3 people to show up. What was my surprise when I found my room fully packed!

Oh My God! Absolutely unexpected!

I sincerely want to thank everybody that came. I hope the talk useful and fun to you!

By the way, it became available just few hours later in vimeo! Cool organisation at JavaZone!

When I was done with my talk I took the chance to hang around the beautiful city of Oslo!

Definitely a beautiful capital!

JavaZone 2018 was a great new experience for me! I’ve seen a cool organisation, met great friends and made great ones!

I want to say huge thanks to Rafael, Rustam, Mark and all the team for having me and making this conf a blast!

At the end as always my best five IMHO sessions of the conf from those I was able to see myself live:

Now I’m on may way watching the other talks I’ve missed (and those I’m able to understand)! They are just great!!!

So good bye Oslo! Thank you for being awesome! Hope to see you again!

 

 

Java as a technology glue, or how to use GPU from JavaScript

Ah! It’s been a while since I’ve posted the last time!

But this year was quite a DE(VOXX)ED for me! First I had a chance to speak in wonderful Romania, then beautiful Vienna, after that amazing Lugano, then the loveliest Krakow, finally at the huge Antwerp event! In between I also gave some talks in my home towns Sofia –Java2Days and St. Petersburg – Joker! Let’s not forget that I was in the dreamteam of 5 to organize and run the coolest jPrime conf!

Quite an intense year!!!

So finally this weekend I had some time just to play. Of course play with coding!

As may be some of you saw, I’m really interested in the Nashorn engine to run JavaScript on JVM. I gave once some talks about it!

But not only this bothers me! For several years I’m interested in General Purpose computations on Video Cards (GPGPU)! I even gave some introductory talks on how to use GPU and Java together.

On Devoxx in English:

https://www.youtube.com/watch?v=BjdYRtL6qjg

And on Joker in Russian will be hopefully available soon 🙂

But! What will happen if actually unite these two my passions? How to run some code on the GPU but submitted from.. JavaScript!!!

You will say just use WebCL! But, isn’t it a little bit not ready yet? And as far as I know it is not exactly a full binding to OpenCL but mainly browser oriented stuff. Please correct me if I’m wrong. I’ve even played with some experimental drafts.

What if I want to utilize the full control of our computations on GPU through JS and make it very dynamic?

Yes, yes!! Nashorn is here to help us! And yes, we have the full power of the available bindings like those provided by JOCL!

So let’s do it! The usual example with vector add will be just cool enough!

That’s the JavaScript code:

I just put it all in jscl.js file.

As you in the beginning I’ve added some type definition shortcuts just to make code look more readable.

To run it in the console I just put:

JJS is available by default if you have minimum Java 8 installed.

The JOCL jar you can just get from their site.

And what we have (on my Mac):

Isn’t this lovely!!

Funny fact that is that because of the memory latency it about 700 ms no matter if I make 1k computations or 100m of them 🙂

Still, this may be good example of how Java/JVM can be a kind of a technology glue. Having in mind that there are more than 40 languages running on JVM, all of them can benefit from the de facto standard libraries already available for Java.

This is so much cool!! Have Fun!

Thoughts on Enterprise

I’ve always considered myself a Spring guy. I mean, it’s so cool to code with Spring! Spring is quite honestly the essence of the modern Java enterprise! It has everything for building an amazing, modern, scalable web application. The most of the routines are highly automated there. Just with few annotations you can convert some crappy POJOa into a real world working webapp. And it will work, it will scale, it will be testable! At some moment it came to a point that it’s not even required to implement some methods. Just annotate a method and Spring will read the method signature and implement the method for you! I believe that in the future you will just write something like:

You may lough, but just go to http://start.spring.io/ and it’s quite near to the idea above. Btw, it will be a cool idea to create a DSL to “talk to Spring”. I always liked and still like coding with Spring!

And then… suddenly, a disaster happened!

I had to start to work on a pure Java EE project! Oh no!

My first reaction was like: well, at least I will be paid for that.

At that period Java EE was considered as something big, outdated, sluggish.. at some parts even retro, with all the negative in this word. And my reaction was predictable since I had some “nice” experience with EJB 2. Yes, yes – EJB 2.0! Remember all this remote interfaces, local interfaces etc, etc. But after that I never touched it again. Good for me!

From several conferences I came to a feeling that Java EE just copies everything from Spring, and renames some of the annotations. And I said to myself – actually, that’s a huge plus for me! I just need to write @Inject instead of @Autowire.

So I’ve started the project and what was my first surprise? Of course it came out of maven. The pom file was really small.

And not more than 3-4 other small dependencies like Primefaces. And that’s ok! You have everything on board. And you don’t have to care about every API you use and every realization of that API etc etc. Unless you want to spoil everything, or, in other words, optimize.

And all of these ugly EJB 2.0 stuff is no more there. Everything is very nice and pure! Again with some annotations you convert your POJOs into beautiful enterprise webapp! Java EE is AWESOME!

So everything is standardized. And that rulez everything. In theory I don’t have to think about on what platform my WAR runs, it should demonstrate the same output every time I call something from my app. Realizing this was like OMG! So now we can develop one app and not think much of what dependencies to include. Take the app and drop it on every server supporting the current profile of Java EE. And we can make almost the same stuff as Spring does. Or I would say the really essential part of it with not so much sugar. Exactly – standards are the true essence of the common functionality widely used in the industry at its best! Damn! I’m in love! From now on I’m a Java EE definite fan! And always will be!

And I have discovered the power of the @EJB annotation!

So I’ve started digging in and then I faced some real life.

The first thing that blocked me was the … you are right – configuration! Every server is configured in its own way!!! So I can’t just drop my app and and make it work, I have to configure some datasources, security and many other stuff. Oh.. so now I have to ship my app with bunch of configs… a little bit disappointing. Still, I don’t have to ship my app with tons of custom libraries, or even with the server itself where it is all set up.

Then some other issues came like one with JAAS. So JBoss/Wildfly and TomEE they both support it but in some slightly different ways.. so in my code I had to put some ifs and see on which platform does the app actually run and call appropriate custom method.

Then the other issue came. The Primefaces upload worked gracefully on TomEE and didn’t even show up on Wildfly. With some insane magic I found out that if I remove the upload filter in web.xml the situation will switch to the opposite – it will work on Wildfly and stop working on TomEE. And that was predictable since at that point they used different versions of Mojarra..

So.. In theory I had to ship different web.xml files. But, that’s so much NOT beautiful! I spent one night almost in tears as I was unable to find a nice solution. But after some beer an in genius solution came to my head – create a server “on start listener” and fix all missing “on the fly”. That was so brilliant that the next night I didn’t sleep as well since I was drunk in the bar. I couldn’t withstand and put some other server depended config there. But that were just two other small things.

And what about the performance and the resources consumption? Surprisingly, the average memory consumption of this app written with Java EE 7. I was expecting something like several gigs, but it was only about 250 Mb RAM on TomEE with about 100 users connected. Not bad at all!!! I have even packed it as single executable jar with TomEE and uploaded on some of the cheap cloud providers. It performed great! Beautiful!

Btw. This app that I’ve written had to make some of Batch activities. And guess what? I didn’t even have to put any additional dependency in my maven or reinvent the wheel, since JBatch was already there in that Java EE provided dependency. I just used it! That’s so cool!

So Java EE can rule them all! In some cases, definitely yes, especially when your tasks are standard enough. And I may say, that from my decade in this branch the most of the tasks are quite standard. With really few deviations.

And what about Spring? With Spring you can do the same and sometimes more (and I wonder if it can do less). Yes, there are some differences in the “philosophy”, but it is obvious that many of the coolest ideas now available in Java EE actually came from Spring, or were deeply influenced by Spring. If there is a request to build something with very narrow Time-To-Market frame, I think I’ll first think about Spring, especially Spring Boot. There I can put some piece of code into real world production within just two hours. Although this can easily be done with TomEE or Payara as well. There are so many things available out of the box, like security, data, MVC, even batches! Batch is one of the examples how a Spring solution inspired the creation of a JSR-352. Btw now it’s the opposite – Spring Batch conforms the standard. It already supports the JBatch job declaration.

So they both do the same? Here is one small thing, rarely discussed. Spring is a proprietor solution. It’s a full ecosystem driven by one company, with a lot of open source efforts included. Still the evolution decision process is a bit different there.

So isn’t Oracle doing the same? I personally think that it has tried to do the same, but they couldn’t. Actually the Java EE standard evolution and support is driven by the Java Community Process. And unlike Spring Java EE is a standard, not a product. At the moment a discussion about Java EE end of life emerged the community and EE vendors started a campaign against those predictions. The well-known Java EE Guardians were formed, with a great support from the community and James Gosling himself. Four big Java EE middleware vendors have even started a common effort for creation of a fraction of the Java EE suitable for optimal microservices operation called Microprofile.io. And its fully community driven and open. The guys standing behind this initiative are really amazing! Truly passionate professionals that do care!

So Spring and Java EE are both comparable and incomparable. And I believe they both serve their needs, although in many areas they are overlapping.

I prefer even not to compare them but there is one thing we developers quite often forget – the financial part of the story. As written in the Adam Bien’s post Spring has its very clear support policy – upgrade or pay for the support. This once played some bad story for us. We have started the project with one version of Spring and somewhere in the middle a new version of it was released with some of the interfaces deprecated. This caused us some delays as we were dealing with updating our code. Still their corporate support is really awesome.

In terms of Java EE, it kind of moves this question to hierarchically lower level – to vendors that do implement this standard has their own support strategies. But the good thing is that they have to correspond to the standard, and the standard does not change too often. On the other side not all the issues can be solved entirely by some standard portable code. At some moment it comes to the point of “no turning away” when it’s necessary to switch to some, for example, underlying API provider specific optimizations. And the portability of the code declines drastically. But you still are not fully tied to one and only proprietor support, and switching it is much less painful. Btw. this question about equalizing of some of the parameters arose at the Microprofile.io multivendor session on the latest Devoxx.

So it’s a tricky question what is better. The answer is though very easy: well, it depends! It’s not always about the technology. A clear knowledge of how your app will perform and evolve can have more impact than just choosing the latest and the trendiest technology.

But if we take the just the technology itself, in my humble opinion Java EE and Spring are doing a great synergy together and move the Enterprise Java forward!