Sunday, March 17, 2013

Data structures (and friends) talk in London

I have done a talk in London about some data structures (and non data structures) that I like and found out recently. The point of the meeting to encourage people learn about more powerful data structures and concepts, because they can make our life easier and code cleaner.

Saturday, May 19, 2012

JEEConf Impressions



I've just got back from JEEConf. It is wonderful conference taking place in Kiev second year in a row. It is great pleasure to be able to listen live to many interesting and professional speakers from all over the world.

This year meeting was definitely a larger scale event than last year, more satisfying and informative. Thanks a lot to speakers, organizers and any contributors to such a great initiative. I would like to share my humble opinion to what was great and what could of been improved in certain ways. I went to talk on the topics I prefer, so I cannot give a review on something I haven't seen. Regret not having Hermione's Time Turner :P

Let's start. If I'll be a bit critical, please accept my apologies. I do not mean to offend and I certainly do not imply that I could have done a better job. I am very grateful for your work.

Play with Play!
I was really looking forward to hear about that Play! 2.0 everyone brags about. Great framework, building a foundation of Typesafe Stack, a platform from my so loved Scala world, claiming of being JEE itself replacement. And there would be definitely an alive person within a reach of a hand that tried deep this new platform and can tell many things about it. I've read a few reviews and I desperately planned to throw all possible questions to a speaker.

Unfortunately it was not mentioned that the talk is going to be about the old Play (1.2???), which is middle quality MVC framework, which brings eventually nothing innovative to web-development in Java. In the world of Grails, Rails and Django there would definitely no reason to switch to framework that has such a poor documentation. The only reason you would wonder in the forest of fresh undocumented code is innovation. Is there any innovation in Play? I would really like to ask, why saving a couple of chars in the code would make you use magically compiled, full of public fields and statics Model's child over simple annotated POJO? Modules in ZIPs? Forever tied to Hibernate? Custom dependency management? This sounds like a crime in 2012. When Play was written a baby dolphin died.

My personal dislike of how Play does things has nothing to do with the job speaker did. He honestly mentioned good things like testing infrastructure and honestly said that they eventually decided to use raw Spring. I appreciate him giving a professional review.

Introduction to ActiveMQ Apollo
Dejan Bosanac did a great job explaining of what is going on in his company. Many people we overly critical during the speech, where bugs on ActiveMQ have no relation neither to Dejan nor to ApolloMQ we were discussing. Concentrating on Apollo, their team is done a wonderful job. I played a lot with reactor pattern, NIO, lock free algorithms during my diploma project and I know that it is great, scalable and fast approach. It is impressive to hear them reaching almost 300000 msg/sec on 1 consumer - 1 producer benchmark with text messages (STOPM).

I've build an simple Google Protobuf echo service on my pet NIO network stack which gives 130000 m/sec and that with Disruptor, in memory storage, hardcore ring buffers and off heap ByteBuffers.  They have a production full scale enterprise ready application having twice as high performance (on this benchmark). I desperately need to learn how to code...

I've asked Dejan, they didn't use any ring buffers. Magic! What if they do tomorrow?

Performance optimization talk
Oracle guys, high class presentations, nuff said. Very informative, very deep, I've learned a lot even after reading many performance tuning articles. Bravo, thanks, awesome. This is must read/watch for any good developer. I wish guys had more time.

Becoming a Professional Java Developer
Thanks, thanks, thanks, Yakov. I said that I would be glad visiting this conference even with this talk only. He came, picked the correct questions and given truthful answers. The controversy started when some people mentioned that he taught audience how to lie :P

Why bother? The point was that "do not say this" approach can make you feel doing something not honest and not honorable enough to be worthy a sit in Camelot round table. Ok, let's investigate this. A job can be objectively lousy. A boss can have his ambitions. A company offering a job can not be interested in your great Prolog abilites. This question is who is going to feel better or work more productively if you moan about the truth. You can walk and complain that your a job is eventually moving entities back and forth filling out setters. Maybe it is really worth mentioning on the interview everything that would spoil a good impression of you, even though you are capable of doing a good job? This kind of truth is not that one that saves, but the one that shakes the boat in the middle of the ocean.

I would say that Yakov talk was really about the truth. More about the truth than any talk of saying that your goal it making world a better place. Eventually it is, but you would like to do this when being financially independent.

You would not catch on a daily basis an American director wishing to share his knowledge on how to make yourself more expensive to him. Thanks Yakov again about sharing your great experience that otherwise many people would gather for years. The need for your talk is observable because of the audience not letting you leave and relax. Do not be surprised when you get home and someone jumps out from under your bed saying "I've got a question"

Inject Injection
Missed big part of this making Yakov life harder. I almost did not hear the word "Guice" at all for last 20 minutes. Guys said that I've missed the part that had Guice in it.

Elevate your webapps with Scala and Lift
Lift is innovative. Lift is good. Lift is something new. It is tradition on Scala community of making something really new and shiny. Unfortunately never stopping on complexity. This feeling of Scala "if a next gen programming language should exist it should probably be close to this" applies to Lift. But sweet dreams. You would not expect a person making a store, a blog or a forum learning something as Lift deeply. What obvious is what works. Lift is a deep work. To use Lift you need to be a seasoned Scala developer. What's next? Monadic computations? PhD maybe?

