Saturday, March 16, 2013

33rd Degree 2013, Warsaw

13-15 Mar 2013 in Warsaw - 3 days of great knowledge and motivation boost.
33rd Degree another time proved it's one of the greatest, if not greatest one conference in Central and Eastern Europe. First time it was held in Warsaw Gromada Hotel and in comparison to previous 2 years it was a good choice. It was held on 3 floors so there was no problem with room and access to toilets or snacks. Although there were about 900 attendees the impression of crowd was not so painful.
Everyday we could choose of 5 different tracks. Here I will summarize talks and workshops I attended.

Day 1

Sven Peters

7 Things: How to make good teams great


Sven works at Atlassian and spoke about 7 things that worked in his company to make great (agile) teams. He writes his blog at http://svenpet.com/
Most companies motivate employees by bonuses and commissions but what do they really motivate to? Usually they motivate to get bonuses and commissions, not to make good work. When companies find good people they put them in cages, they limit their possibilities, e.g. force to working in fixed hours, not buying license for tools. What can we do about it? We can sit and complain, make revolution (which usually finishes bad) or try to do little changes step by step. The last one seems to be better approach. Try to change your environment and let it grow. Here are the tips for you:
1) Flowtime - stay in productivity phase as long as possible, don't allow to interrupt it. In Atlassian they first set up flowtime hours when team locked themselves in a room, turned off phones, mail clients etc. and worked on a task. This habit started to spread over company with time but was not ideal. It happened when contact with team was needed urgently sometimes. To fill this gap the team assigned a first point of contact each time - a person who was not closed with others but served as a help to other teams whenever they needed some help. This was better. Other source of interruption are open working spaces and should be avoided. Surely flowtime has its drawbacks - setting attention on single thing may easily lead you to situation when you loose the focus on right thing and pass to the wrong path loosing plenty of time. It's important not to loose this focus.
2) Feed you brain - conferences, organizing coding sessions after work, trying out new things, learning new languages, all this stimulates brain to work better. You can move a meeting to lunch ('brown bag' meetings) or meet after work on a beer. That's often much better than official office meetings.
3) Say "well done!" - don't afraid to appreciate small things in your team, e.g. when someone spent 2 extra hours on client's problem appreciate it. Tell him he did a good job (even when mostly he screws things up).
4) Report robots - nothing consumes more time than writing reports which eventually are not read by anyone. Automate things that are repetitive. Collect data and put information radiators all over the office (a TV in kitchen, posters, etc.) This is better than to sit and read reports and you're getting naturally more aware of numbers than studying them. Finally everyone in the office knows the numbers, not only managers. People are more aware of what's the actual outcome of their actions.
5) Eat your worn dog food - when you build a product try it yourself before releasing to users. Give it to your co-workers for alpha testing. It hurts sometimes when your colleague from opposite desk complains about it but it's the fastest feedback ever. Think like a customer, understand customer better.
6) Do a special day - leave your current items for one day, pick up things that stack deep in your backlog and tidy them.
7) Experimentation time - check your cool ideas, build a prototype. In Atlassian they have 20% time for building project of the ideas, that can help company to improve product. It's called "innovation week". This starts usually after a milestone release when there's more time and none will be interrupted by current sprint. It starts with a meeting when team gathers all ideas. They make a plan, maybe a mockup and next day they sit 24h building the product. Day after they present the product to other people in company ("ship it day").

Dan North

Decisions Decisions


