Most interesting links of December

Recommended Readings


Continue reading →

AWK: Extract Logs for the Given Date(s) from a Log File

If your log file has entries like these:

Continue reading →

Quiz: What's the Best Test Method Name?

Which of the following names of test methods do you think to be the best?

Continue reading →

Getting Started with Amazon Web Services and Fully Automated Resource Provisioning in 15 Minutes

While waiting for a new project, I wanted to learn something useful. And because on many projects we need to assess and test the performance of the application being developed while only rarely there is enough hardware for generating a realistic load, I decided to learn more about provisioning virtual machines on demand in the Cloud, namely Amazon Web Services (AWS). I've learned a lot about the tools available to work with AWS and the automation of the setup of resources (machine instances, security groups, databases etc.) and automatic customization of virtual machine instances in the AWS cloud. I'd like to present a brief introduction into AWS and a succinct overview of the tools and automation options. If you are familiar with AWS/EC2 then you might want to jump over the introduction directly to the automation section.


Continue reading →

Most interesting links of November

Recommended Readings


Continue reading →

The 3 Most Important Things I've Learned This Year

This is a technology blog but why do we actually use technology? We use it because we want to help people achieve something - and in the process of doing that we have to cooperate and communicate with many humans. The human factor is far more determining for our success than any kind of technology could ever be. Why do most project fail? Because of a bad technology? No - usually it's a failure of communication, leadership, process change. And this week I've learnt some very important things about this crucial human factor - and thus this post may well be the most valuable piece published here til now - or ever.

First, I've learned how we decide (and a project - IT or other - is nothing but a bunch of hundreds, millions of decisions, both small and big). To deal with the incredibly complex world around us, human brain has many decision strategies ranging from a very rational decision making to "gut feeling" decisions based on our emotions and subconsciousness. Every of these strategies is perfectly suitable for some situations (for example relying on emotions and intuition is often the best thing, conversely to what we've been thought) - and leads to suboptimal results (read: terrible failures) in others. Thus the single most important factor that determines how successful we are is our ability of metacognition, i.e. being aware of how we think, and thus being able to select the most appropriate strategy for the situation at hand. (Which might not be as easy as it sounds and may require that we "trick" our mind somehow, i.e. by distracting it or forcing it into a certain decision mode.) Jonah Lehrer documents that on the "Marshmallow experiment" - the children who knew that they got to distract themselves somehow not to eat the marshmallow, which they've been given, not only managed to wait those 15 minutes for another one but were also much more successful in their later lives - presumably because their ability of metacognition helped them to make better decisions more often.


Continue reading →

Where to Get Sample Java Webapps

I was unsuccessfuly looking for some decent, neither too simple nor to complex Java web application for Iterate hackaton "War of Web Frameworks". I want to record the demo apps and options I've found in the case I'll need it ever again. Tips are welcome.


Continue reading →

What Changes When You Deploy More Frequently and Why You Should Do It

This post is inspired by Kent Beck's excellent talk at JavaZone 2011 titled Software G Forces: The Effects of Acceleration where he describes how the development process, practices and partly the whole organization change and/or have to change as you go from annual to monthly to weekly, daily, hourly deployments. I'd like to summarize some of the points he made and use that as a ground for arguing that more frequent deployments are (in general) better.

I'd highly recommend you to watch his presentation as I will only reproduce parts of it (and as they are out of their original context, they might well not represent exactly what Kent wanted to communicate).

Kent argues that as you deploy more and more frequently, many things have to change including the business side of the software. What is a best practice for one of these speeds becomes an impediment for another one. With more frequent deployments teams have to progress towards the following practices, while leaving some other practices behind:


Continue reading →

Refactoring Spikes as a Learning Tool and How a Scheduled Git Reset Can Help

To learn how complex your code base really is and how much effort a particular refactoring might require compared to the initial expectations, follow these steps:
  1. Schedule git reset --hard; git clean -fd to run in 1 hour (e.g. via cron)
  2. Do the refactoring
  3. "WT*?! All my changes disappeared?!" - this experience indicates the end of the refactoring :-)
  4. Go for a walk or something and think about what you have learned about the code, its complexity, the refactoring
  5. Repeat regularly, f. ex. once every week or two - thus you'll improve your ability to direct the refactoring so that you learn as much as possible during the short time

Continue reading →

Principles for Creating Maintainable and Evolvable Tests

