RSS

Category Archives: Technology

Enterprise Technologies

Unit Testing Basics

Episode 62

Previous episode was about talking to database in Spring. Today we will continue exploring basics of building web applications, and talk about unit testing. This time, however, we are going to leave Spring alone for a moment and focus on plain unit tests using JUnit, Mockito and DataProvider.

4d821599ecc582a1ab14fe16e0594e27

As usual, all the code presented in this article is available on my GitHub in the same project as before. This tag corresponds to project state at the time of writing this article. Let’s start with some basic ideas, and why write unit tests in the first place.

Client does not pay for unit tests

Well, I have heard that once. I was in a project where code coverage was around 2%, and when I was actively trying to improve upon that, manager took me to a one on one discussion to a small room. Starting to cover old projects with tests is often difficult, but in the end the business pays much more for not having decent automatic test harness than saving on skipping it and only producing features. It simply pays back in the long run. There are less unnoticed bugs, design is cleaner, the amount of tedious repetitive work is dramatically reduced. Often it is much faster to Read the rest of this entry »

 
Leave a comment

Posted by on March 23, 2017 in Clean Code, Spring, Technology

 

Tags: , , ,

Spring Data JPA Basics

Episode 61

In the previous episode, we covered basic concepts of web services in Spring framework. Today we will build upon that foundation and take a look on how to transfer some data between our Spring Boot application and the database. Getting started with this part requires just a bit of effort to set up the aforementioned database and configuring our application, so the two can talk to each other, but no worries I will go through this step by step.

wallup-13611.jpg

As usual, all the code presented in this article is available on my GitHub in the same project as before. This tag corresponds to project state at the time of writing this article. Before we dive into the configuration and code, let’s start with some underlying concepts, namely ORM and JPA.

Foundations

ORM, or Object Relational Mapping is a technique of mapping data between objects in object oriented languages and relational databases. Complications stem from the fact, that objects form graphs in the mathematical sense, and relational databases comprise of Read the rest of this entry »

 
3 Comments

Posted by on March 16, 2017 in Spring, Technology

 

Tags: , , ,

Spring Web Basics

Episode 60

Here is the second part of Spring back-end series for beginners. Part zero appeared half year ago, and was focused on Angular front-end. Part one was two weeks ago, and consisted of some basic concepts of Spring framework including inversion of control, dependency injection, beans, configuration and profiles. Today we are going to look into Spring web, in particular web services and handling incoming HTTP requests. There will be no fancy front-end stuff this time, just naked request and response.

steampunk_spider_lamp_by_catherinetterings-d6ugb5v

As usual the introduction to the topic and going over basic concepts might well be at least one separate article but let’s try to do all at once. We will cover the concept of HTTP protocol, servlets, web services, REST and JSON. If you would like to play with complete application working out of the box, visit my GitHub project Spring Angular Intro. This tag corresponds to project state at the time of writing this article.

Foundations

HTTP or Hypertext Transfer Protocol, belongs to the application layer of Internet Protocol Suite, so it’s the highest-level layer above transport layer (like TCP), network layer (like IP) and link layer (like Ethernet). HTTP request contains Read the rest of this entry »

 
1 Comment

Posted by on March 9, 2017 in Technology

 

Tags: , , , , ,

Boiling Frogs Wrocław 2017

Episode 59

Last Saturday, on February 25, I attended Boiling Frogs – software development conference held in my home city, Wrocław. It’s the second edition of the event, this time it took place at Wrocław Congress Center near Cenntenial Hall, one of the city landmarks. There were 31 talks / lightning talks in total, spread across three tracks covering variety of subjects not tied to any specific programming platform but focusing mostly on more generic aspects of coding, building organizations, solving problems and software craftsmanship in general.

c2d4qvhwiaaalrh

Unfortunately, I arrived a bit late and missed the keynote. Apparently, the closer you live to the place you are supposed to be on time, the lower are the chances of it happening – the universal rule. In addition, the day before I drove 300 km to Kraków and back again, and people need to sleep sometime.

Talks

I managed to be on six talks and one lightning talk in total, basically all of them were really good. let’s do a small recap of each of them. Read the rest of this entry »

 
Leave a comment

Posted by on March 2, 2017 in Technology

 

Tags: ,

Spring Core Basics

Episode 58

This week I was planning to publish introduction to Amazon Web Services, but since I’m working on preparing Spring-based web applications development course for Wrocław University of Technology students with my two colleagues, I decided to change the schedule a bit. I planned to write few articles about Spring framework anyway, but in order to fit everything before particular classes in March and April I need to start exactly now.

a1dac3474b1a296e8ec8b14647ec7798.jpg

I wrote a Spring Hello World article over two years ago actually, but today I wanted to talk a bit more about some fundamental concepts: Inversion of Control and dependency injection. Let us take a closer look at application structure, configuration, components and wiring. There will be quite a lot of code snippets. If you would like to play with complete application working out of the box, visit my GitHub project Spring Angular Intro. The application is based on the one I prepared for Angular Intro article in September 2016, but now we will focus on back-end exclusively. This tag corresponds to project state at the time of writing this article.

Concepts

Classic approach to program structure is that we write custom, high-level code which calls lower level code.  The flow of control goes from our code to a generic framework or libraries. Inversion of control is a technique, where Read the rest of this entry »

 
1 Comment

