INDUSTRY PRACTICES AND TOOLS 2
CODE QUALITY
Code quality matters in many ways
•The long-term usefulness and long-term maintainability of
the code
•Minimize errors and easily debugged
•Improve understand ability
•Decrease risks
Impact of Quality code
•Clarity: Easy to read and oversee for anyone
who isn’t the creator of the code. If it’s easy to understand, it’s much easier
to maintain and extend the code. Not just computers, but also humans need to
understand it.
•Maintainable: A high-quality code isn’t over complicated. Anyone
working with the code has to understand the whole context of the code if they
want to make any changes.
•Documented: The best thing is when the code is self -explaining,
but it’s always recommended to add comments to the code to explain its role and
functions. It makes it much easier for anyone who didn’t take part in writing
the code to understand and maintain it.
•Refactored: Code formatting
needs to be consistent and follow the language’s coding conventions.
•Well-tested: The less bug the code has the
higher its quality is. Thorough testing filters out critical bugs ensuring that
the software works the way it’s intended.
•Extensible: The code you receive has to be extensible. It’s not
really great when you have to throw it away after a few weeks.
•Efficiency: High-quality code doesn’t use unnecessary resources to perform a desired action.
The quality of the code can be measured by different
aspects
•Weighted Micro Function Points
•Halstead Complexity
Measures
•Cyclomatic
Complexity
•Lines of
code
•Lines of
code per method
How to maintain the code quality?
•Documenting
the code. Comments
improves the readability and the understandability of the code.
•Regular Code Reviews. According to a recent survey, software
professionals rank code reviews as the number one way to improve programming.
These reviews enable developers to collaborate and share knowledge with each
other, which improves their work. Furthermore, reviews ensure that code adheres
to established standards.
•Functional Testing. Functional testing is
important because it encourages developers to focus on software functionality
from the outset, reducing extraneous code.
The aim of software development is to write an application that delivers
exactly what users need.
•Clear
Requirements. Most
software development projects begin with a requirements document, or story
cards in agile development. A project with clear, feasible requirements is much
more likely to achieve high quality than ambiguous, poorly specified
requirements.
How to maintain the code quality?
•Using Code
Review tools
Need
for dependency/package management tools in software development
Software
project may have a backbone framework and many external artefacts linked
•Third party
packages
•External
libraries
•Plug-ins
These
external artefacts may introduce many integration issues
•Different
folder/file structures and may use different ways of integrating into the main
framework
•Different
external artifacts may use different ways of integration
•Different
versions are available and difficult to upgrade
There are
tools to manage these external artefacts towards minimizing these issues
•Composer
[php ]
•Maven
[Java]
•NuGet
[.net]
•NPM (Node
Package Manager) [JS]
•Bower [JS]
Role of dependency/package
management tools in software development
A package manager or package management
system is a collection of software tools that automates the process of
installing, upgrading, configuring, and removing computer programs for a computer's operating
system in a consistent manner.[1]
A package manager deals with packages, distributions
of software and data in archive
files. Packages contain metadata, such
as the software's name, description of its purpose, version number,
vendor, checksum, and a list of dependencies necessary
for the software to run properly. Upon installation, metadata is stored in a
local package database. Package managers typically maintain a database of
software dependencies and version information to prevent software mismatches and
missing prerequisites. They work closely with software repositories, binary repository managers,
and app stores.
Package managers are designed to eliminate the need for manual
installs and updates. This can be particularly useful for large enterprises
whose operating systems are based on Linux and
other Unix-like systems, typically consisting of
hundreds or even tens of thousands of distinct software packages.
Different
dependency/package management tools used in industry
Composer
[php ]
Composer is an application-level package
manager for the PHP programming language that provides a standard
format for managing dependencies of PHP software and required libraries. It was developed by Nils Adermann and
Jordi Boggiano, who continue to manage the project. They began development in
April 2011 and first released it on March 1, 2012. Composer is strongly
inspired by Node.js's "npm" and Ruby's "bundler".The
project's dependency solving algorithm started out as a PHP-based port of
openSUSE's libzypp satsolver.
Composer runs through the command
line and installs dependencies (e.g. libraries) for an
application. It also allows users to install PHP applications that are
available on "Packagist"which is its main repository containing
available packages. It also provides auto
load capabilities for libraries that specify auto load
information to ease usage of third-party code.
Maven
[Java]
Maven, a Yiddish word meaning accumulator
of knowledge, was originally started as an attempt to simplify the build processes
in the Jakarta Turbine project. There were several projects each with their own
Ant build files that were all slightly different and JARs were checked into
CVS. We wanted a standard way to build the projects, a clear definition of what
the project consisted of, an easy way to publish project information and a way
to share JARs across several projects.
The result is a tool that can now be used for building and
managing any Java-based project. We hope that we have created something that
will make the day-to-day work of Java developers easier and generally help with
the comprehension of any Java-based project.
Maven’s primary goal is to allow a developer
to comprehend the complete state of a development effort in the shortest period
of time. In order to attain this goal there are several areas of concern that
Maven attempts to deal with:
§ Making the build process easy
§ Providing a uniform build system
§ Providing quality project information
§ Providing guidelines for best practices
development
§ Allowing transparent migration to new features
NuGet
[.net]
An essential tool for any modern development platform is a
mechanism through which developers can create, share, and consume useful code.
Often such code is bundled into "packages" that contain compiled code
(as DLLs) along with other content needed in the projects that consume these
packages.
For .NET (including .NET Core), the Microsoft-supported mechanism
for sharing code is NuGet, which defines how packages for .NET are
created, hosted, and consumed, and provides the tools for each of those roles.
Put simply, a NuGet package is a single ZIP file with the .nupkg extension that
contains compiled code (DLLs), other files related to that code, and a
descriptive manifest that includes information like the package's version
number. Developers with code to share create packages and publish them to a
public or private host. Package consumers obtain those packages from suitable
hosts, add them to their projects, and then call a package's functionality in
their project code. NuGet itself then handles all of the intermediate details.
Because NuGet supports private hosts alongside the public
nuget.org host, you can use NuGet packages to share code that's exclusive to an
organization or a work group. You can also use NuGet packages as a convenient
way to factor your own code for use in nothing but your own projects. In short,
a NuGet package is a shareable unit of code, but does not require nor imply any
particular means of sharing.
Build tool
• Build
tools are programs that automate the creation of executable applications 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. This is not practical for larger projects,
where it is very hard to keep track of what needs to be built, in what sequence
and what dependencies there are in the building process. Using an automation
tool allows the build process to be more consistent.
Build automation
•On-demand automation such
as a user running a script at the command line
•Scheduled automation such
as a continuous integration server running a nightly build
•Triggered automation such
as a continuous integration server running a build on every commit to a
version-control system.
The
advantages of build automation to software development projects include
• A necessary pre-condition for continuous
integration and continuous testing
• Improve product quality
• Accelerate the compile and link
processing
• Eliminate redundant tasks
• Minimize "bad builds"
• Eliminate dependencies on key personnel
• Have history of builds and releases in
order to investigate issues
• Save time and money - because of the
reasons listed above
Different build tools used
in industry
•Maven uses
Convention over Configuration, which means developers are not required to
create build process themselves.
•Developers do not have to mention each and
every configuration detail. Maven provides sensible default behavior for
projects.
•A Build
Life cycle is a well-defined sequence of phases, which define the order in which
the goals are to be executed
•The
primary(default) life cycle of Maven is used to build the application, using 23
phases
• Validate
•Initialize
• Generate-sources
• Compile
• Generate-test-sources
•A Build
profile is a set of configuration values, which can be used to set or override
default values of Maven build.
•Using a
build profile, you can customize build for different environments such as
Production and Development environments
•When we
execute mvn post-clean command, Maven invokes the clean life cycle consisting of
the following phases.
•pre-clean
• clean
•post-clean
•Maven clean
goal (clean: clean) is bound to the clean phase in the clean life cycle
•Its
clean:cleangoal deletes the output of a build by deleting the build directory
•Gradle
Gradle is an
open-source build automation system that builds upon the concepts of Apache
Ant and Apache
Maven and introduces
a Groovy-based domain-specific language (DSL) instead of the XML form used by Apache
Maven for declaring
the project configuration.[1] Gradle uses a directed acyclic graph ("DAG") to determine the order in which tasks
can be run.
Gradle was designed for multi-project builds, which can grow to
be quite large. It supports incremental builds by intelligently determining
which parts of the build tree are up to date; any task dependent only on those
parts does not need to be re-executed.
•MSBuild
MSBuild is a build
tool that helps
automate the process of creating a software product, including compiling the source
code, packaging, testing, deployment and creating documentations. With MSBuild, it is possible
to build Visual Studio projects and solutions without the Visual Studio IDE installed. MSBuild is free and open-source.[5] MSBuild was previously bundled
with .NET Framework; starting with Visual Studio 2013, however, it is bundled with Visual Studio instead.[6] MSBuild is a functional replacement for
the nmake utility,
which remains in use in projects that originated in older Visual Studio
releases.
MSBuild acts on MSBuild project files which have a similar XML syntax to Apache
Ant or NAnt. Even though the
syntax is based upon well-defined XML schema, the fundamental structure and
operation is comparable to the traditional Unix make utility: the user specifies what will be
used (typically source code files) and what the result should be (typically a
static library, DLL or an executable application), but the utility itself
decides what to do and the order in which to carry out the build.
MSBuild can build a project against a supported .NET Framework
version of choice. This feature is called "multitargeting". Any given
build of a project, however, can only target one version of the framework at a
time.
•Sbt
Its main features are:
·
Continuous
compilation, testing, and deployment
·
Incremental testing
and compilation (only changed sources are re-compiled, only affected tests are
re-run etc.)
·
Integration with the
Scala interpreter for rapid iteration and debugging
·
Support for mixed
Java/Scala projects.
Build life cycle
What is build life
cycle? The sequence of steps which is defined in order to execute the tasks and
goals of any maven project is known as build life cycle in maven. Maven 2.0
version is basically a build life cycle oriented and clearly says that these
steps are well defined to get the desired output after the successful execution
of the build life cycle.
Maven comes with 3
built-in build life cycles as shown below :
·
Clean - this phase involves cleaning of the
project (for a fresh build & deployment)
·
Default - this phase handles the complete
deployment of the project
·
Site - this phase handles the generating the
java documentation of the project.
Now we will dig more
into the detailed phases involved in the above mentioned built-in build life
cycles.
Build Life Cycle of clean phase
As mentioned above, this clean phase is used to clean up the
project and make it ready for the fresh compile and deployment. The command
used for the same is mvn post-clean. When this command is invoked, maven
executes the below tasks via executing the below commands internally :
1.
mvn pre-clean
2.
mvn clean
3.
mvn post-clean
This maven's clean is a goal and on executing it cleans up the
output directory (target folder) by deleting all the compiled files.
Maven uses conventions over configurations
Convention over configuration (also known
as coding by convention) is a software design
paradigm used by software frameworks that attempts to decrease
the number of decisions that a developer using the framework is required to
make without necessarily losing flexibility. The concept was introduced
by David Heine Meier Hansson to
describe the philosophy of the Ruby on
Rails web
framework, but is related to earlier ideas like the concept of
"sensible defaults" and the principle of least astonishment in user interface design.
Build
phases, build life cycle, build profile, and build goal in Maven
Maven Build Lifecycle
The
Maven build follows a specific life cycle to deploy and distribute the target
project.
There
are three built-in life cycles:
- default:
the main life cycle as it’s responsible for project deployment
- clean:
to clean the project and remove all files generated by the previous build
- site:
to create the project’s site documentation
Each life cycle consists of a sequence of phases. The default build
life cycle consists of 23 phases as it’s the main build lifecycle.
On the
other hand, clean life cycle consists of 3 phases, while
the site lifecycle is made up of 4 phases.
Maven Phase
A Maven phase represents a stage in the Maven build lifecycle.
Each phase is responsible for a specific task.
Here
are some of the most important phases in the default build
lifecycle:
- validate: check if
all information necessary for the build is available
- compile: compile
the source code
- test-compile: compile
the test source code
- test: run unit
tests
- package: package
compiled source code into the distributable format (jar, war, …)
- integration-test: process
and deploy the package if needed to run integration tests
- install: install
the package to a local repository
- deploy: copy the package
to the remote repository
Maven Goal
Each phase is a sequence of goals, and each goal is responsible
for a specific task.
When we
run a phase – all goals bound to this phase are executed in order.
Here
are some of the phases and default goals bound to them:
- compiler:compile –
the compile goal from the compiler plugin
is bound to the compile phase
- compiler:testCompile 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
Maven build profile
A profile in Maven is
an alternative set of configuration values which set or override default
values. Using a profile, you can customize a build for different environments.
Profiles are configured in the pom.xml and
are given an identifier. Then you can run Maven with a command-line flag that
tells Maven to execute goals in a specific profile. The following pom.xml uses
a
production
profile
to override the default settings of the Compiler plugin.
How Maven manages
dependency/packages and build life cycle
What is build life
cycle? The sequence of steps which is defined in order to execute the tasks and
goals of any maven project is known as build life cycle in maven. Maven 2.0
version is basically a build life cycle oriented and clearly says that these
steps are well defined to get the desired output after the successful execution
of the build life cycle.
Maven comes with 3
built-in build life cycles as shown below :
·
Clean - this phase involves cleaning of the
project (for a fresh build & deployment)
·
Default - this phase handles the complete
deployment of the project
·
Site - this phase handles the generating the
java documentation of the project.
Maven is based around the central concept of a build lifecycle.
What this means is that the process for building and distributing a particular
artifact (project) is clearly defined.
For the person building a project, this means that it is only
necessary to learn a small set of commands to build any Maven project, and the POM will
ensure they get the results they desired.
There are three built-in build lifecycles: default, clean and
site. The default lifecycle handles
your project deployment, the clean lifecycle handles
project cleaning, while the site lifecycle handles the
creation of your project's site documentation.
These lifecycle phases (plus the other lifecycle phases not
shown here) are executed sequentially to complete the default lifecycle.
Given the lifecycle phases above, this means that when the default lifecycle is
used, Maven will first validate the project, then will try to compile the
sources, run those against the tests, package the binaries (e.g. jar), run
integration tests against that package, verify the integration tests, install
the verified package to the local repository, then deploy the installed package
to a remote repository.
Contemporary
tools and practices widely used in the software industry
The best project management
tool is Wrike. This outstanding project management platform is currently used
by over 18,000 satisfied clients throughout the world to help them achieve
visibility, make planning simpler, allow collaboration, and simplify process
workflow. It is an excellent online project management tool that can adjust to
the needs of any team in any type of business.
With so many PM tools to
choose from, how can you select the right one for your needs? We’ll help you do
that through this article, by discussing the key features, benefits, and
pricing structures of our experts’ pick for the 10 best project management
tools in the market today. Read on and you’ll likely find one or two PM tools
that will suit your project management needs.
10Nuvro
How valuable is a project management system
for your business? An overwhelming 97% of organizations agreed that project management is critical to business performance and
organizational success, and 94% believe that project
management enables business growth. Furthermore, 77% of high performing companies understand
the value of project management, and they are able to successfully complete 89%
of their projects. Having a project management system in place and following
project management practices and methodologies have produced positive results
for organizations.
How do you choose which project management
software is best for you? Make sure it offers features that will enable
you to collaborate with your team, share files and documents, manage cost, and
get reliable reporting and documentation. It is also important for the software
to be easy to use and learn. You may want to check out our guide to project management software for a more in-depth understanding of what project
management software is all about. In this article, we’ll focus on helping you
choose the best software for your needs. Below, we’ve gathered 10 of the best
project management platforms out there that you should consider.
1.
are the
top 10 best project management tools?
Reference:Google,Wikipedia.
No comments:
Post a Comment