Dan spoke about daily-life decisions:
* builds: automated or manual
* testing: automated or manual, or test after, or test whenever
* architecture: synchronous or asynch.
* architecture: monolithic or small components
* programming: object-oriented or functional
* threads or single-event loops, or actors, or CSP (Communicating Sequential Processes)
Each decision is a trade-of. When we build solution the need should drive the solution, e.g. when hacking to find out proper architecture of many possibilities often writing code first sounds better than TDD when after all we don't know where we're going to, deleting code often but if TDD is quicker for you in such cases then use it. Do with what you're more familiar and leads you toward solution quicker. Premature optimisation is a source of all evil. Try hybrid solutions. Use Spike and Stabilise pattern - create product that works, ship it as quick as possible to get user feedback and then when the solution starts to form try stabilising it, cleanup some code, add more tests.
Decision whether use objects or functions is pointless, why not trying both depending on purpose? Same goes for builds. In some cases manual builds sound better choice - you pay attention to details which can be forgotten during automation. When product evolves so should your methodology. When automatic build took, say 3 minutes and you added new features it will slow down. You should tweak build process to enhance performance rather than allow it to live its own life - automation is misleading sometimes.
Automated testing is OK when e.g. testing repetitive set of data, but manual testing give other view, e.g. when clicking over UI you get understanding of user experience, you spot each change to the application when new features are added, how it impacts end user.
Short Software Half Life pattern - how long will I wait until half of my code will not be anymore there. It's good to divide software to small cohesive components, each of which does one thing (this is how Linux was designed). Each component has soft center and hard shell, means clearly defined interface with other components. It's then easier to throw out such component, rewrite from scratch than if whole system is monolithic - there's term called micro software architecture.
Evaluable architecture is one that's changing over time to adapt to user needs. Evaluable e.g. has nothing to do with DRY (Don't Repeat Yourself) principle of programming - analogically to DNA which takes main part in evolution: DNA does not refactor, it copies. Same for software - it's easier to remove part of a system if it's not coupled with other parts (this breaks DRY rule).
The conclusion of speech is that only when you know what you're trading off you can make informative decisions.

Ted Neward

Busy Developer's Guide to Iconoclasm


More about Ted is on his page www.tedneward.com
India produces 350 000 engineers every year. Along with India more eastern countries like Poland, Romania ships cheap engineers on market. At the same time automation is happening, machines take over jobs which not long ago were done by people. Can we avoid it? How can we protect our job?
We can't. We can evolve. Something that machine can't replace is creativity.
Nothing can replace people like those who invented Evernote or Dropbox.

These people are iconoclasts. They are people who beat 'status quo' for sth better for the World.
They are people who are brave enough to be driven by logical thinking, not group thinking.
Group thinking is dangerous. We are biologically wired to follow the herd. This is sth we should avoid.
Iconoclasts like everyone fear to step out of crowd, but they refuse that fear to influence logical decisions.
"Failure is only the opportunity to more intelligently begin again" - said Henry Ford.
Some iconoclasts finished dead when trying to force their ideas, some where more successful. The difference between them is that ones could convince people while other barely tried.
The social intelligence is sth that forms of how we perceive familiarity and feel reputation. This is how we should convince people to new ideas. We should step by step make them familiar with it and build our reputation. None believes someone unknown who at first glance talks bullshit according to what's commonly thought by group.

Erik Dörnenburg

Software quality – you know it when you see it


Erik spoke about quantifying the quality and presenting on charts.
The clue is to aggregate some information but throw away other, use graphic views and take data at right level. There are different metrics to be used:
- lines of code
- method length
- class size
- cyclomatic complexity (the number of nested loops)
- coupling between classes
- weighted methods per class
Eric shown several diagrams and pointed out tools that we can use to generate them:
InfoVis, Gephi, SourceMonitor, CheckStyle, iPlasma.
The same talk can be viewed here.


Tugdual Grall

Getting Started with Couchbase Applications Development


Tug runs blog at http://tugdualgrall.blogspot.com/.
Rational databases scale bad and it's expensive (Oracle RAC). NoSQL comes to rescue.

Couchbase is one of document databases. Entries are stored in JSON format. Architecture is as below:



Couchbase server runs on C++ and V8 JavaScript engine. Cluster manager runs on Erlang.
In comparison to MongoDB it has worse query language but better scalability. Usually the project lifecycle starts with Mongo and if it's enough then it stays on Mongo but if it needs more scalability, better performance it moves to Couchbase.
Search mechanism in Couchbase can be enhanced by adding ElasticSearch component.
Couchbase team is also working currently to release Spring Data package.

Day 2

Tugdual Grall

Workshop: NoSQL Workshop: Discover NoSQL Development with Couchbase 2.0