Why such conclusion? I've seen a simple example given by the speaker. You can't just use it copy pasting, first compilation error will require you to understand it. To understand how it really works you need to understand implicits, closure context capture, higher order functions. Plus it is not a plain Scala code, but actually uses certain tricks with closures.

Lift is web framework for Scala. Knowing Scala you would probably pick Lift. Hearing good feedback on Lift would not make you put all this effort to learn Scala and Lift from scratch. Anyway thinking of having Lift to be a widespread solution is a good dream.

The speaker was very good. He told about a great tool and showed it's abilities. It is a good push for someone learning Scala and not being sure about the approach to web development in this wonderful language.

Hearing that Lift uses ground up custom implementation of actors was a shock however. Why not Akka?

Cassandra in practice
Vitaliy is always very professional and practical. You would not hear a word from him speaking about obvious stuff. He told about how Cassandra works and answered questions well. His assumption that everyone heard about Cassandra was quite quick, however everything was explained. Thanks.

Cheers anyone, feel free to tell me I am wrong, because I probably am.

Monday, February 20, 2012

Scala Overview Presentations

I would like to publish presentations from a small training I've given in the company I work. It is better to hear the explanation, but the slides still can be useful Lecture Lecture 2

Friday, February 10, 2012

Google Protobuf Maven Plugin

Recently I have a Maven plugin, that allows you to compile Google Protobuf proto files with Maven. The Main difference form other plugins that it works.

Enjoy http://igor-petruk.github.com/protobuf-maven-plugin/

Future release will download protoc.exe automatically.

Usage:

Put your *.proto to src/main/protobuf and don't forget to add 'protoc' to your path. (version 2.4.0 in this example)
<dependencies>
        <dependency>
                <groupId>com.google.protobuf</groupId>
                <artifactId>protobuf-java</artifactId>
                <version>2.4.0a</version>
        </dependency>
</dependencies>
<build>
        <plugins>
                <plugin>
                        <groupId>com.github.igor-petruk.protobuf</groupId>
                        <artifactId>protobuf-maven-plugin</artifactId>
                        <version>0.6.2</version>
                        <executions>
                                <execution>
                                        <goals>
                                                <goal>run</goal>
                                        </goals>
                                </execution>
                        </executions>
                </plugin>
        </plugins>
</build>

A couple of useful archetypes in Maven

Hi, I was doing some open source lately. Feel free to examine my GitHub page, any suggestions are welcomed. I have published some nice Maven archetypes that allow you to create ready-to-run Java and Scala Maven applications with a single command.

FAQ

  • Why should I make Maven project instead of IDE project?
    • Shortly speaking: Maven gives you more. It will download any Java library or Maven Plugin existing out there automatically if you add reference to pom.xml. It will manage site generation, testing, releasing and much more. If you give your source code to someone else, they will be able to build your project without setting up the environment, downloading libraries or changing their favorite IDE. Don't make IDE projects
  • What is a Maven Archetype?
    • Project Template. It allows you to create Maven project with some configuration by default. You just enter the name of the archetype, it gets downloaded, bootstrapped and magic happens.
  • How is your Java archetype different from Quickstart?
    • It will make your project automatically executable with 'java -jar', so after you build it, you can give the jars away to people.
  • Doesn't the method shown on this page do the same thing?
    • No, I just adds the dependency to jars JAR manifest, but where are these jars ? My archetypes use the same method, but plus it does dependency:copy, so all your dependencies appear in target/lib. Yes, you can do the same. Only I have done it for you, it is not a short pom.xml.
  • Something else?
    • Yes, compiler plugin that compiles Java 6 by default, JUnit 4.10 with a simple test
  • Why should I use your scala archetype?
    • First, everything that I said about java archetype applies here. Second, it does not require Scala installation. It is compiled by maven plugin and a version of Scala can be changed in one line. No more Scala SDK manual download.
  • I don't like something about your archetype?
    • Contact me, cuz this is only a first version, I would like to make these archetypes better.
  • What files should I give away after I build the project.
    • The main jar in target and lib subfolder. Run with java -jar
  • Why does lib contain my test dependencies?
    • This is small bug (feature) in copy:dependency. 'scope' is not handled correctly yet.
So let's try it, archetypes are already at Central

Create Java Project

mvn archetype:generate -DarchetypeGroupId=com.github.igor-petruk.archetypes -DarchetypeArtifactId=maven-archetype-executable -DarchetypeVersion=0.1

Create Scala Project

mvn archetype:generate -DarchetypeGroupId=com.github.igor-petruk.archetypes -DarchetypeArtifactId=maven-archetype-scala-executable -DarchetypeVersion=0.1

If you are a Unix user, I would suggest put these commands in scripts

Friday, October 28, 2011

Scala DSL, omg

Look how they've implemented Basic using implicit type conversion.

http://habrahabr.ru/blogs/scala/98288/

P.S. Also later found what this guy did, it's kills my brain

The best Scala actors explanation

Here is an awesome article that shows the power of actors and actors in Scala in particular

http://java.dzone.com/articles/scala-threadless-concurrent