Not long time ago I have rediscovered an old friend - Bash1 the Alias2. We were never best friends until now. We got acquainted at the beginning of my computer science studies. I visited back then a course held by Cisco, “Linux Essentials” or something like that. The trainer mentioned at one point what were aliases and how handy they could be. Well 12 years later, and I still had not gotten that, until recently, when the alias presented himself in a new light to me. Since then we’ve been best friends. Read on to learn why.
Well, there were pains - I was experiencing performance issues (caused mainly by memory shortages on a 4GB machine) with the virtual private server from GoDaddy, where I used to host both Podcastpedia.org and Codingpedia.org. Codingpedia was developed initially with Wordpress1, which I still think is a great tool, if you want to quickly start a blog and don’t have programming experience, but it kinda requires a LAMP2 stack, which it’s kinda performance killer from a number of visitors forward. Of course you can always add more hardware to support the website, but that has a limit too. Limited was also the budget I was ready to spend on hosting, by today’s standards.
In a previous post, I’ve used Server Sent Events to create a monitoring dashboard. SSE are a one way messaging format form server to clients in contrast to Web Sockets where communication is bidirectional. In this post, I’ll use Web sockets to create a tiny chat server using Tyrus, the reference implementation of the Java API for WebSocket (JSR 356). A great introduction to this API can be found on Oracle Network here.
In order to keep the tutorial simple, the server and clients will be command line apps, no GUIs here, it is a serious blog :smile: So let’s get started!
I think it would be fair to state that we, as software developers, are always looking for the ways to write less code which does more stuff, automagically or not. With this regards, Spring Boot project, proud member of the Spring portfolio, disrupted the traditional approaches, dramatically speeding up and simplifying Spring-based applications development.
There is a lot to be said about Spring Boot, intrinsic details of how it works and its seamless integration with most if not all Spring projects. But its capabilities go far beyond that, supporting first-class integration with popular Java frameworks.
In this post we are going to take a look at how we can use Spring Boot in conjunction with Apache CXF project for a rapid REST(ful) web services development. As we are going to see very soon, Spring Boot takes care of quite a lot of boilerplate, letting us to concentrate on the parts of the application which do have real value. Hopefully, at the end of this post the benefits of adopting Spring Boot for your projects become apparent.
With that, let us get started by developing a simple people management REST(ful) web service, wrapped up into familiar PeopleRestService JAX-RS resource:
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.