Good hands-on training of Couchbase. I've put materials at github. Especially useful is example of simple web app demonstrating all Couchbase operations.

Erik Dörnenburg

Architecture without Architects


Eric gave 2 metaphors of software development: 
1. Building houses. House architects need to deal with complex planning of every detail of the building before development has really started. Build phase is short in comparison to usage phase. Good idea at the time of development does not necessarily have to be as good after several years of usage. Refactoring the city is hard and requires good and detailed plan. This metaphor is not that close to software development where build phase and usage phase are mixed. We don't build software once and use it but constantly refactor and adapt to evolving requirements. More close to software development is 2nd methaphore
2. Gardening. Although more accurate, we prefer to call ourselves developers than gardeners. We wouldn't put gardener on our business card as it appeals to us with less social respect. However gardening is much like software development, it requires from gardener to constantly work on keeping the garden in right shape when time and surrounding conditions change (e.g. different seasons of year, changing climate, ageing of plants).
Software development has more to do with evolution which consists of:
- recombination
- mutation
- fitness function
The same happens in IT in Open Source and technical startups. This is not that architects can plan at the beginning and only once how product will look like. Many frameworks emerge but only a few become successful. Fitness function depends on number of people who use the framework.

Abstractions in software development are useful but you need to know the details underneath, e.g.:
Web application can get from server JSON containing url links to more details which can be navigated on demand. Same concept on mobile application won't work because limited bandwidths. Fetching details from links would be too slow. Other example is messaging abstraction. Let's have a method:
sendMessage(String topic, Message message) which nicely encapsulates whole stack of invocations from top to the bottom where network packets are sent. This abstraction works as long as you remember of max. size of message to send with MTU token of 15000 bytes. Otherwise the method gracefully fails, because the abstraction hides that detail. Here we come to term of 'mechanical sympathy' this is where software and hardware should work in harmony.
Reasonable architecture starts with simple concept and evolves when needed. It' said the architecture should be componential, but not necessarily at the beginning. The same as monolithic architecture can evolve to componential, the same a componential can evolve to turn multiple components into one, which is presented on pic below:

The conclusion is that architecture and development cannot be separated (as e.g. in civil engineering). 
We cannot do architecture upfront but it has to be validated by code. Most of the things that traditionally architects did (diagrams, design, documentation) should be done by developers, by tools or not done at all.


Pratic works at Triplingo and writes blog mypatelpace.com
The tips & tricks given by him are:
* users expect same performance on mobile as on desktop or even better
* 10 sec. maximum waiting time on desktop application but 3 sec. on mobile
* mobile Safari browser has only 25KB JavaScript cache, so do not use same JavaScript frameworks for mobile pages, e.g. instead of jQuery use zepto, xui, microjs
* use little CSS, JavaScript because it takes time to parse it (100ms/1KB), minify it (gzip)
* reduce DNS lookup on page, e.g. limit redirection (from mypage.com to www.mypage.com)
* load first necessary content and then the rest (adverts, statistics JS)
* do not use background image, use CSS gradients instead
* instead using images use icon fonts (free icon fonts here), they scale nice and take little size
* instead of shifting images on page use CSS3 animation.
* click event takes about 300ms for operating system to recognize, it is delayed depending on screen resistance, dust, etc. so instead on-click event use touch-start events and touch-end events.
* use websockets for persistence pipe with server instead of http


Simon is Tech. Evangelist at Oracle Corp.
He's done intro on Raspberry Pi platform - an ARM processor based board.
Project emerged from BBC Micro project started in 1981, which was to serve British college students with platform for learning computer science. In Feb 2012 first Raspberry Pi was released.
Raspberry Pi Beta Board.jpg
It contains:
- ARM 11 core 700Mhz processor overclocked up to 1GHz
- 256MB (release 1) or 512MB (release 2) RAM
- HDMI & composite video so can be connected directly to monitor
- 2x USB
- audio out
- Ethernet (release 2)
- header pins

It's available on market for $25 and $35 (release 2)
Simon demonstrated some real-life applications like:
- LegoMindstorm motor steered with brain waves
- mechanic arm steered with joystick
- voice synthesizer
Really full of fun presentation.


