RSS

Author Archives: gvaireth

I know what you committed last summer

Episode 31

            As promised, the continuation of Code of Principles is here. This time I’m going to talk about stuff that is less canonical and perhaps not so well known. Today’s motto is that you are not alone. There are strangers, psychopaths, users, fellow developers and good scouts out there.

Don’t talk to strangers

StrangerDanger_NeighbourhoodWatch_FINAL_ybg

            Let’s discuss Law of Demeter also known as Principle of least knowledge. Proposed in 1987 by Northeastern University, can be informally described in four bullet points:

  • You can play with yourself (naughty boy).
  • You can play with your own toys (but you can’t take them apart).
  • You can play with toys that were given to you.
  • And you can play with toys you’ve made yourself.

Which basically means that object should assume as little as possible about its environment, surroundings, its structure, properties and anything else, especially about Read the rest of this entry »

 
3 Comments

Posted by on August 18, 2016 in Clean Code, Sweet Sixteen

 

Tags: , ,

Code of Principles

Episode 30

            Enough about recruitment, let’s get back to code. This article is (more or less)  going to be a continuation of Rock SOLID Code. I’ve talked about five principles forming letters in the SOLID acronym, now I’m going to talk about further set of well known (hopefully) programming (and not only) concepts.

(K)eep (I)t (S)imple, (S)tupid

kiss problem

            “Everything should be made as simple as possible, but not simpler.” Albert Einstein once said. KISS acronym was coined by Kelly Johnson, U.S Navy engineer in the sixties. Basically, simple thing doing the same job as complex thing is better. It’s easier to understand which means being less error-prone, easier to maintain, cheaper and more efficient. Always try to Read the rest of this entry »

 
4 Comments

Posted by on August 11, 2016 in Clean Code, Sweet Sixteen

 

Tags: , , , , ,

Software Developer Interview: Your part.

Episode 29

            Now you will ask questions. Lots of them.

            As I have mentioned in the previous article, job interview is a symmetrical process. There are two entities – the Company and the Developer that meet in order to find out if they want to start a collaboration. The company will try to check if you have suitable skills, talents and how you handle different situations. They will ask you tons of questions. And you should do the same – carefully and thoroughly find out if the are suitable for you in each aspect you care about. Basically, you should have the same amount of time for your questions, as they had for theirs. Symmetry and honesty.

Project

            When you have technical people in front of you, ask them as much as you can about the project you are going to participate in.

  • High level business overview as seen by developer.
  • Technical overview.
  • Technology stack and plans for it.
  • Legacy problems, and if present, how do they deal with them.
  • Software development process: do they have Agile? Scrum? Scrum-but? Waterfall?
  • Do they have Continuous Integration? Automatic tests? Deployment at the push of the button?
  • How do they host their stuff?
  • How big is the project? How old is the code and how many people worked on it?
  • What tools do they typically use? What IDE? Can you use your favorite IDE and tools?
  • Will you have the level of autonomy you want?

Read the rest of this entry »

 
6 Comments

Posted by on August 4, 2016 in Misc, Recruitment

 

Tags:

Software developer interview questions: The soft part

Episode 28

            Soft is not a short from software here. In the previous article we went through technical aspects of Java developer job interview. This time we are going to explore the non-technical part or soft part or HR part or however you want to call it (it’s not just Java developer now, of course, but software developer in general). Sometimes you will talk with your potential team leader, project manager, line manager, other kind of manager, someone from human resources department or just a guy from dev team (hey, they can talk too!). They will try to find out if you will fit the organization, project or, in general, if you are the guy they would like to work with. I feel that developers tend to trivialize this part and think that if they are technically strong, nothing can stop them. However soft skills and personality plays a decent role in the recruitment process. After all, no one wants to work with an asshole, even if it’s technically brilliant asshole.

Up to the point

            So, I’m going to try to recollect these types of questions I’ve been asked on my recent interviews. As before, I’m not going to answer them, partly because I’m lazy and partly because Read the rest of this entry »

 
2 Comments

Posted by on July 28, 2016 in Misc, Recruitment

 