Having [automated] unit/integration/functional/... tests is great but it is too easy for them to become a hindrance, making any change to the system painful and slow - up to the point where you throw them away. How to avoid this curse of rigid tests, too brittle, too intertwined, too coupled to the implementation details? Surely following the principles of clean code not only for production code but also for tests will help but is it enough? No, it is not. Based on a discussion on our recent course with Kent Beck, I think that the following three principles below are important to have decoupled, easy to evolve tests:
  1. Tests tell a story
  2. True unit tests + decoupled higher-level integration tests (-> Mike Cohn's Layers of the Test Automation Pyramid)
  3. More functional composition of the processing

Continue reading →

How to Fail With Drools or Any Other Tool/Framework/Library

What I like most at conferences are reports of someone's failure to do or implement something for they're the best sources of learning. And How to Fail with Drools (in Norwegian) by C. Dannevig of Know IT at JavaZone 2011 is one of them. I'd like to summarize what they learned and extend it for introduction of a tool, framework, or library in general based on my own painful experiences.

They decided to switch to the Drools rule management system (a.k.a. JBoss Rules) v.4 from their homegrown rules implementation to centralize all the rules code at one place, to get something simpler and easier to understand, and to improve the time to market by not requiring a redeploy when a rule is added. However Drools turned out to be more of a burden than help for the following reasons:
Continue reading →

Tips And Resources For Creating DSLs in Groovy

Paul King had a very good presentation (last year's slides) at JavaZone about why to use Domain-Specific Languages and how to create internal DSLs in Groovy. I'd like to list here few tips that he has mentioned but before we get to that, why would you want to create a DSL? Martin Fowler answers that in his Domain-Specific Languages book (2010). Some of the reasons are to have a higher-level, more focused and conscise representation that also domain experts can read and perhaps even write. You  have certainly already used a DSL such as regular expressions, CSS, SQL, Spock's BDD tests, build instructions in Gradle - these are rather technical but sometimes DSLs are also created to be used by business users, f.ex. for anti-malaria drug resistance simulation. (Want more DSLs in Groovy?).

Paul mentions one important thing - you can always make your DSL better, i.e. more fail-proof (case insensitive, support plural endings, ...) and secure and more like a natural language but it all comes at a cost and you must evaluate when the cost overweights the benefit (beware the 80:20 rule).

Some of the Groovy DSL implementation tips:
Continue reading →

What Is CDI, How Does It Relate to @EJB And Spring?

A brief overview of dependency injection in Java EE, the difference between @Resource/@EJB and @Inject, and how does that all relate to Spring - mostly in the form of links.

Context Dependency Injection (CDI, JSR 299) is a part of Java EE 6 Web Profile and itself builds on Dependency Injection for Java (JSR 330), which introduces @Inject, @Named etc. While JSR 330 is for DI only and is implemented e.g. by Guice and Spring, CDI adds various EE stuff such as @RequestScoped, interceptors/decorators, producers, eventing and a base for integration with JSF, EJBs etc. Java EE components such as EJBs have been redefined to build on top of CDI (=> @Stateless is now a CDI managed bean with additional services).

A key part of CDI aside of its DI capabilities is its awarness of bean contexts and the management of bean lifecycle and dependencies within those contexts (such as @RequestScoped or @ConversationScoped).

CDI is extensible - you can define new context scopes, drop-in interceptors and decorators, make other beans (e.g. from Spring) available for CDI,... .

Resources to check:
Continue reading →

Book Review: Agile Project Management With Scrum

A review of and extract from Agile Project Management With Scrum by Ken Schwaber, Microsoft Press 2003, ISBN 0-7356-1993-X.

The book is basically a set of case studies about Scrum that show how to implement the individual aspects of Scrum, what are the common pitfalls and how to avoid them, and help to understand its mantra of "the art of the possible" and how to adapt Scrum to various situations. It's very easy to read thanks to the case studies being brief and organized by topics (team, product owner, ...). I'd absolutely recommend it as a third book in this domain, after a general introduction into the lean thinking (Implementing Lean Software Development – From Concept to Cash by M. & T. Poppendieck is great for that) and an introduction into Scrum itself. Scrum is not just a set of practices, it requires an essential shift in thinking. Thus it is not enough to learn about the practices - you have to learn, understand, and accept the principles behind. This book will hopefully help you to refine your understanding of these principles.

Extract

This extract contains the quotes and observations that I find the most interesting. It tries by no means to be objective or representative, a different person with a different experience and background would certainly pick different ones. Thus its value for others than myself is rather limited but it may perhaps serve as an inspiration to read the book. My all favourite quotes are in italics.
Continue reading →

Groovy: Use @Canonical to Get Compiler-generated Equals, HashCode and ToString

Groovy makes it extremely easy to create Java beans with getters, setters, equals, hashCode, and toString:

Continue reading →

Copyright © 2024 Jakub Holý
Powered by Cryogen
Theme by KingMob