Katrin presented one of remote-work platforms - https://www.elance.com/
She also gave some tips how to start freelancing there: 
- specialize in what you do, do it very well
- create outstanding profile, add portfolio
- search only jobs that fits exactly your skills
Setting up freelancing business takes time and effort but is becoming more popular. It gives several advantages one of which is flexibility, but this is not a work for everyone.
After becoming recognized by clients freelancer can move to entrepreneur role, hiring people to accomplish his projects.

Day 3


Workshop led by Hakan Gurel - Amazon Solution Architect (hakan (at) amazon.lu) and Krzysztof Marciniec - Technical Sales Representative (marcinie (at) amazon.lu)
I have never used AWS before. This gave me a huge dose of new knowledge in reasonably short time, rather than spending hours on digging through Amazon jungle of documentation.
We succeeded setting up a Linux node with Python-based web application, configured db storage for it and set up load balancer in front of. The app front is simple - a photoblog, check it out at http://ec2-23-20-243-172.compute-1.amazonaws.com/. We got also one more course in pdf showing how to use AWS transcoding. I placed all materials at github.


Venkat on example of world great empires in history gave a few tips for developers:
* Leverage the power of democracy
Good leaders are those who create things and give it to people watching what they'll do with it, helping when they need it. In analogy to it Java is a dictator. It's enough to watch at exception handling mechanism which not like in dynamic languages when it's left to developer to decide wheather to catch it or not but forced by checked exceptions. Here Venkat recommends a book: The Wisdom of Crowds by James Surowiecki.
* Be adaptive
To fear of change leads to language stagnation
* Complecency and arrogance kills
As an example Venkat gave the time of Inks and Spanish conquistadors. Arrogant tribe emperor underestimated the little amount of Spanish soldiers, well armed in rifles and on horses, in comparison to greatly larger amount of his warriors but armed with spears that led his civilisation to death.
Same in software, new powerful languages emerge. Arrogance leads to bad decisions. Language wars are pointless.
Recommended book: Guns Guns and Steal
* Revolutionize, not resist.



Hadi works on JetBrains, is a Developer and Technical Evangelist.
More about him on his page hadihariri.com 
He spoke about different software development methodologies, how they try to be cure for everlasting problems like: scoping requirements, planning sprints, dealing with bugs. 
Numerous methodologies emerged like:
SCRUM
Lean
Pomodoro
NOOO (not only object oriented development)

Having all that rumour we're often loosing focus on the right thing.
All about it is that not learning new methodologies and technologies or languages really matter but helping people. Innovation is about helping people, making their life easier. The talk is also on vimeo

The hackaton was held along all 3 days of conference in the evenings. Actually it already started the evening before conference. During that time guys created a nice working thing that we can all watch here and check code at github:


Thursday, February 28, 2013

OneWebSQL competition


Lately I'm spending most of the time on building my ego :))
First since very long time I've even won sth
http://onewebsql.com/konkurs-spring
http://e-point.pl/co-nowego?news_id=1500144,rozstrzygniecie-konkursu-na-najlepsza-aplikacje-webowa

My solution is available free on github. I must admit I would change a few things though, especially presentation layer - I would rewrite it in AngularJS.

Monday, February 25, 2013

MongoDB for Java Developers - 10gen Course

The course has just started today.
So far this week I gone through MongoDB installation, basic queries from mongo shell and Java application. I've also learned Spark Micro Web Framework and FreeMarket templating engine.
So far so good.. exercises were not to difficult and possible to go through in one night.

I've setup github project for this course at https://github.com/piczmar/MongoDB4JavaDev/

Sunday, January 6, 2013

Grails read-only domain class


Grails does not provide simple mapping to mark domain object read-only, means so that dynamic find methods (find, get, list..) work OK but save/delete is forbidden. This is particularly useful for legacy databases.
We can however provide desired behavior with low effort ourselved.
I could think out at least 2 ways of doing so:
1. listen on beforeXXX methods in domain class e.g.:

class Demo {

    static constraints = {
    }
    String name

    transient beforeUpdate = {
        throw new RuntimeException('update not allowed')
    }
}