Tags: ,

Java developer interview questions: The hard part

Episode 27

            Since I’ve attended several job interviews recently, I’ve decided to share some experience with you. Why hard part? Because this article is going to be about technical stuff. I’m going to write something about soft part later. Technical interview will probably look a bit different depending on your programming background. If you are new, expect more core language / programming questions. Later on emphasis probably shifts more towards your actual work experience, technologies, frameworks and practical problem solving skills. I’m not going to answer questions (I’m lazy), just provide list of topics you might want to review if you are going to a Java interview.

General object oriented programming / design core

  • Explain polymorphism, encapsulation, cohesion, coupling.
  • Difference between inheritance and aggregation.
  • What does “clean code” and “technical debt” mean to you?
  • Describe some refactoring techniques.
  • Explain SOLID principles.
  • Other principles like KISS, DRY, YAGNI, law of Demeter etc.
  • What design patterns do you know, explain some.
  • What design anti-patterns do you know?
  • How would you design an amphibious vessel / math expression evaluator / a dragon?
  • What sorting algorithms do you know and what’s their computational complexity? Which would you choose having some knowledge about the data you are given?
  • Write a code that:
    • calculates a factorial of given number
    • does a Fizz Buzz
    • inverts order of letters in words of given sentence.
    • checks if given string is a palindrome.
    • enumerates all permutations / variations of given set of characters

Read the rest of this entry »

 
4 Comments

Posted by on July 14, 2016 in Misc, Recruitment, Technology

 

Tags: ,

No-ip hosting

Episode 26

            So, I’m back after a longer while. As a warm-up I’ve decided to write about dynamic dns and why it’s interesting for software developers.

            Suppose, you want to write your own web applications at home, and present them to the world, but you don’t have a static IP address. A common scenario. Back in the days when I had my first broadband Internet access I didn’t have that problem, I had my own IP. So besides spending countless hours on Battle.net playing Diablo II or WarCraft III. I was also playing with some PHP with MySql and building my homepage which I was proud to share (and nag people to create an account on it).

            Now, if I wanted to do something like that, I have basically two options: either I take the stuff to “The Cloud” meaning some external means of hosting, or I do it myself using dynamic dns service. The idea is easy – you setup an account on dynamic dns provider site, choose a subdomain and domain you like, download a client handling IP updates, forward appropriate (e.g. 8080) ports on your router and voila. You are a host now.

noip

            I’ve tested the no-ip.com and it’s ok for me. You can use three domains for free as long as you log on every 30 days and click a button confirming you are still alive and Read the rest of this entry »

 
Leave a comment

Posted by on June 30, 2016 in Technology

 

Tags: ,

Software Craftsman: Professionalism, Pragmatism, Pride

Episode 25

Not only working software, but also well-crafted software
Not only responding to change, but also steadily adding value
Not only individuals and interactions, but also a community of professionals
Not only customer collaboration, but also productive partnerships

Software Craftsman:  Professionalism, Pragmatism, Pride by Sandro Mancuso is the second book about the subject I’ve read recently. Thanks to Safari, even before the paperback edition is available on Amazon. Actually I had an occasion to attend the author’s talk on software craftsmanship at last Jax conference, but I’ve chosen in memory data grid which was probably mistake. Or maybe not, since we have everything on You Tube anyway.

softwarecraftmancuso

The book came thirteen years after the one I’ve talked about earlier. It gives you a bit of history of the whole idea of software craftsmanship, books, articles, conferences, events and things like that. The basic ideas are described in similar way, to give you a good basic understanding, but there is much more.

A lot has happened in past thirteen years. We had an explosion of the whole Agile and Scrum thing popularity. Simultaneously almost no one does Scrum the way it should be done. Some people are at least aware they have ScrumBut (“you know, we have Scrum, but…”), some don’t. Anyway there is quite a lot of material in the book about issues with Agile transformations and what to do with it. There are several archetypes of problematic personalities like The Sceptic, The Evangelist, The Ivory Tower Architect and so on, and tips on how to talk to them to make things better.

