Author Archives: Ajitesh Kumar

Ajitesh Kumar

I have been recently working in the area of Data analytics including Data Science and Machine Learning / Deep Learning. I am also passionate about different technologies including programming languages such as Java/JEE, Javascript, Python, R, Julia, etc, and technologies such as Blockchain, mobile computing, cloud-native technologies, application security, cloud computing platforms, big data, etc. For latest updates and blogs, follow us on Twitter. I would love to connect with you on Linkedin. Check out my latest book titled as First Principles Thinking: Building winning products using first principles thinking. Check out my other blog, Revive-n-Thrive.com

Java Unit Testing Interview Questions

ATG interview questions

The article presents some of the frequently asked interview questions in relation with unit testing with Java code. Please suggest other questions tthat you came across and I shall include in the list below. What is unit testing? Which unit testing framework did you use? What are some of the common Java unit testing frameworks? Ans: Read the definition of Unit testing on Wikipedia page for unit testing. Simply speaking, unit testing is about testing a block of code in isolation. There are two popular unit testing framework in Java named as Junit, TestNG.   In SDLC, When is the right time to start writing unit tests? Ans: Test-along if …

Continue reading

Posted in Interview questions, Unit Testing. Tagged with , , .

Gradle War Configuration for Eclipse Spring Web Application Project

The article describes the configuration one would need to create WAR file for an Eclipse-base web application (Dynamic Web) project. Below code represents whats needed to compile your Java Eclipse-based web application project and create WAR file which can be deployed later, on any Java server such as Tomcat. Pay attention to some of the following facts: repositories: “repositories” is referred in a local directory rather than external repository such as MavenCentral etc. sourceSets: sourceSets define the path under which Java source code exists. It MUST BE NOTED that failing to define this would have Gradle look into Maven-based folder such as “src/main/java” for source code that would eventually result …

Continue reading

Posted in Java, Web. Tagged with , , .

Web Application Folder Structure for Spring MVC Web Projects

Dynamic Web Project Folder Structure

