Author Archives: Ajitesh Kumar
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, …
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 …
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, …
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 …
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 …
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 …
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 …
Mobile Apps Testing Frameworks Used at LinkedIn
The article lists down tools & frameworks that are used for mobile app testing at LinkedIn. Vows: Vows is a behavior driven development framework for Node.js. It is used to do asynchronous testing with Node.js. The primary feature of the framework is its support for asynchronous testing with Node and, the ability to run concurrent tests. Vows also supports code coverage reporting. Robotium: Robotium is an Android test automation framework that has full support for native and hybrid applications. It supports black-box UI tests for android applications. It is used to test native LinkedIn android app. Selenium: Selenium is used to automate end-to-end testing with mobile web browsers. FoneMonkey: FoneMonkey …
How to Measure Software Development Productivity
The article lists down pages/papers on measuring software development productivity. The Theory of Constraints: A good read on measuring software development productivity Measuring Productivity of Software Development Teams: The paper lists down different techniques/models for measuring software development productivity. CannotMeasureProductivity: Then, there is this article by Martin Fowler which says that it is difficult to measure software development productivity. He points about ineffectiveness of following approaches of measuring developer’s productivity: Lines of codes (LOC) Function points The software development teams working based on Waterfall model or Agile methodologies model tend to measure the developer’s productivity in terms of following variants: Function Points Story Points (size) vs Velocity Following pages present …
List of Javascript Templating Engines & Why One Needs Them?
The article presents a short overview on why one needs Javascript templating engines and, a list of these frameworks. Please feel free to suggest one or more frameworks if I missed to include them in the list below. Why do I ever need Javascript templating engine? Consider the following use-case scenario. Let’s say, you are a big enterprise with different line of businesses (LOBs). Each LOB has a set of web applications serving its business needs. With different LOB having different applications, following scenario is likely to happen: One particular LOB, X, has applications written with Java/JSP. Other LOB, Y, has applications written with .NET technology Other LOB, Z, …
Why Facebook Relies on A/B Testing?
This article talks about A/B testing, why companies like Facebook rely on it and what would it take to adopt such testing for your website. What is A/B testing? A/B testing is a strategy in marketing in which two versions, A and B, (the control and the treatment) are tested against each other. A/B testing, as the names implies, is a simple randomized experiment with two variants/versions, A and B, one of which version A might be currently used version (control) and, version B (treatment) is modified in some respect to study/test the users’ behavior. These tests are also called as split tests. These tests involve modification some of the following …
Lessons from Evernote Usage of Apache Thrift Framework
This article throws light on underlying technology used by Evernote to meet the primary requirement of having client applications on different OS platforms connect to server application for accessing/updating the notes. What is Evernote? As per Wikipedia…Evernote is a suite of software and services designed for notetaking and archiving. A “note” can be a piece of formatted text, a full webpage or webpage excerpt, a photograph, a voice memo, or a handwritten “ink” note…. Evernote supports a number of operating system platforms (including OS X, iOS, Chrome OS, Android, Microsoft Windows, Windows Phone, BlackBerry, and webOS) and also offers online synchronisation and backup services. The diagram below illustrates …
Why Amazon.com Pages Rely on DNS Pre-fetch
The article presents a perspective on why Amazon.com pages rely on DNS pre-fetch and what other e-commerce websites could learn from this. Whats Happening Under the Hood? As you do the view source of the homepage, amazon.com, you would find following Javascript code snippet, right at the top of the page: <meta http-equiv=”x-dns-prefetch-control” content=”on”> <link rel=”dns-prefetch” href=”http://g-ecx.images-amazon.com”> <link rel=”dns-prefetch” href=”http://z-ecx.images-amazon.com”> <link rel=”dns-prefetch” href=”http://ecx.images-amazon.com”> <link rel=”dns-prefetch” href=”http://completion.amazon.com”> <link rel=”dns-prefetch” href=”http://fls-na.amazon.com”> Later, in the same page as well as other pages, you would find several resources such as images, Javascript, CSS files accessed from one of the above as base URLs. So, let’s try and explore some of the …
Javascript Frameworks used in LinkedIn.com
The article lists down different Javascript frameworks that have been used in LinkedIn web UI and mobile app. Following are some of the key Javascript frameworks that have been used in various different LinkedIn applications (Web & Mobile). If you disagree with one or more of these frameworks, please shout out loud. Also, feel free to suggest of frameworks that I missed to include. Sorry for any typos/misspellings as you read further. Dust.js Dust.js, the client-side templating engine, is used to serve LinkedIn webpages with common UI code for different web-apps products. These web-apps products are created using varied technology stack including Java/Grails/JRuby etc. With Dust.js, LinkedIn moved from …
LinkedIn Application Architecture – Software Distribution View
The article lists down the softwares used at different layers in the LinkedIn platform layered architecture. Presentation Layer Dust.js (Client-side templating JS engine) Backbone.js (Client-side MVC JS framework) JQuery YUI Library (UI libraries started by Yahoo engineers) Google V8 Engine (Used as server side JS templating engine) Node.js (Used in mobile app) HTML5 (Used in mobile app) Business Layer Java (Applications such as Profile) Grails (Applications such as a Recruiter app) JRuby (Applications such as a Skills app) Spring (Component Model) Scala Middleware Apache Kafka (Distributed entreprise-level messaging system) Data Layer Oracle (RDBMS as primary data store used for writes) Espresso (NoSQL data store emerging as primary data store and envisioned to …
OWASP Security Misconfiguration Example – Infosys Career Website
The article presents an example of “Security Misconfiguration” vulnerability that was found on Infosys career website. It could be noted that security misconfiguration is considered as one of the OWASP top 10 security vulnerabilities. The vulnerability was found with Careers web application of Infosys, which can be accessed at https://careers.infosys.com/. As you access the career site link, you would see the title icon as “SAP”. This does suggest that Infosys careers web application is created on top of SAP career module. The way I found that is following: Go to job opportunities page. Click on “Register”. You would land on the registration page with following link: https://careers.infosys.com/sap/bc/webdynpro/sap/hrrcf_a_candidate_registration Go ahead and strip the hrrcf_a_candidate_registration from …
I found it very helpful. However the differences are not too understandable for me