2. send error status from controler REST method that is not allowed, e.g.:


    def delete(Long id) {
        response.sendError(405)
    }

If you just want to disable an attribute of a domain class from being editable in scaffolded view you can use constraint:

class Demo {

    static constraints = {
         name(editable: false)
    }
    String name
}

Monday, December 24, 2012

Groovy Tips

Here are some productivity tips for Groovy development. Provided you have GROOVY_HOME/bin added to your path you can execute following commands:

  • running Groovy shell
groovish

Type 'help' or '\h' for help.
-----------------------------------------------------------------------------------------------------------
groovy:000>
you can e.g. type: 
   
Sting.methods.each{println it.name }

  • running graphic console

groovyConsole


  • running uncompiled Grovy on web server
1. Add groovy.jar from $GROOVY_HOME/embedded to server classpath (WEB-INF/lib)


2. Add groovy.servlet.GroovyServlet to WEB-INF/web.xml.
3. Place your Groovy scripts wherever you'd normally place your JSP files.
4. Create hyperlinks to your Groovy scripts


  • automatic imports
Groovy automatically imports:import packages:
java.lang.*
java.util.*
java.net.*
java.io.*
java.math.BigInteger
java.math.BigDecimal
groovy.lang.*
groovy.util.*


  • method pointers
In Groovy you can do the following:
def shoppingList = []
def add = shoppingList.&add
def remove = shoppingList.&remove
add "Milk"
add "Bread"
add "Beer"
remove "Beer"
add "Apple Juice"
print shoppingList


  • operators
The following are operators and corresponding methods:
OperatorMethod
a == b
   or
a != b
a.equals(b)
a+ba.plus(b)
a-ba.minus(b)
a*b a.multiply(b)
a/b a.div(b)
a%ba.mod(b)
a++
   or
++a 
a.next()
a--
   or
--a 
a.previous()
a&ba.and(b)
a|b a.or(b)
a[b]a.getAt(b)
a[b] = ca.putAt(b,c)
a << b a.leftShift(b)
a >> ba.rightShift(b)
a < b
   or
a > b
   or
a <= b
   or
a >= b
a.compareTo(b)






Thursday, November 1, 2012

All these new fancy web pages..


As a Java developer with long time experience I always found touching web pages a tiresome task. Messing up with all the HTML and JavaScript code, digging into CSS to make JSP render as expected was not an obvious thing. Still it is not. This is mainly because I never had enough time to understand CSS and JavaScript and I admit it was never priority number 1 knowing each web browser have its own specificity  I just thought it' snot worth of trying. Better concentrate at Java word where most of the things is standardized and behaves as expected.

This was until I started to work closely with SmartClient and Grails.
Working closer with SmartClient library opened my eyes how much JavaScript evolved over the last years, how rapidly it develops and how amazing possibility it gives in comparison to what I met in legacy software in which it was just a little addition to all HTML rendered on server side. Now JavaScript is the place where all moves, flickers and rocks while server side is doing some business calculations not caring at all about front-end. It just takes data and returns data in desired format like JSON for instance.

Seeing a great potential in JavaScript I decided to learn more about it. By change there was a training organized in Poznan, Poland titled 'JavaScritp for Java Developers'. Wow, I thought  this is exactly what I need, so I subscribed and I was not mistaken. The 2-days training gave me a feel of how to write modern JavaScript pages using technologies like BackboneJs, RequireJs, UnderscodeJs. I even learned there are unit tests written for it using libraries analogical to JUnit in Java word. It looks all this new JavaScript is not that far from ideas I know from Java world.

Still not sure if this is me who found JavaScript or JavaScipt found me, but today I came into another blog post that gave me a kick to learn more in this field.
Article written in Polish can be found at http://mamstartup.pl/felietony/2882/jak-buduje-sie-strony-internetowe-w-2012-roku and author's blog is here, also quite interesting.
The author is pointing out many interesting tools used in modern web development.
I hope to give them a try so I set up a project on github where I plan to gather some demo code of my trials with it. For now there are some web scaling example with CSS available.

