Industrial Practices and Tools 2

Tools To Maintain  Code Quality

There are several ways to maintain the code quality like

Use a Linter 

Linter is a tool that analyzes the source code and find out if there is any potential errors and linters provide warnings for suspicious looking code.

example:- 

CSS LINT -  is a tool to help point out problems with your CSS code. It does basic syntax checking as well as applying a set of rules to the code that look for problematic patterns or signs of inefficiency.

Testing your Code

Providing a sufficient amount of testing and fining out wheather the code is working as it intended.

Code Review

Code review is the allowing someone to look at your code and finding out wheather he can understand it.

Comment

Using some comments when writing the code.

Use Code review Tools

Sonar Lint- This is a tool that gives back instant feedback as you type your code and this is only   available in IDE based software's like Eclipse,Intellij and Visual Studio.

SonarQube- it’s a code quality management platform that allows developer teams to manage, track and eventually improve the quality of the source code.

Klocwork- is a static code analysis tool used to identify security safety reliability issues in C, C++ and C# codes.

Sidekick



Dependency/Package Management

Package management system is a collection of software tools that automates the process of installing, upgrading, configuring, and removing computer programs for a computers operating system in a consistent manner.

Package contains the metadata (Software name, description, its purposes, version number, vendors checksum, and list of dependencies) that needs to run a software properly. 

Role of the Dependency/Package Management

Package manager are doing the task of finding, installing, maintaining or uninstalling software.

Some functions of the package management include:
  • Working with file archives to extract package archives.
  • Ensuring the integrity and authenticity of the package by verifying their digital certificate and checksum.
  • Grouping the packages by function to reduce user confusion.
  • Managing dependencies to ensure a package is installing with all packages it requires , thus avoiding "dependency hell".

Build Tools

Build tools are programs that automate the creation of executable application from source code. Building incorporates compiling, linking and packaging the code into a usable or executable form. In small projects, developers will often manually invoke the build process. 

Build Automation is the process of automating the creation of a software build and associated processes including compiling computer source code into binary code and running automated tests.

This improves product quality.
Accelerate the compile and link processing.
Eliminate redundant task.
Minimize "bad builds".
Eliminate dependencies on key personnel.
Have history of builds and releases in order to investigate issues.


Build Tools used in the Industry

 

Ant  

It is the first among modern build tools.
Its based on procedural programing idea.
It has XML as the format to write the scripts.
It has its control of the build process.

Maven

Maven uses XML as the format to write and build specification.
Maven relies on conventions and provides the available targets (goals) that can be invoked.
As the additional, and probably most important addition, Maven introduced the ability to download dependencies over the network (later on adopted by Ant through Ivy).

Gradle

Gradle doesn't use XML, instead it has its own DSL based on Groovy. 
Gradle build scripts tend to be much shorter and clearer than those written for Ant or Maven. 

 



Build Life Cycle

A Build Life cycle is a well-defined sequence of phases, which define the order in which the goals are to be executed. Here phase represents a stage in life cycle. There are always pre and post phases to register goals, which must run prior to, or after a particular phase.

Phase Handles Description
prepare-resources resource copying Resource copying can be customized in this phase.
validate Validating the information Validates if the project is correct and if all necessary information is available.
compile compilation Source code compilation is done in this phase.
Test Testing Tests the compiled source code suitable for testing framework.
package packaging This phase creates the JAR/WAR package as mentioned in the packaging in POM.xml .
install installation This phase installs the package in local/remote maven repository.
Deploy Deploying Copies the final package to the remote repository.




 What is Maven.

Maven is project management tool that is based on project object management model. It is used for project builds, dependency and documentation. It simplifies the build process like ANT. Maven is much advanced and it helps to manage-builds, documentation, re-poring, SCMs, Releases, Distribution.

It has two main benefits

Maven allow you to get your package dependencies easily.
Maven forces you to have a standard directory structure.

Maven build process items

Life cycle- Maven is based around the central concept of a build life cycle. There are three built-in     build life cycles: default, clean and site. The default life cycle handles your project deployment, the clean life cycle handles project cleaning, while the site life cycle handles the creation of your project's site documentation.

Build Phase- It represents a stage in the Maven build life cycle. Each phase is responsible for a specific task.  Ex:
             Validate-  check if all information necessary for the build is available.
             Compile- compile the source code.
             Test-compile- compile test source code.
             Test- run unit test.
             Package- package compiled source code into distributable format
             Integration- tests process and deploy the package if needed to run integration tests.

Build Goal- Each phase is a sequence of goals, and each goal is responsible for a specific task.           
  • compiler:compile – the compile goal from the compiler plugin is bound to the compile phase
  • compiler:test Compile is bound to the test-compile phase
  • surefire:test is bound to test phase
  • install:install is bound to install phase
  • jar:jar and war:war is bound to package phase


             
Build Plugin- A Maven plugin is a group of goals. However, these goals aren’t necessarily all bound to the same phase.



Additional Practices and Tools

•Continuous Integration
•Configuration Management
•Test automation
•Issue/bug tracking tools
•Agile methodologies, DevOps










 

 


Comments

Popular posts from this blog

What Is Programming

Distrbuted Systems

Client Side Development 2 - RiWAs