Industry Practices and Tools 2 Article
01) Maintaining the quality of the Code Quality
Code quality is very important thing that we should keep clean as a software developers. Imagine that we are investing money to build a Home. We are building a home to feel safe in, while growing our family for long time. How we feel if we get some damages or dis-satisfaction after building home. Apply the same theory for software development.Code Quality matters:
- Long term usefulness and long term maintainability of the code.
- Minimize errors and easily debugged.
- Improve understand ability.
- Decrease risk.
Impact of the Quality code:
- clarity
- Maintainability
- Documented
- Refactored
- well-tested
- Extensible
- Efficiency
Code Quality:
- Weight macro function points.
- Hal-stead complexity measures.
- Cyclomatic complexity.
- Lines of Code.
- Lines of code per method.
Maintain the code quality:
- Documenting the code.
- Regular code reviews.
- Functional testing.
- Clear requirements.
Code Review tools:
- SonarQube
- CSS
- Sider
- SideKick
- SonarSource
- Klocwork
- W3C
02) Different Approaches and Measurements used to Measure the Code Quality
There are vary of measurements to measure the application source code quality. Good quality software code lead it to good software output. There are some useful heuristics and metrics that measure a source code and provide useful information. This will give us good code that is easy to maintain. This is very useful for bigger scale of code not much for small scale of code.
Basic Code Metrics:
- Maintainability Index
- Cyclomatic Complexity
- Depth of Inheritance and Class Coupling
- Lines of Code
Additional Metrics:
- Number of Methods
- Number of Fields
- Afferent Coupling
- Efferent Coupling
- Relational Cohesion
- Instability and Abstractness
- Type Rank
- Method Rank
- Number of Parameters
- Number of Variables
Visualizing Metrics
Trend Metrics:
- Average Lines of Code for Methods
- Average Lines of Code for Types
- Average Cyclomatic Complexity for Methods
- Average C.R.A.P (Change Risk Analyzer and Predictor) Score
By reading more references of following factors will give us brief idea how to find the black or bad areas of a software source code. Get rid of those bad areas will produce a good software output.
03) Identify and compare some code review tools
Generally code review tools user by developers to find bugs errors early phases of the software development. Using those review tool we can improve the quality of the code and decrease the bugs and errors.
- Collaborator
- Analyse code changes, detects errors, and put comments on necessary lines
- Peer review is allowed
- Build Custom review reports
- Guide peer document reviews using same tool
- Review Assistant
- Flexible code reviews
- Discussions in code
- Iterative review with defect fixing
- Team Foundation Server integration
- Reporting and Statistics
- Codebrag
- Simple, light-weight, free and open source code review tool
- Justify bugs like non-blocking code review, same line comments.
- Put out errors along with joint learning and teamwork.
- Delivering enhanced software using its agile code review
- Gerrit
- Free web-based code review tool
- Integrated with Git (Version Control System)
- Provides repository management for Git.
- Project members can use rationalized code review process
- Codestriker
- Open source and free online code reviewing web application.
- One can record the issues, comments, and decisions.
- Traditional documents review.
- Rhodecode
- Open source, protected and incorporated enterprise source code management tool.
- Serves as an integrated tool for Git, Subversion, and Mercurial.
- Team collaboration, Repository Management, and Code security & authentication.
- Automates the workflows to execute faster.
- Phabricator
- It is easy to creating the best quality code using this tool.
- Two types of code review workflows, “pre-push” also termed as “review” and “post-push” termed as “audit”.
- Integrated with Git, Subversion, and Mercurial.
- Crucible
- Lightweight peer code review tool
- Easy for SVN, Perforce, and CVS etc using Crucible.
- Veracode
- Scanning the binary code or byte code in place of source code.
- Identify the improper encrypted functionalities, malicious code and backdoors from source code.
- Can review a large amount of code and returns the results immediately.
- LINT
- CSS
- SideKick
- SonarQube
- SonarSource
- Klocwork
- W3C
04) Need of Dependency/ Package Management tools in Software Development
For a software development we need to choose a IDE, Language those things. While we doing our development we will be needed to import something important feature that will take long time to implement if we do it by ourselves but there is a package already implemented that feature. Therefore we can import that package to our project and we can use it easily without doing an implementation.
Software project may have a backbone framework and many external artifacts linked.
Software project may have a backbone framework and many external artifacts linked.
- Third party package
- External Libraries
- Plug-ins
These external artifacts may introduce many integratic issues.
- Different folder/ file structures and may use different way of integrating into the main framework.
- Different External artifacts may use different way of integration.
- Different versions are available and difficult to upgrade.
05) Role of Dependency/ Package Management tools in Software Development
Tools:-
An application level package manager for the PHP programming language that provides a standard format for managing dependencies of PHP software and required libraries.
Maven [Java]
A build automation tool used primarily for java projects. Maven address two aspects of building software. First is describe how software build and second , it describe its dependencies.
Maven can also be used to build and manage project manage written in c#, ruby, scala and other languages.
Nuget [.Net]
Free and open source manager designed as a visual studio extension. Standing with visual studio 2012. Nuget comes pre-installed by default. Nuget has evolved into a larger eco system.
NPM [Js]
NPM is a package manager for install node.Js packages or modules if you like. The npm program is installed on computer when we install node.js. Npm already run on our computer and no other package manager come closer. It is also breeze to use. This also a free and open source program.
Bower [Js]
Npm and Bower are both dependency management tools. Bower is used for managing front end components like html, css, js etc.
06) Compare and Contrast different dependency/ package management tool used in industry.
Debian, Ubuntu, Linux Mint, several other derivatives.
- Debian Package Management System (dpkg)
This package manager is base package manager of the Debian Linux family and it is used to install, remove, store and provide information about .deb packages. It is a low-level tool and there are front-end tools that help users to get packages from VCS (Ex:- Github) and/or handle complex package relations.
- Advanced Packaging Tool - very popular, free, powerful and more so, useful command line package management system that is a front end for dpkg package management system. Users of Debian or its derivatives such as Ubuntu and Linux Mint should be familiar with this package management tool.
- Aptitude Package Manager - This is also a popular command line front-end package management tool for Debian Linux family, it works muck like APT and there have been a lot of differences between the two, but above all.
- Synaptic Package Manager - Synaptic is a GUI package management tool for APT based on GTK+ and it works fine for users who may not want to get their hands dirty on a command line.
2. RPM (Red Hat Package Manager)
This is also the Linux Base packing format and a base package management system implemented by RedHat. There are various front-end package management tools that you can use with it.
- YUM (Yellowdog Updater, Modified) - it is an open source and famous command line package manager. We can compare it to APT under Debian Linux systems, it incorporates the common functionalities that APT has.
- DNF – Dandified Yum - It is also a package manager for the RPM-based, produced in Fedora 18 and it is the next generation of version of YUM. If you have used Fedora 22 or new version, you should feel that it is the default package manager.
3. Pacman Package Manager – Arch Linux
4. Zypper Package Manager – openSUSE
5. Portage Package Manager – Gentoo
07) Significant of using a Build tool in large scale software development, distinguish small scale software development.
Build tool is a program that are automate the creation of executable application from source code.
Building inoperative compiling, linking and packaging the code into a usable or executable form.
Automation tool allows the build process to be more consistent.
In Small scale 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 build, in what sequence and what dependencies there are in the building process. Using an automation tool allows the build process to be more consistent.
08) Role of Build automation in build tools and indicate the needs for build automation
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.
A necessary pre-condition for continuous integration and continuous testing.
- Accelerate the compile and link processing.
- Eliminate redundant tasks.
- Minimize "Bad builds".
- Documentation has the history of builds and release in order to investigate issues.
- Save time and money and improve product quality.
09) Compare and Contrast Different build tools used in industry
I will take Ant, Maven and gradle to discuss because these 3 has individually unique methodologies in their own ways. Maven is significant tool and it has many features more than build tool. There are many more java related build tools targeting the whole JVM system.
- Ant/ Ivy
- This is little bit of old type of build tool but still using that.
- You have to type the configuration code which should run on the process.
- Maven
- Maven is very popular these days and it is considered the de-facto build tool for all Java projects.
- It is a complete software ‘project management system’. It helps you to manage your dependencies/ packages by storing all artifacts on a repository (Maven Central Repository). You specify your ‘build’ file (it is called `pom.xml`).
- Allow customizes the build lifecycle process.
- It follows a convention and Maven is so-called “Convention over Configuration”.
- It is opposite of Ant method.
- Gradle
- Gradle became popular on last 3-4 years.
- It follows Maven's conventional model
- Gradle is both Convention & Configuration.
- Gradle is easy to use.
- Sbt
- MsBuild
Programs that are automate the creation of executable applications from source code.
Gradle does not use XML. Gradle build script tend to be much shorter and clearer that those written for Ant or Maven.
Ant and Maven both are build tools provided by apache.
Main purpose of these technologies is to ease the build process of a project.
10) Build Life Cycle
Well-defined sequence of phases, which define the order in which the goals are to be executed.
Maven is used to represents the central concept of a build lifecycle. It means is that the process for building and distributing a particular artifact (project) is well-defined as explained previously.
Maven is used to represents the central concept of a build lifecycle. It means is that the process for building and distributing a particular artifact (project) is well-defined as explained previously.
Here phase represents a stage in life cycle (Maven).
- Prepare-resource | Resource Copying | Resource copying can be customized in these 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
- Package | Packaging
- Install
- Deploy
11) What is Maven? A Dependency/ Package management tool or build tool or something more?
It is not only an package Management tool or build tool it is more than that. It includes many things with that.
Maven is software management and comprehension tool primarily used with java-based project but that can be used to manage project in other programming languages like c# and Ruby. it is base on the concept called project object model (POM). It can also handle the report documentation related things.
There are major objectives that maven handles:
Maven is software management and comprehension tool primarily used with java-based project but that can be used to manage project in other programming languages like c# and Ruby. it is base on the concept called project object model (POM). It can also handle the report documentation related things.
There are major objectives that maven handles:
- 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
Helps to manage builds, documentation, reporting, dependencies. software configuration management, releases and distribution.
12) How Maven uses conventions over configurations and Maven's approach to manage the configurations.
Software design paradigm used by software framework that attempts to decrease the number of decisions that a developer using the framework is required to make without necessarily losing flexibility.This 'conventions over configurations' means developers are not need to create build process by hand.
Both of configurations are provided by maven and developers don't need to give every each configurations. When a Maven project is created, Maven creates default project structure. Developer is only required to place files accordingly and not need to do any changes in pom.xml.
Most of the project management and build related tasks are done by Maven plugins. Developers don't need to know how those plugins works and plugins do the work for them.
Generic code style and convention:
- License header
- Trailing white space
- Indentation
- Line Wrapping
13) Terms Build phase, build life cycle, build profile and build goal in Maven
Build Phase:- Where in a build phase represents a stage in the life cycle.
- Validate -> validate the project correct and all necessary information is available.
- Compile -> Compile the source code of the project.
- Test -> Test the compiled source code using a suitable unit testing framework.
- Package -> This phase creates the JAR/WAR package as mentioned in the packaging in POM.xml.
- Verify -> ...
- Install -> This phase installs the package in local/remote maven repository.
- Deploy -> Copies the final package to the remote repository.Copies the final package to the remote repository.
There are always pre and post phases to achive the goal of maven tool.
Maven has three life cycles,
- Clean
- Default
- Site
A goal represents a some task which contributes to the building and managing of a project. It may be bound to zero or more build phases. A goal not bound to any build phase could be executed outside of the build lifecycle by direct invocation.
14) How Maven manages dependency/ packages and build life cycle
Directly specify the version of artifacts to be used when they are encountered in transitive dependencies. For an example project C can include B as dependency in its dependency management section and directly control which version of B is to be used when it is ever referenced.
We have set of project under a common project in such case, we can create a common POM having all the common dependency and then make this POM, the parent of sub projects's POMs.
15) Other Contemporary tools and practices widely used in the software industry
There are a broad range of software development tools and methods currently available or which could be built using current research and technology. These tools and methods can be organized into four software development environments, ranging in complexity from a simple environment containing few automated tools or expensive methods to a complete one including many automated tools and built around a software engineering database. These tools make all easy which is related to software development.- Continuous integration
- Configuration Management
- Test automation
- Issue/ Bug tracking tools
- Agile methodologies, Devops.
Lab Answers
What is the meaning of Group Id, Artifact Id, Version, and Packaging?
Group Id uniquely identifies your project across all projects, so we need to enforce a naming schema. A group Id must follow Java's package name rules.
Artifact Id is the name of the jar without version.
What are the other directories and files, and their purpose in the Maven project?
src/main/java | Application/Library sources |
src/main/resources | Application/Library resources |
src/main/filters | Resource filter files |
src/main/webapp | Web application sources |
src/test/java | Test sources |
src/test/resources | Test resources |
src/test/filters | Test resource filter files |
src/it | Integration Tests (primarily for plugins) |
src/assembly | Assembly descriptors |
src/site | Site |
LICENSE.txt | Project's license |
NOTICE.txt | Notices and attributions required by libraries that the project depends on |
README.txt | Project's readme |
If you can see some errors in the code in AppTest.java, what is the reason for that and how we can fix those errors?
downloaded some open source software written in Java and tried to compile it using Eclipse. I got the error
Thank you for reading the Blog until the end. Meet you again in another blog.
Comments
Post a Comment