The article lists down two most commonly used folder structure for a Spring MVC/Hibernate based web application project. In fact, this folder structure could be used with any other MVC framework like Spring. Following are different two folder structures described later in this article: Eclipse-based Web Application (Dynamic Web Project) Maven-based Web Application Project Eclipse-based Web Application (Dynamic Web Project) As per this Eclipse page, Dynamic web projects contain dynamic Java EE resources such as servlets, JSP files, filters, and associated metadata, in addition to static resources such as images and HTML files. Following is how the folder structure looks like on the disk: src packages (com.orgid.abc) WebContent CSS/JS Folders (Publicly …

Continue reading

Posted in Web. Tagged with .

Gradle Quick Tutorial & Hello World Code Samples

The article aims to briefly describe key concepts of Gradle along with providing code samples for hello world. The intended audience are those inquisitive souls who want to quickly get up and running with Gradle tool. For detailed information, you may want to check out the book, Building & Testing with Gradle. Following is discussed in this article: What is Gradle? Coding Build Files with Groovy DSL Task Definition Closures HelloWorld Code Samples What is Gradle? As defined on http://www.gradle.org/, “Gradle is build automation evolved. Gradle can automate the building, testing, publishing, deployment and more of software packages or other types of projects such as generated static websites, generated documentation or …

Continue reading

Posted in Build Automation. Tagged with , .

Steps to Get Started with Spring MVC 4 & Hibernate 4

The article lists down steps one need to take in order to get up and running with Spring MVC 4 and Hibernate 4. The article will describe following three key aspects: General configurations to setup Java, Eclipse and Tomcat Server Spring MVC 4 configurations & code samples Hibernate 4 configurations & code samples Following are key components/artifacts that would be required to create the web application which makes use of Spring MVC 4 for managing MVC and Hibernate as an ORM framework: Libraries & Tools Configuration files Components Controller Views (JSP pages) Business logic classes Data access classes Key Libraries & Tools Following are key libraries and tools to download …

Continue reading

Posted in Java. Tagged with .

Top 15 Mobility Architect Interview Questions

The article lists down some of the questions I happen to discuss with candidates appearing for mobility architect/lead position. These are mostly architectural level questions and cut across most mobility platforms. Feel free to share questions you came across in your interviews. What are different types of mobile apps? Mention some of the platforms you worked with?Native vs Mobile Web vs Hybrid applications Native Apps, Web Apps, and Hybrid Apps Native, HTML5, or Hybrid: Understanding Your Mobile Application Development Options When develop for native apps and when mobile web? Mobile Website vs. Mobile App (Application): Which is Best for Your Organization? What are key differences in architecting/developing consumer apps and …

Continue reading

Posted in Mobility. Tagged with , .

How to Add Tomcat 8 to Eclipse Kepler

The article represents steps required to configure Tomcat 8 with Eclipse Kepler. Download Tomcat 8 and place it within any local folder. Download Eclipse Java EE Kepler As of date, Tomcat 8 is not supported in Eclipse JaveEE Kepler. However, you could add the Tomcat 8 by doing following: Go to the WTP downloads page, select the latest version (currently 3.6), and download the zip. Here’s the current link. Copy the all of the files in features and plugins directories of the downloaded WTP into the corresponding Eclipse directories in your Eclipse folder (overwriting the existing files). Start Eclipse and click on “Servers” tab in the workbench. Go ahead and …

Continue reading

Posted in Java. Tagged with .

How to Get Started with Bootstrap (UI) & Eclipse

The article represents steps required to get started with Bootstrap (UI) with Eclipse IDE while working with a dynamic web project involving JSP, Servlets etc. Even before we go ahead, you may be wondering on why should you care about adding bootstrap to Eclipse. Why BootStrap? The interesting thing about bootstrap is that it helps you to get started as quickly as possible with cool looking UIs that can be created out-of-box HTML/CSS code snippets. As a matter of fact of fact, I landed up with Bootstrap after I was searching for some rapid Java UI builder for Eclipse using which I could easily build fancy UIs while focusing on …

Continue reading

Posted in Web. Tagged with .

Test-Driven Development (TDD) Shines with Mocking

The article presents a perspective and some code samples on how one could some cool stuff with Test-driven development (TDD) and Mocking. The code samples are done in Java. Lets briefly understand what is TDD and mocking? What is TDD? Test-driven development, simply speaking, is a software development process in which developers write tests first and, then writing enough code to pass those tests. Once all of the tests pass, they do code refactoring to enhance code quality. Following are key advantages of adopting TDD as your development process: Enforces the developers to thoroughly think through various different test cases which could be used to test the functional/business requirements. It, …

Continue reading

Posted in Unit Testing. Tagged with , .

Law of Demeter Coding Violations & How to Fix Them

The article lists down Law of Demeter Violations and presents solutions on how to fix them. The code samples are written in Java. Feel free to share your comment, if any. What is Law of Demeter Principle? There are several good pages on the web which could be read to understand the object-oriented principle, Law of Demeter. Following are some of them: Demeter: It’s not just a good idea. It’s the law. Object-Oriented Programming: An Objective Sense of Style PMB Coding Violations The group of programmers working on a Demeter system, back in 1980, came up with this programming principle which they termed as Law of Demeter. According to them, …

Continue reading

Posted in Software Quality. Tagged with , .

Unit Tests – Mocking vs Stubbing Vs Spying

The article lists down some good reads (from different webpages on internet) on unit testing concepts such as mocking, stubbing and spying and represents summarized information on these concepts. Mocks Aren’t Stubs What’s the difference between a mock & stub? Mocking vs. Spying in mocking frameworks Mocking and stubbing in Ruby on Rails What’s the difference between faking, mocking, and stubbing? After going through all the above pages, I could arrive at following definitions: Mocking Mocking is a unit testing phenomenon which is used to replace real objects with test objects that mocks the behavior. These test objects are called as Mock objects. The point to note is that mock …

Continue reading

Posted in Unit Testing. Tagged with .

Junit & Mock Framework Mockito Code Samples – Part 1

The article represents code samples for Junit tests and Mockito, a mocking framework. In addition, it describes different aspects of unit testing and mocking. Software Requirement The goal is to create a simple piece of software which caters to the requirement of school admission where in applicants submit their admission application.   Class Design & JUnit Tests To meet above requirement, following different component is designed: Core Components (Key Ones) AdmissionApplication.java: Consists of method recordNewApplication which validates the submitted application, and later, stores in the database after successful validation. ApplicationValidation.java: Consists of methods for validating business rules associated with admission such as mandatory inputs (first name, last name, class, gender, …

Continue reading

Posted in Unit Testing. Tagged with , .

JUnit Tests Code Samples for Testing Exception Scenarios

The article presents an example of unit tests which tests both happy path and exception scenario. Business Requirement User trying to open an account must be validated against the business rules related with users’ registration. Following are different business rules: User must provide a valid email address User must provide his first name User’s age must be 18 and above   Class Design To demonstrate the unit tests with happy and exception scenarios, following classes have been shown below: SignupValidation: Consists of code validating business rules SignupException: Custom exception representing Signup business rules failure EmailValidator (Get the code from this page). SignupValidationTests: Unit tests for testing signup validation code Class …

Continue reading

Posted in Unit Testing. Tagged with .

Unit Tests – An Alternate Functional Requirements Documentation

The article presents a perspective on how unit tests could be written in a way that they could be used as an alternate form of documentation for understanding functional requirements. Many a times, it has been found that developers, primarily rookies, did not have a clarity on how to name unit tests. Thus, many of them have been found to name the unit tests such as testXXX where XXX is name of the method which they wanted to tests. There has been many recommendations on how to name unit tests, some of which are following: Given…When…Then… Check the page by Martin Fowler (http://martinfowler.com/bliki/GivenWhenThen.html) WhenXXX_ExpectYYY Names representing different use case scenarios …

Continue reading

Posted in Unit Testing. Tagged with .

Content Framework for Lunch & Learn Sessions on IT Applications

The article represents a framework using which one could plan their content for taking an introductory session on their applications. The primary objective of such presentation is to provide the audience with following information: Business overview Applications overview The proposed framework aims to satisfy the education needs for different stakeholders including delivery manager, project manager, development & testing teams. Presenters talked differently In my recent experience, I attended a series of sessions taken by leads of different project teams working for the same customer. Except for few of them, most of these sessions were not very interesting and audience enjoyed lunches more than the sessions. Following are some of the …

Continue reading

Posted in Software Engg.

APIs Performance Testing with Twitter Iago

The article talks about performance testing tool, Iago, which is created at Twitter for testing their core database interfaces, storage sub-systems and domain logic, up to the systems accepting front end web requests. Performance requirement of Twitter platform? Simply speaking, end users expect to read & post tweets with a very fast response time and, Twitter is expected to respond in that manner irrespective of load arriving at it with absolutely no room for any slowness, whatsoever. That is a tough one, isn’t it? This is unlike many enterprise business systems where users can be a little forgiving by waiting for the response to show up. So, they needed to …

Continue reading

Posted in Performance Engineering. Tagged with , .