I also found good designer's resources at http://www.smashingmagazine.com/
Some free e-books can be downloaded from here but I've downloaded the pdf and copied it to my github.




Saturday, September 1, 2012

My first meeting with Closure

I got inspired by video of life music hacking jam session http://www.youtube.com/watch?v=WXovdAEV_mI&hd=1
so that I wanted to try Overtone project myself.
First you need to install Lein which is a kind of depency managet for Clojure.
You can follow with instructions at https://github.com/technomancy/leiningen/#installation
What I did on Windows was downloading lein.bat from https://raw.github.com/technomancy/leiningen/preview/bin/lein.bat and stand-alone jar from https://github.com/technomancy/leiningen/downloads
Then I had to set env. variable LEIN_HOME to my local dir, e.g.: c:/tools/lein and put the stand-alone jar in
c:/tools/lein/self-installs
and add LEIN_HOME to PATH system variable so that lein.bat could be found globally in system.

Then when I typed
lein
in system console it downloaded missing Clojure dependencies and welcomed me with message:


Leiningen is a tool for working with Clojure projects.
Several tasks are available:
check               Check syntax and warn on reflection.
classpath           Write the classpath of the current project to output-file.
clean               Remove all files from project's target-path.
compile             Compile Clojure source into .class files.
deploy              Build jar and deploy to remote repository.
deps                Show details about dependencies.
do                  Higher-order task to perform other tasks in succession.
help                Display a list of tasks or help for a given task.
install             Install current project to the local repository.
jar                 Package up all the project's files into a jar file.
javac               Compile Java source files.
new                 Generate project scaffolding based on a template.
plugin              DEPRECATED. Please use the :user profile instead.
pom                 Write a pom.xml file to disk for Maven interoperability.
repl                Start a repl session either with the current project or standalone.
retest              Run only the test namespaces which failed last time around.
run                 Run the project's -main function.
search              Search remote maven repositories for matching jars.
show-profiles       List all available profiles or display one if given an argument.
test                Run the project's tests.
trampoline          Run a task without nesting the project's JVM inside Leiningen's.
uberjar             Package up the project files and all dependencies into a jar file.
upgrade             Upgrade Leiningen to specified version or latest stable.
version             Print version for Leiningen and the current JVM.
with-profile        Apply the given task with the profile(s) specified.
Run lein help $TASK for details.
See also: readme, faq, tutorial, news, sample, profiles,
deploying and copying.

Now I can start playing with Overtone...
Then you download sources from github:

git clone git://github.com/overtone/overtone.git

and build project with

lein deps

Now launch REPL and follow according to steps at Overtone github:


The quickest way to get started is to launch a clojure repl using lein. In the overtone project directory....
$ lein repl
Then make some noise :)
user> (use 'overtone.live)
   ...wait a bit...
user> (demo (sin-osc))
For a better experience try Overtone in emacs or Overtone in vim.
Unfortunately that ain't that easy and first command: (use 'overtone.livebrought me to error message:
--> Loading Overtone...
UnsatisfiedLinkError Unable to load library 'scsynth': Nie mo┐na odnalečŠ okreťlonego modu│u.
  com.sun.jna.NativeLibrary.loadLibrary (NativeLibrary.java:169)
I wish you were more lucky, I will come back to resolve it in a while..stay tuned...



Soo.. after a while I'm back with a different approach.
I followed the following steps:
From command line execute:
lein new tutorial
cd tutorial 

edit project.clj generated in folder tutorial and add dependency:

(defproject tutorial "1.0"
  :dependencies [ [org.clojure/clojure "1.3.0"]
                  [overtone "0.7.1"] ])

Then type:
lein deps
Install SuperCollider (http://sourceforge.net/projects/supercollider/files/Windows/) - during installation enter installation folder name as SuperCollider, without version number. I'm not sure if otherwise Overtune will locate scsynth.exe correctly.

Start REPL (https://github.com/overtone/overtone/wiki/Starting-a-REPL)

lein repl
Type commands:

(use 'overtone.core)
(boot-external-server)

and start playing... (https://github.com/overtone/overtone/wiki/Getting-Started)