Posted by on February 23, 2017 in Spring, Technology

 

Tags: , , , ,

Cloud Computing Intro

Episode 57

Last week we talked about virtual machines and containers and rapidly growing popularity of the latter. Another subject that people in software development talk a lot is the cloud. Everyone wants to be in the cloud nowadays, there is a number of good reasons to do that and some reasons not to.

2322dc8bfd0a655059a0b4d0301ea218.jpg

Originally, I wanted to write an introduction to Amazon Web Services this week, since I’m into this topic recently. However, I realized that the introductory paragraph about the cloud in general is growing too fast and it requires a separate article. Let’s start with a bit of history of cloud computing. Remember: There is no cloud. There is just someone else’s computer.

Cirrus: Long Time Ago…

After the initial developments in computing technology, in sixties and seventies, it was typical, that organization had one large computer, the mainframe, and people were connecting to it over the network using terminals, just to send data and receive results. Then, there was the microcomputer revolution, and Read the rest of this entry »

 
Leave a comment

Posted by on February 16, 2017 in Technology

 

Tags: , , , ,

Virtualization and Containers Intro

Episode 56

Container revolution is one of the hottest topics nowadays in software development industry. The little blue whale, the Docker logo, can be seen on most programming conferences as well as numerous Twitter feeds of, so called, IT influencers.

676811.jpg

Today, along with containers, we will talk about their older and fatter siblings: virtual machines. It’s good to understand similarities and differences between those two and how to take advantage of that. We will talk about what containers are and what they are not. Contrary to what might have seem, containers did not render virtual machines entirely obsolete and there are reasons to use both.

Virtual Machines

Virtual machines are emulations of computer architectures and provide functionality of a physical machine using appropriate combination of software and hardware. It’s not a new concept, as first implementation dates back to systems developed in the sixties like IBM CP-40. They are commonly used to Read the rest of this entry »

 
1 Comment

Posted by on February 9, 2017 in Technology

 

Tags: , , ,

From Java Source to Bare Metal, Part Four: The Battle of Eight Cores

Episode 52

This is the fourth and final episode of our little Hobbit’s journey through layers of abstraction of web application and all its foundations down to hardware. Starting in episode 49, we traveled all the way from Java code, web framework, web server, Java virtual machine, container, operating system through Internet Protocol Suite. It’s time to meet the Bare Metal.

smaug-the-hobbit-dragon.png.jpg

The Hobbit paced across maze of corridors and shafts inside the mountain to finally emerge through the main gate and run down the valley to breathe a fresh air. A moment later he froze, turned around, looked up and realized his grievous mistake. The Physical Dragon was not above the Lake City anymore. He was lurking at the mountain side, just above the gate, piercing terrified Hobbit with his gaze.  

Fire and Water: The Bare Metal

Everything we talked about up to this point was basically software. Now it’s time to look into our Hobbit whereabouts from the physical machine point of view. We started with an assumption, that we have a reference to the Hobbit object in our Java code. The object lives on Read the rest of this entry »

 
Leave a comment

Posted by on January 12, 2017 in Technology

 

Tags: , , , , , , ,

From Java Source to Bare Metal, Part Three: The Networked Mountain

Episode 51

Hello traveler. Today we are continuing our journey through abstraction layers in a web application with all its foundations. Two episodes ago we started from Java code written by hand, followed by the web framework. One episode ago we went down into web servers, traveled through Java virtual machine to finally meet the container engine. Finally? Oh no, there is still long way before us.

Laketown.png

The cruise on the back of giant blue whale is over, and the Lonely Mountain is closer than ever. The Hobbit jumps out of the barrel and lands on solid ground somewhere in the city harbor. Meanwhile, the whale drifts away, unnoticed by busy workers. The hobbit leaves the dock and treads towards the building that dwarfs nearby ones with its size. The city hall.

On the Doorstep: The Operating system

In terms of the operating system, we are now crossing the border between the application and the kernel. We can say, that both sides were mediated by the container engine, which presents virtual kernel API to the application inside the container and maps all calls to the actual kernel API on which it resides. Java virtual machine and everything that’s sits on top of it, is now just another Read the rest of this entry »

 
1 Comment

Posted by on January 5, 2017 in Technology

 

Tags: , , , ,

From Java Source to Bare Metal, Part Two: The Desolation of Bytecode

Episode 50

In the previous episode, we started a journey through layers of abstraction of modern back-end web application. As a response to unexpected request, a Hobbit object is going to an adventure, and must travel safely across the technology stack. We seek an answer to the question what happens between Java code and the physical machine. Perhaps, even further.

Our Hobbit leaves the, yet familiar, plain of web framework and goes deep down under the Misty Server Mountains.

Riddles in the Dark: The Server

The code sits atop of web framework, and web framework sits atop of web server. That was mostly true until recently. Now, with Spring Boot, it is common that instead of deploying packed application to the server, there is a fat jar that contains embedded server inside an application. No configuration, no deployment, just running a single jar. Simple solution for simple problems, but of course it’s no silver bullet and might not fit everywhere. How does the server and the application fit together?

bilbo_in_gollums_cave

There are different tiers of servers, as I wrote some time ago. The largest that we care about are application servers, like Read the rest of this entry »

 
3 Comments

Posted by on December 29, 2016 in Technology

 

Tags: , , , ,