What is lambda? and why do we need it?

When I started coding GUI application using Java, I realized my code was cluttered with too many anonymous classes. Each time, I had to handle an event the inlined implementation of ActionListener introduced nested and unreadable lines of code. How many of you have written code like below

signUpUserBtn.addActionListener(new ActionListener(){
  public void actionPerformed(ActionEvent e){

Continue reading

MySQL inside Docker

In the previous article, we learnt how Spring boot application can be packaged inside a docker container. The containerization approach helps to quickly spin up an environment and destroy it when not needed. This approach is not just limited to Programming languages but it can be easily be extended for Databases too! Most of the databases including MySQL, PostgreSQL can be easily be containerized. The configuration can be tuned as per application requirements and developers have total freedom to test the changes without impacting the centralized environment. In this article, we will focus on how MySQL database can be containerized. If you do not have Docker setup yet, please refer to this article for docker installation.
Continue reading

Java 8 – Method Reference – Is it Magic?

Amongst the notable features in Java8, Method Reference adds Shorthand syntax for a lambda expression. In most cases, Lambda expression does nothing more than just calling a single method. If you find yourself doing that most often, its time to look at Method reference. It can be used to replace entire Lambda expression, let’s have a look at following example
Continue reading

Java 8 – What is functional Interface?

Functional interface is a new addition to Java 8. In simple terms, an interface which has one single abstract method is qualified as Functional interface. The built-in classes in JDK are full of examples of Functional Interfaces(Runnable, Callable, ActionListener). Java 8 formalized such interface definition with @FunctionalInterface annotation. FunctionalInterface is also useful while creating lambda expressions. Those who are not familiar with Lambda expression, it was again a new feature introduced in Java 8. Lambda helps developers to write concise code. Its expressive syntax saves developer’s time. Before Lambda, for every single method declaration of an interface, developers had to create Class. Eventually, an application source code is filled with many small classes which just provide an implementation for one single method. FunctionalInterface and Lambda expressions are considered to be best practice for writing neat code. Lets have a look at how JavaDoc describes FunctionalInterface
Continue reading

Spring boot and docker

Spring boot has eased the life of developer by reducing boilerplate configuration and reduced project bootstrap time by declaring defaults. Those who are already working on Spring projects and are leveraging Spring boot must have realized productivity gains. In addition to that, Maven build script (pom.xml) has been shortened due to single dependencies made available by Spring boot for a specific purpose. For example including spring-boot-jpa-starter dependency in Maven script ensures that all the required dependencies for interacting with a database are available with a single declaration. While there are many benefits of spring boot, one of the major benefits is to run the application quickly with embedded tomcat instead of having need of a separate server. This has definitely shortened the development cycle and developers can now focus more on building solution for business requirements. Being able to easily deploy the application and that too with speed container approach is on the rise. Spring boot application can be easily be bundled along with container solutions like Docker.
Continue reading

Failed Architecture – Building medical patient record management

In the last article, we witnessed how a simple task of building a static website can throw some unique challenges. Every application has its own quirks which need special attention and hence an architect must not hesitate to reiterate the solution. An architect must spend rigorous time on investigating the functional aspects of an application. What may sound a brilliant solution for one problem, may not be fit under all circumstances. There was no better era than what we are witnessing now in the architecture space. People are discussing Microservices architecture, Event sourcing, Serverless architecture, Blockchain etc., each trying to solve problems enforced by expectations placed by today’s Problem domain. Choosing an incorrect pattern or architecture style will lead to many problems including rigid systems, unmanageable infrastructures, traceability issues, debugging challenges, upgrade chaos. The list is unending and most of us have already experienced pain at some point in time. With this article, we will raise the expectation bar than the previous problem and look at poor architecture built for Managing Patient Record, Reminder system.
Continue reading

Failed Architecture – Building a static website

There are too many articles, videos sharing experiences about the unending ocean of technologies, each with an opinion about how they built the best in the class software which eventually helped businesses to grow and achieve maximum customer satisfaction. In a quest to understand, what it really takes to build a quality software, I realized my initial experiments were nothing but series of failures. With each experience, I could gain insight about how things can be strengthened and how ignorance can lead to disaster. With the series of “Failed Architecture”, I will touch-base on various requirements and attempt to solve the problems. With each solution, we will also explore its trade-offs and how we can mitigate it with a better approach.

To better understand, let’s start with problem definition

Bob is a commercial artist and he loves to showcase his work to the entire world. He decides to build a simple website which will provide an introduction about him and his art. All the content will be uploaded at the time of building the site and there will be minimal updates afterward. Bob being popular around the world, expects huge traffic flowing to his site. Bob thinks Jim (our architect) is best suited for the job. Bob also says that he really not interested in administering this site, so keep it as simple as possible – no admin stuff.

Continue reading

AWS Solution Architect Associate – Certified – Part II

In continuation of Part – I, today I am presenting additional sources that helped me to strengthen my understanding of AWS cloud. Don’t assume that just completing one single course and practicing few question sets will help you to achieve the certification.

In-depth Coverage and Question Sets
After completing Ryan’s course, I felt the need of exploring additional courses. This led me to two courses offered by Chandra Lingam. The essence of these courses is that it covers a lot of granular things along with rich question sets. The course is divided into 2 parts. First part consists of 300+ videos totaling more than 17+ hours, with close to 45+ question sets each question set having an average of 10 questions, so in total 450+ questions. The course consists of an explanation of various AWS services along with lab demonstration.
Continue reading

AWS Solution Architect Associate – Certified – Part I

Amazon Web Services Certified Solutions Architect Associate

Amazon Web Services Certified Solutions Architect Associate

Last few months, I was focused on preparing myself to achieve AWS certification – Solution Architect Associate. Having almost no clue from where to begin, I was bit anxious, if I should really take up this challenge. In my past life, I explored few Cloud solutions like AWS, Azure, Digital Ocean, Red Hat Open Shift, IBM BlueMix, Vultr,.. Period! (Don’t wonder, why Google cloud is not in the list, sorry, but it never got me excited. Wait, there is still hope). But beyond spinning up few VMs and toggling some features, my experience in Cloud remained limited. This is what triggered me to spread my wing and I decided to go for the certification. Here is my attempt, to share how I started this journey, the experiences that I had, sources that helped to learn and prepare for certification. An advice – read no further, if you are looking for shortcuts like Exam dumps, actual test questions. You will be disappointed. Before we proceed, – I completed AWS Solution Architect Associate certification on 15th June 2017 and my score was 92%.
Continue reading

Test email with Subethamail – Mock email without changing code

Most of the applications require notifications to be sent to stakeholders (users/administrators/owners) about application events. The notifications may be in the form of SMS, showing popup messages or email. Out of the various notification options described earlier, Email is the most traditional option. In case of Java, the built-in package of javax.mail provides standard APIs to send email including features of Sending attachments, bcc etc.

While there are Open Source / Freeware / Commercial email servers are available, it is always inconvenient to setup a SMTP server for development. On top of that, security policies at Organization level, prevent developers from accessing Enterprise Email server for development testing. This forces, either commenting code responsible for sending email or turning off the feature in development mode. Few, prefer to wrap an exception due to Email server unavailability and ignore it completely. Here is the list of side-effects, one can notice due to ignoring such a crucial functionality.
Continue reading