Unit Tests, How to Write Testable Code and Why it Matters

Unit testing is an essential instrument in the toolbox of any serious software developer. However, it can sometimes be quite difficult to write a good unit test for a particular piece of code. Having difficulty testing their own or someone else’s code, developers often think that their struggles are caused by a lack of some fundamental testing knowledge or secret unit testing techniques.

In this article, I would like to show that unit tests are quite easy; the real problems that complicate unit testing, and introduce expensive complexity, are a result of poorly-designed, untestable code. We will discuss what makes code hard to test, which anti-patterns and bad practices we should avoid to improve testability, and what other benefits we can achieve by writing testable code. We will see that writing testable code is not just about making testing less troublesome, but about making the code itself more robust, and easier to maintain. Continue reading

banner GIT

Git Tutorial: A Comprehensive Guide

INTRODUCTION

Prerequisites

Before beginning this tutorial, it is highly recommended that you have a solid understanding of the Terminal (for Mac) or Command Line (for Windows and Linux).

In order to explain Git, we have to first explain various aspects of Version Control.

Version Control

Version Control is a system that allows you to revisit various versions of a file or set of files by recording changes. Through version control, one can revert a file or project to a previous version, track modifications and modifying individuals, and compare changes. By utilizing a Version Control System (VCS), mistakes with files can easily be rectified.

Local Version Control

Many years ago, programmers created Local Version Control systems. A Local VCS entails one database on your hard disk that stores changes to files.

Centralized Version Control

The need for collaboration within a developer team on a single file or set of files led to the advent of the Centralized Version Control System (CVCS). This system entails a single server storing all changes and file versions, which can be accessed by various clients. This streamlined the collaboration process (by eliminating the need to involve all local databases), allowed programmers to have more knowledge of team members’ activities with certain files, and gave administrators much more control over divvying up revision privileges.

Distributed Version Control

A Distributed Version Control systems (DVCS) addresses the major vulnerability of the CVS: the server as a single point of failure. If a CVS goes down, collaborators cannot work with each other on a file or save changes and new versions. Also, in the event of corruption of a central database’s hard disk — with the absence of backups — all work will be lost, except for any portions on local machines.

To prevent this type of catastrophic loss, a DVCS allows clients to create mirrored repositories. These data backups can be easily be placed on the server to replace any lost information.

Because the DVCS allows for multiple mirrored repositories, programmers working in teams can collaborate with each other in various ways to complete a joint project, which enables the use of various simultaneous workflows.

So, what is Git?

Continue reading

Creating Usable JVM Languages: An Overview

There are several possible reasons for creating a language, some of which are not immediately obvious. I would like to present them together with an approach to make a language for the Java Virtual Machine(JVM) reusing existing tools as much as possible. In this way we will reduce the development effort and provide a toolchain familiar to the user, making it easier to adopt our new programming language.

Creating Usable JVM Languages: An Overview

In this article, the first of the series, I will present an overview of the strategy and various tools involved in creating our very own programming language for the JVM. in future articles, we will dive into the implementation details. Continue reading

JS-logo

Introduction to the Jspm package manager and the SystemJs module loader

In this post we will go over the current state of ES6 modularity, by learning how to use the Jspm package manager and its associated SystemJs module loader (the sample code is available here). We will go through the following topics:

  • Using ES6 modules today
  • Why is modularity important in Javascript
  • The Jspm package manager and how to use it today
  • creating a ready to use bundle with Jspm
  • The SystemJs module loader
  • Jspm vs Bower
  • Jspm vs npm
  • Conclusions

Continue reading

keycloak-logo

Securing Microservices with Keycloak

In a traditional multi-tiered architecture like the one shown in the picture below a server-side web tier deals with authenticating the user by calling out to a relational database or an LDAP server. An HTTP session is then created containing the required authentication and user details. The security context is propagated between the tiers within the application server so there’s no need to re-authenticate the user.

Continue reading

banner_bootstrap

Bootstrap Tutorial: A Guide for Beginners

Thousands of sites are built every day with The Twitter Bootstrap Framework. This is the most popular HTML, CSS and JavaScript responsive framework. Every developer and designer should know or learn how to use it.

If you have never used Bootstrap before, you are probably missing out. Why?

Bootstrap saves you a lot of time – The framework includes predefined CSS classes, styled HTML components and configured Javascript plugins ready to use, to help developers design pages better and faster. Continue reading

71sJOAse7UL._SL1500_

How to prepare the MacBook Pro for Java development and more

Well, I’ve recently gone to the “silver” side and acquired a MacBook Pro to use it for development when I am not at my PC. By development I mean here mainly Java + Javascript development. So I’ve written this post to remember what I had to install/configure to achieve this goal.

I need to mention that until now I’ve been a user of Windows (XP/7) and Linux (Ubuntu/Mint/Cent OS) operation systems.

At the time of this writing MacBook Pro runs on OS X Yosemite Version 10.10.5. The new version El Capitan was available, but I didn’t do the upgrade first because it had to many bad reviews…

Continue reading

Kugel, JAVA, Programmiersprache, Sprache, plattformunabhängig

Basics of scaling Java EE applications

To be honest, ‘scalability’ is an exhaustive topic and generally not well understood. More often than not, its assumed to be same as High Availability. I have seen both novice programmers and ‘experienced’ architects suggest ‘clustering‘ as the solution for scalability and HA. There is actually nothing wrong with it, but the problem is that it is often done by googling rather than actually understanding the application itself 😉

I do not claim to be an ‘expert’, just by writing this post 😉 It just (briefly) lays out some strategies for scaling Java EE applications in general. Continue reading

bannerAngular

AngularJS Tutorial: A Beginner’s Guide to AngularJS

Introduction

Since I first started using AngularJS several years ago, it has become the most popular single-page application (SPA) framework for the JavaScript language. AngularJS makes it easy to solve simple problems fast, yet has enough features to enable development teams to build complex large-scale applications.

This tutorial aims to introduce a complete beginner to AngularJS by explaining fundamental concepts and building a sample application. The application will be a simplified admin area for a multi-author blog. Continue reading