A lot of attention is paid to the topic of management and recruitment of software craftsmen. I especially liked examples of good and bad job descriptions and the elaborate logic behind it. Sadly, most recruitment processes are far from being able to attract good programmers. They are done by people who just think in years and acronyms.

Also, importance of technical excellence is discussed. Some people tends to believe, that if they employ Scrum to their project, things will magically fix themselves and everything will be great. Bullshit. If you had mediocre programmers who produced crap, Scrum meeting, roles and artifacts won’t change that. You need to change the way software is written and thought about. Continues integration, tests, refactoring, striving for technical excellence and constant learning. Nothing comes for free, except coffee. If your company does not provide free coffee, leave it immediately.

Important message is, that craftsmen are not paid to work 9 to 5, do what is told them to do and go home. True craftsmen care. They are far more than just coders. They are there to help client achieve their goals. Through coding, motivating, organizing, sharing their knowledge and most importantly striving to make things better and transforming their organizations. They need to talk to their client, and try to understand what is really to be done. Unfortunately many organizations are stuck in previous era and not ready for this. There was a story about project that had a sole goal of bringing code coverage of code debase to 70%. It was off shored to different company, no one explained them any business logic and all the original programmers were to busy to talk. As it turns out, the reason for that is because some manager had a yearly goal, and fulfilling it gets him a bonus. So he fulfilled it blindly. Well, some people just need a high five. In a face. With a chair.

noidea

I enjoyed the personal feel of the book. Author presents his American dream story (or British, in that case) of poor kid from Brazil who wanted to be software developer in London. Now he is the founder of London Software Craftsmanship Community. There are a lot of true stories from the trenches, which are lively, convincing and I had a feeling “hey, I had this one too… just like that”. For me it was much more enjoyable than Pete McBreen’s book.

Finally, do not expect that your employer will train you, educate you, buy you books or anything. If he does, that’s great, but this is your responsibility to learn, invest time, money, energy and passion to be good. You own your career. You shouldn’t pursue “career in an organisation”. You should pursue your own career. That’s your life, isn’t it? If organisation’s career map is not aligned to what you want, they way you want, simply quit. Don’t be afraid. Each job is just a step on the long staircase to mastery. Some are longer, some are shorter, lower or higher. Some will lead you down, not up. But it’s everything about the beauty of the journey. It’s not about catching the rabbit, but chasing the rabbit. Have fun!

How-to-Train-Your-Dragon-II-05

 
4 Comments

Posted by on December 7, 2014 in Agile, Books

 

Tags: ,

Vaadin Intro

Episode 24

While being in the topic of web framework research: another one I’m considering to use is Vaadin. It has been around for quite some time, over 10 years now, so we can say that it’s mature (or “old”, if you like). Anyway it has large and active community, and is quite popular which is always helpful.

 vaadin-logo-hi

Vaadin is a server side centric framework, meaning that all content is rendered to html and passed to browser on each request. It’s a bit old school approach. Nowadays it’s more popular to keep as much as possible on the client side, mostly as Java Script and communicate with server only when needed. Vaadin guys argue that server side approach is safer, because it’s impossible to temper with the executable code.

There are other pros and cons, but what is important to me, that current version of Vaadin uses GWT as rendering engine. As you may recall from previous article I’m a big fan of GWT, since I believe that having all code in statically typed language under decent IDE control is a must for any non trivial web project (I’m yet to meet a happy Java Script programmer after successful and pleasant refactoring). But enough introduction, let’s get down to business.

To start easily with Vaadin I recommend The Vaadin Book. You can get it for free from Vaadin website (after registration, but still nice move). In short: get the Ivy and Vaadin plugins for Eclipse, then create new Vaadin project. To make things simple, you can ask the plugin to create project stub. We will rewrite it just a bit then to get something similar to what we had in articles about GWT and Spring.

In order to get things going we actually need only two classes. First doesn’t even have any code, just two annotations and a parent. It’s a Servlet class with a standard url mapping (this time as an annotation) and some Vaadin specific configuration to associate with GUI content class. Also, it extends VaadinServlet.

