cloning-heads

Are you getting worked up over code duplication?

As programmers, we have long learned that Duplication is the Ultimate Sin of programming. Even considering to duplicate something is almost unthinkable.

But removing duplication introduces dependencies. If you and I use the reuse the same piece of code instead of duplicating it, changes I make may affect you. This effect can anything from beneficial (I fixed a bug you also needed fixing) to benign (I added a new feature that you’re not using) to detrimental (I want it to work in a way that’s no good for you).

When we have dependencies, we have to think: “Perhaps I shouldn’t add that feature – what if breaks something for someone else?” “Damn the torpedoes, I’m hacking it in!” or “Perhaps I’ll just make a fork for my changes and we’ll merge later”. Continue reading

Kugel, JAVA, Programmiersprache, Sprache, plattformunabhängig

Run java web apps in embedded containers with Maven, Jetty and Tomcat

While developing java web applications is very practical to have quick feedback from a “real” environment. In this post I’ll explore how to run a java web application with Maven in an embedded container be it Jetty or Tomcat.  I’ll show how I have configured them for the development of podcastpedia project backing the Podcastpedia.org website.

Octocat Source code for this post is available on Github - podcastpedia.org is an open source project.

Continue reading

slick-logo

A fresh look on accessing database on JVM platform: Slick from Typesafe

In today’s post we are going to open our mind, step away from traditional Java EE / Java SE JPA-based stack (which I think is great) and take a refreshing look on how to access database in your Java applications using the new kid on the block: Slick 2.1 from Typesafe. So if JPA is so great, why bother? Well, sometimes you need to do very simple things and there is no need to bring the complete, well modeled persistence layer for that. In here Slick shines. Continue reading

A beginner’s guide to Cache synchronization strategies

Introduction

A system of record is the authoritative data source when information is scattered among various data providers. When we introduce a caching solution, we automatically duplicate our data. To avoid inconsistent reads and data integrity issues, it’s very important to synchronize the database and the cache (whenever a change occurs into the system).

There are various ways to keep the cache and the underlying database in sync and this article will present some of the most common cache synchronization strategies. Continue reading

AngularJS-small

What every Angular project likely needs – and a Gulp build to provide it

Starting an AngularJs project also means choosing a whole toolchain that goes along with Angular. In this blog post we will propose a set of tools that a new Angular project will likely need, and present a simple Gulp build that provides those features. Let’s go over the following topics:

  • Why Gulp? Goals for a baseline Angular build
  • Why use a CSS pre-processor, and why Sass
  • The advantages of a module system, and why browserify
  • Pre-populating the Angular template cache
  • Angular-friendly Javascript minification
  • Reducing the number of HTTP requests using sprites
  • Setup a development web server
  • Running tests with Karma, code quality with JSHint, and more

Continue reading

Is IntelliJ IDEA shining through Eclipse?

As a long time Eclipse user, I want to give a more serious look to IntelliJ IDEA. The people from JetBrains were very nice and granted me an open source license for the Podcastpedia.org  and Codingpedia.org projects. In the post I listed some of the things I use often in Eclipse and their equivalent in IntelliJ. I wrote this post so I can bookmark it and come back to, whenever I forget something, and if it helps others the better.

Continue reading

AngularJS-small

Why Angular is not only for single page web apps

AngularJs is often seen as a viable solution for building full scale single page web applications. Although that is a good use case for Angular, in this post we will explore how the framework can also be used to incrementally add functionality to any web page in general, in some cases with little to no Javascript needed (example). Continue reading