• January 2018 (2)
  • December 2017 (1)
  • November 2017 (2)
  • October 2017 (3)
  • September 2017 (4)
  • August 2017 (3)
  • July 2017 (3)
  • June 2017 (3)
  • May 2017 (1)
  • February 2015 (2)
  • January 2015 (1)
  • December 2014 (3)
  • February 2014 (2)
Tags View All Blogs
Scrum.NetMicrosoftVisual StudioVC++C#JavaTestingQuality AssuranceUX DesignSPAAngularKnockoutBackboneUnderscoreDatabaseMySQLBlockchainHyperledgerChaincodeEnterprise MobilityUIIonicCordovaHybrid AppCode ReviewTypescriptAndroidIOTReactICOVenture CapitalArtificial IntelligenceKotlinIoTFuchsia OSVirtual RealityVOIPCrowdfunding Testing

Development To Deployment - 9 Things A Java Developer Should Know

Java technology has been evolving since its initial release in 1995. Apart from the OOPS concepts, language basics/syntax and various business layer frameworks which keep coming with time, there are a number of things which every Java developer should understand and use, from development to deployment, in order to do collaborative software development in an efficient way. I have summarized some of these tools/techniques/practices. Though the items below do not specifically apply to Java, however they have been discussed here in context of Java (with an exception of version control systems and issue tracking tools, which apply to any kind of software development).

Version Control Systems(VCS)

Version Control Systems help various developers work independently yet collaboratively on a single project, without impacting each other's changes. It helps maintain a history of all the changes. Any unwanted changes, if accidently done to the code can be rolled back to some stable version in the past. There are two types of version control systems:

Centralized (CVCS): A single copy of repository is maintained on server. Developers get the latest code from repository, make their changes and commit the changes to central repository. Developers only need to keep a single copy of the project on their local machines. Any version or version history can be fetched from central repository as and when required. Some popular centralized version control systems are: CVS (open source, one of the oldest and still being used), SVN (open source, one of the most widely used), Perforce (commercial) etc.

Distributed (DVCS): This works as peer-to-peer model. Developers have a copy of repository and complete version history on their local systems. Developers commit their changes locally without requiring network connections. Thus, all the operations except for pull and push to remote repository are extremely fast. Pushing a group of commits makes them available to other developers via pull. There are performance gains as well as it makes the system more fault tolerant as every copy of project on developer's systems itself is a complete repository.

Some popular open source DVCS used currently are: Git (many organizations switching from SVN to Git), Mercural, Bazaar etc.

Code Analysis and Quality Tools

There are tools available which can analyze code statically to detect possible issues and suggest improvements. Most of these can be integrated with popular IDEs e.g., in Eclipse via plugins, so that developers can benefit during development phase itself. Quality control rules are configurable mostly.

SonarQube, one of the most widely used, is an open source platform for managing code quality. It's functionality can be extended by using plugins for other analysis tools e.g., PMD, FindBugs, Checkstyle etc. Hence, it allows to perform multiple tool analaysis at a single place. The dashboard presents the results of various plugins.

Some of the popular tools are:

  • Ecl Emma, Cobertura - for ensuring code coverage.
  • Checkstyle - ensures adherence to coding standards.
  • FindBugs - reports issues in the code, operates on bytecode and is thus able to detect various bugs in the code.
  • PMD - code analyzer for finding common programming flaws.

Debugging and Profiling Tools

Being familiar with the debugging techniques can save you great effort in the times of crisis. Its essential for the developers to be aware of breakpoints, watch, inspection, step-through execution etc. Its a great tool to figure out cause of various programming bugs/flaw.

Almost all IDEs today provide convenient interactive ways to debug (no need to print, trace, assert).

Remote debuging allows to debug applications running on different JVM or machines.

Profiling lets you measure application's performance in terms of cpu usage, memory usage etc. and helps track down bottlenecks. JDK itself provides VisualVM for free for lightweight profiling and monitoring needs. Starting JDK 7 Update 40, Oracle's Java Mission Control tool is also bundled with the HotSpot JVM.

There are commercial profiling tools available for advanced profiling needs e.g., YourKit, JProfiler, Oracle's Java Mission Control, jClarity (Illuminate and Censum). They generally integrate nicely with your favorite IDEs or offer easy to use GUI; have several profiling options like memory, cpu, database call profiling etc. You can profile your application deployed locally, remotely or even at production.

Unit Testing Frameworks and Tools

Though generally neglected due to tight schedules, testing ahead of time can help you save on effort and time and help build quality product with minimal bugs.

There are automated test case frameworks available which can greatly reduce manual testing effort. Once written, test cases can be run with almost zero effort. This helps in regression too; help identify any bugs introduced by some other bug fixes. JUnit, TestNG are two popular frameworks for unit testing java code.

While performing unit testing, its not uncommon to come across the scenario where the code under test has external dependencies (for example, a webservice or dao call). Mocking external dependencies allows us to focus on the code under test instead of dealing with the behavior of external dependencies in test scenario's. Mocking frameworks allow us to mock external dependencies by setting expectations about their behavior when they are invoked.