The content class needs to extend UI and implement init method where the page is created and hooked much like in GWT entry point. The @Theme annotation is optional, it provides us a default css and makes our button look nice. I’ve also added a Service class as our “backend”. Since everything is on server side, you don’t need synchronous and asynchronous interfaces, rpc mappings, callback and all that stuff. Just create class and call method (it’s an example, in real life you would want to have some dependency injection here). That’s all, deploy on server, run and enjoy your Hello World.

vaadincode

Comparing to pure GWT, Vaadin is much simpler to start. You don’t need any html to hook your Java code. You don’t need server communication handling. You don’t need module definitions in xml. You don’t need dev mode and all the acrobatics to debug client side code. The price is however page responsiveness. I’m not sure if it’s a high price though, keeping in mind an average modern bandwidth and latency. And you still keep all the luxury of not worrying if your method gets three Cats instead of two Dog it expects.

There is also a possibility to write client side code in pure GWT and integrating it with Vaadin but it pretty much brings all the GWT complications back.

Still better than JavaScript :)

lovely_night_fury___how_to_train_your_dragon_by_mikilake92-d50tuim

 
Leave a comment

Posted by on November 23, 2014 in BookSentry, Technology

 

Tags: , , ,

Software Craftsmanship: The New Imperative

Episode 23

The book by Pete McBreen is one of the early books on the topic. The analogy of software development and medieval craft were suggested before in The Pragmatic Programmer and earlier articles.

software craftmanship

When I got the book my first thought was “I expected this to be bigger” It has only 180 pages. And font is quite large. And a lot of almost empty pages. But okay, never mind maybe author is very concise.

Classical view on software development comes from software engineering applied to large scientific or government project in sixties and seventies. Those methods are in turn rooted in old school management where knowledge on how to do job well lies in managers heads while workers are not paid to think but to follow an optimal way of doing things. Reality is very different though. It’s the programmers who know how to do their jobs well. And in order to succeed in software project, the key things is to find excellent programmers with reputation and get out of their way when they start doing their job.

Author emphasizes importance of programmers strive for mastery and ability to stand behind their creation and support it. Because ability to deliver well crafted software builds their reputation. In such scenario, developers choose their project carefully as wrong client is recipe for disaster.

Also there is a lot about managing craftsmen. Junior programmers are overpaid while Senior programmers are much underpaid usually. Author states, that it’s much better to have a team of 5 masters and pay them as much as 25 or even 50 juniors, because overhead of coordinating the work is dramatically lower and if each of them delivered successfully many applications before, there is a good chance it will happen again. The product will have much higher quality, will be easier (= cheaper) to maintain.

So what about those poor juniors? Well it’s okay to have few of them, but not majority of them. They should learn not only from seniors but mainly from intermediate developers. And whey the gain some experience, they should pass it along to new joiners.

Managers should get accustomed to deal with subordinates who earns much more than they do, and the dumbest thing you can do to a master programmer is to move him to management because this is the only way to ramp up his grade and payment. If your organization has such a model, it’s probably time to say god bye and find someone smarter.

In general, the book presents a strong parallel to medieval craftsmanship model. There are apprentices, who study for few years to become journeymen. The wander from master to master to learn the craft in humility, gaining reputation and crafting better and better software. Andy finally they become masters if they persist.

It’s not silly to be developer your entire career. That’s what I thought five years ago, but now I see that it may be a good path for entire life. Did you know that an average developer has now only five years of experience? Industry is in deep need of people who are doing it for ten or more years, have vast experience and are willing to share it. Yeah, new frameworks and technologies are sprouting on a daily basis, but a lot of core skills haven’t changed much. If you are ambitious and plan to be developer for longer, this book will make you feel good, that’s for sure. Even though author tends to repeat himself and charges 30 bucks for not that much of a content, I think it’s worth reading. And then dropping on your managers desk.

Currently I’m reading another, much newer book on Software Craftsmanship by Sandro Mancuso, and Pragmatic Programmer is in the queue. I guess I will share some thoughts on them in the future.