There are various mocking frameworks available for java, which work in conjunction with unit testing frameworks e.g., Mockito, EasyMock, PowerMock etc.

PowerMock is a powerful framework which extends other mocking frameworks (currently Mockito and EasyMock) to enable some features which are not yet available with those frameworks e.g., mocking static methods, constructors, final classes, final methods, private methods, removal of static initializers etc.

Investing on learning any of these unit testing and mocking frameworks would certainly pay off in long run.

Design Patterns

Design patterns are time-tested well-described solutions to commonly occurring design problems in software development. Someone have already solved a problem in an efficient way and you can use this wisdom to solve a similar problem of yours. Design patterns do not provide you with any re-usable code/implementation/component but it facilitates you a reusable design for your problem's solution in a well-tested and optimized way.

There are three categories of design patterns:

Creational Patterns: deals with design problems related to object creation e.g., Singleton, Factory Method, Abstract Factory, Prototype, Builder etc.

Structural Patterns: deals with composition of classes/objects to form larger structures to solve a particular problem e.g., Proxy, Adapter, Composite, Facade, Bridge, Decorator, Flyweight etc.

Behavioral Patterns: deals with inter-object communication e.g., Template Method, Chain of Responsibility, Observer, Strategy, Command, Visitor, Iterator etc.

Understanding various design patterns and their usage help identify the patterns which can be used in solving the problem at hand. The benefits are - an efficient solution with reduced learning curve, increased code maintainability and well-thought-of pros/cons to understand in a particular problem scenario.

Apart from that, there are various design patterns used in JDK implementation, understanding them helps understand their proper usage and how things work e.g., decorator pattern is used heavily in classes, chain of responsibility in java.util.logging.Logger, javax.servlet.Filter etc.

Build Management Tools

For most but the very simple projects where build is just a single command process, it would be helful to use a build tool to automate build process.

Build tools manage and organize your builds - they handle all build tasks like build, versioning, packging, dependency management (for multi-project builds), running tests to validate build, deploy etc.

Build tools can be run within IDEs or independently. They can also be used by Continuous Integration tools (more on Continuous Integration later in this article).

Three popular build tools in java world are: Apache Ant (uses Ivy for dependency management), Apache Maven and Graddle.

Ant was one of the first modern build tools (released in 2000) and is still being used even after popularity of Maven (released in 2002). Gradle, released lately - in 2012, also seems promising and getting good response. Ant uses XML to describe the build process, which can easily become overly verbose for large/complex projects. Maven uses XML too, but the approach is declarative and based on default configurations and available targets/goals which can be invoked. Gradle instead uses Groovy based DSL, with shorter and clearer scripts; but involves initial learning curve. All three can be easily extended to provide additional functionality.

Issue Tracking Tools

Issue tracking tools are used to keep track of bugs/incidents reported as well as the complete workflow for issues e.g., reporting, assigning for estimation/development, fixing, qa verification etc. Some of the open source tools are - BugZilla, Mantis etc. and Commerical are - JetBrains YouTrack, Atlassian JIRA etc.

Continuous Integration and Delivery Tools

Continuous Integration is the development practice wherein developers frequently checks-in code to mainstream repository; which is then build automatically (generally after every check-in) to ensure that code compiles and is validated against a number of automated tests. This can detect any integration issues early, hence minimizing the time to fix.

Jenkins, an open source CI tool, has gained popularity in last few years. It integrates with a number of other tools via plugins like SonarQube, CheckStyle, Cobertura, FindBugs, JIRA, PMD etc. Some Other popular CI tools are:

  • Open source - Hudson (later forked to Jenkins), CruiseControl etc.
  • Commercial tools - Atlassian Bamboo, ThoughtWorks Go, Jetbrains Team City etc.

Continuous Delivery takes a step ahead of Continuous Integration. It is a practice exercised to ensure that the software is always production ready and can be deployed as and when required. It helps deliver software early with latest features, incrementally releasing the features; hence shortens the time to market.

Continuous Delivery requires continuous integration (code quality analysis, some of the test cases execution can be done at this stage), test automation (additional integration, acceptance, stress/load, performance, smoke testing and manual testing etc.) on some test/staging environments, configuration automation and then finally one step deployment to production environment. They also should have easy rollback mechanism so that in case any bug go undetected (despite all the testing), then it can be rolled back to previous stable release. There are specific deployment automation tools in market to help facilitate the Continuous Delivery workflow:

CA Release Automation (earlier known as Nolio Automation Centre), LiveRebel from Zeroturnaround, DeployIT from XebiaLabs.

New Features in Java Versions

Java platform is continually evolving; new features and capabilities are added in each version. Java 8, latest release of java, introduced functional interfaces, lambda expressions, default methods, repeating annotations among several other features. Java 9, which is expected to be released in 2016, is expected to offer source code modularity (Jigsaw project), light weight JSON API, money/currency APIs, process API updates, smart java compiler and a number of other enhancements.

Its a must for a thriving software developer to keep himself up to date about the technology.