Hiccup sharpening sword

 
6 Comments

Posted by on November 16, 2014 in Agile, Books

 

Tags: ,

Google Web Toolkit intro

Episode 22

One hundred days of my writing have passed :) Today we are going to talk about a cool and somehow unique web framework. Meet Google Web Toolkit.

gwt-logo

What makes GWT so cool? You write all the client side stuff in Java, having all the power of statically typed language and power of your favourite IDE at your disposal. Its then automatically compiled to Java Script without having to worry if it’s for IE, Firefox or Chrome. Let’s begin.

First you need to install Google Web Toolkit SDK plugin on your Eclipse. A blue g icon will appear in the tool bar. Click it, Create a Web Application Project, enter name and package, uncheck Use Google App Engine and Generate project sample code as we will start from scratch. After finishing, new project will be created.

We will start with a module, New -> other -> Google Web Toolkit -> Module. Call it hello and finish.

Then we will create an Entry Point Class from the same menu, and use the hello module. Add RootPanel.get().add(new Label(“Hello World”)); in onModuleLoad method.

To root our GWT generated code in the web application, we need a html page, using wizard from the same group. You now need to provide a correct JS path in script src property, starting from the war folder. It should go like that: “<package>.<module>/<package>.<module>.nocache.js”.

Now we will prepare to launch our app in Dev Mode. This is a powerful tool that uses a browsers plugin to communicate with Eclipse plugin, recompile and push changes you made in near real time. After saving Java file, you just hit refresh in the browser and changes will be there. Unfortunately API for dev mode was dropped some time ago (WTF?) so you will have to either downgrade your browser or use older portable version. You will need Firefox 26 or older or Chrome 32 or older. I’ve used Chromium Portable version 24. You can get the plugin here. .

Select your project, Run As -> Web Application. It should start a new view called Development Mode. After several seconds it will start and display the link you should use in your browser with plugin, it will be something like this: http://127.0.0.1:8888/hello.html?gwt.codesvr=127.0.0.1:9997. Follow the link and enjoy your Hello World in GWT.

Let’s quickly look at something more. We will add a call to server in order to get the greeting. Since the client is operating in asynchronous mode, and server does rather the opposite, to tie them up you actually need two interfaces that express the same contract. Both goes to the client package.

On the client side the return type is void, while there is an additional callback argument that will get executed when the call finishes with data we need provided.

Methods on the server side interface returns the String we need and have an annotation @RemoteServiceRelativePath(“greet”) to bind the service implementation with request path.

The concrete service needs to implement our synchronous interface and extend RemoteServiceServlet and be placed in the server package. You will also need an entry in web.xml to bind the service class to servlet name and the servlet url from interface:

gwt web

Having the back-end ready we can come back to our entry point class. First we have to create the service handle. Then we will add a button with ClickHandler that will invoke the service. Finally in the callback code we will add a Label with String computed on the server side. Or, in case of problem, display the message from exception. Here is the Java code:

gwt

When you run this, after pressing the button, the Hello World! will appear after a brief moment.

Unfortunately as of version 2.6 of GWT Java 8 is still not supported, so you can’t exchange listeners definitions with concise lambda syntax yet.

Some people say, that GWT is dying. Lack of support for Dev Mode in newest browsers being primary reason for that often. Well, in fact there is something called Super Dev Mode which is going to fulfill similar role. I hadn’t tried it yet, but perhaps I will have to in future. Also, Vaadin is using GWT as their rendering engine, and they seem to be doing their best to keep GWT alive (they are organizing the GWT.create conference, for example). For me, writing Java code instead of JS is a huge deal. Yeah, there are frameworks for JS to make it more manageable, but still, this is dynamically typed language. No automatic refactoring. No way to automatically find all places where something is called / used. Typo in variable name found only in runtime. Maybe after working a bit with AngularJS, so hyped now, I will change my mind, we will see about that. Also, before committing to GWT in my project I wanted to check out Vaadin. See you next time.

412mtghRr-L

 
1 Comment

Posted by on November 9, 2014 in BookSentry, Technology

 

Tags: , , ,