Tuesday, February 26, 2019

Industry Practices and Tools 2

Importance of maintaining the quality of the code, explaining the different aspects of the code quality

Readability- refers to how well you can read the text and how well the layout has been made.It's very important when your programming code is readable, this is because when you or someone else is reviewing the code it is best if it's comprehensible so any errors that may appear can seen noticed easier, and also, if the code is cluttered then looking through it for errors or if you want to make changes will take much longer.

Robustness- refers to how tough the data is and how well it can deal with various inputs and if it can detect and mitigate errors well. This is very important as you as a programmer don't want data that easily fails apart and you also want one that can make your job easier and detect and handle data in a dataset.

Portability- refers to how well the data can be used in various OS computers and environments.This aspect is very important as you may be working on something that has to be used by another company that may or may not be in another country, so you have to make sure that another OS, computer and company can understand and use your code.

Maintainability- refers to how easy it is to maintain the code. This is also highly important as you will encounter issues throughout programming since it's part of the process of making good code, but once you're done bugs and errors will pop up that you may or may not have seen before, having easily maintainable data means that you can just go in and quickly find out the issue and resolve it, this also refers to how easy it is to edit the code and process too.

Different approaches and measurements used to measure the quality of code

1. Use a Coding Standard

Using a coding standard is one of the best ways to ensure high quality code.
A coding standard makes sure everyone uses the right style. It improves consistency and readability of the codebase. This is key for lower complexity and higher quality.

2. Analyze Code — Before Code Reviews
Quality should be a priority from the very start of development. There isn’t always the luxury of time as development progresses. That’s why it’s important to analyze code before code reviews begin. And it’s best to analyze code as soon as it’s written.
In DevOps, code analysis takes place during the create phase. Static analyzers can be run over code as soon as it’s written. This creates an automated feedback loop, so developers can improve code before it goes to the code review phase.
After all, the earlier you find errors, the faster, easier, and cheaper they are to resolve.

3. Follow Code Review Best Practices

Manual code reviews are still important for verifying the intent of the code. When code reviews are done well, they improve overall software quality.

4. Refactor Legacy Code (When Necessary)

One way to improve the quality of an existing codebase is through refactoring. Refactoring legacy code can help you clean up your codebase and lower its complexity.

Identify and compare some available tools to maintain the code quality

1) Collaborator

Collaborator tool
Collaborator is the most comprehensive peer code review tool, built for teams working on projects where code quality is critical.

  • See code changes, identify defects, and make comments on specific lines. Set review rules and automatic notifications to ensure that reviews are completed on time.
  • Custom review templates are unique to Collaborator. Set custom fields, checklists, and participant groups to tailor peer reviews to your team’s ideal workflow.
  • Easily integrate with 11 different SCMs, as well as IDEs like Eclipse & Visual Studio
  • Build custom review reports to drive process improvement and make auditing easy.
  • Conduct peer document reviews in the same tool so that teams can easily align on requirements, design changes, and compliance burdens.

2) Review Assistant

review-assistant tool logo
Review Assistant is a code review tool. This code review plug-in helps you to create review requests and respond to them without leaving Visual Studio. Review Assistant supports TFS, Subversion, Git, Mercurial, and Perforce. Simple setup: up and running in 5 minutes.
Key features:
  • Flexible code reviews
  • Discussions in code
  • Iterative review with defect fixing
  • Team Foundation Server integration
  • Flexible email notifications
  • Rich integration features
  • Reporting and Statistics
  • Drop-in Replacement for Visual Studio Code Review Feature and much more

3) Codebrag

Codebrag Logo
  • Codebrag is a simple, light-weight, free and open source code review tool which makes the review entertaining and structured.
  • Codebrag is used to solve issues like non-blocking code review, inline comments & likes, smart email notifications etc.
  • With Codebrag one can focus on workflow to find out and eliminate issues along with joint learning and teamwork.
  • Codebrag helps in delivering enhanced software using its agile code review.
  • License for Codebrag open source is maintained by AGPL.

4) Gerrit

Gerrit Logo
  • Gerrit is a free web-based code review tool used by the software developers to review their code on a web-browser and reject or approve the changes.
  • Gerrit can be integrated with Git which is a distributed Version Control System.
  • Gerrit provides the repository management for Git.
  • Using Gerrit, project members can use rationalized code review process and also the extremely configurable hierarchy.
  • Gerrit is also used in discussing a few detailed segments of the code and enhancing the right changes to be made.

5) Codestriker

Codestriker Logo
  • Codestriker is an open source and free online code reviewing web application that assists the collaborative code review.
  • Using Codestriker one can record the issues, comments, and decisions in a database which can be further used for code inspections.
  • Codestriker supports traditional documents review. It can be integrated with ClearCase, Bugzilla, CVS etc.
  • Codestriker is licensed under GPL.

Need for dependency/package management tools in software development

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.
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 dependenciesnecessary 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 repositoriesbinary 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-likesystems, typically consisting of hundreds or even tens of thousands of distinct software packages.

Role of dependency/package management tools in software development

Dependency management tools move the responsibility of managing third-party libraries from the code repository to the automated build. Typically dependency management tools use a single file to declare all library dependencies, making it much easier to see all libraries and their versions at once.

What is a 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. ... Using an automation tool allows the build process to be more consistent.

Explain the role of build automation

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

Different build tools used in industry

Invoke

Website • Wikipedia
Invoke is a Python (2.6+ and 3.3+) task execution tool & library, drawing inspiration from various sources to arrive at a powerful & clean feature set. 

Open Build Service

Website • Wikipedia
The Open Build Service (OBS) is a generic system to build and distribute packages from sources in an automatic, consistent and reproducible way.

Webpack

Website • Wikipedia
Webpack is a module bundler for modern JavaScript applications.

Buildr

Website • Wikipedia
Buildr is an open-source build system mainly intended to build Java applications, but capable of doing much more. 

Maven

Website • Wikipedia
Maven is a build automation tool used primarily for Java projects. The word maven means 'accumulator of knowledge' in Yiddish.

MSBuild

Website • Wikipedia
MSBuild, also called Microsoft Build Engine, is a build tool for managed code and was part of .NET Framework.

Explain the build life cycle, using an example

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.
Each of these build lifecycles is defined by a different list of build phases, wherein a build phase represents a stage in the lifecycle.
  • validate - validate the project is 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. These tests should not require the code be packaged or deployed
  • package - take the compiled code and package it in its distributable format, such as a JAR.
  • verify - run any checks on results of integration tests to ensure quality criteria are met
  • install - install the package into the local repository, for use as a dependency in other projects locally
  • deploy - done in the build environment, copies the final package to the remote repository for sharing with other developers and projects.

What is Maven, a dependency/package management tool or a build tool or something more?

Apache Maven is a software project management and comprehension tool. Based on the concept of a project object model (POM), Maven can manage a project's build, reporting and documentation from a central piece of information.

How Maven uses conventions over configurations

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. When a Maven project is created, Maven creates default project structure. Developer is only required to place files accordingly and he/she need not to define any configuration in pom.xml.

Discuss the terms build phases, build life cycle, build profile, and build goal in Maven

A Build Lifecycle 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. As an example, a typical Maven Build Lifecycle consists of the following sequence of phases.
PhaseHandlesDescription
prepare-resourcesresource copyingResource copying can be customized in this phase.
validateValidating the informationValidates if the project is correct and if all necessary information is available.
compilecompilationSource code compilation is done in this phase.
TestTestingTests the compiled source code suitable for testing framework.
packagepackagingThis phase creates the JAR/WAR package as mentioned in the packaging in POM.xml.
installinstallationThis phase installs the package in local/remote maven repository.
DeployDeployingCopies the final package to the remote repository.
There are always pre and post phases to register goals, which must run prior to, or after a particular phase.
When Maven starts building a project, it steps through a defined sequence of phases and executes goals, which are registered with each phase.
Maven has the following three standard lifecycles −
  • clean
  • default(or build)
  • site
goal represents a specific 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.
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 v/s Development environments.
Profiles are specified in pom.xml file using its activeProfiles/profiles elements and are triggered in variety of ways. Profiles modify the POM at build time, and are used to give parameters different target environments (for example, the path of the database server in the development, testing, and production environments).

How Maven manages dependency/packages and build life cycle

Use of the repositories
•Maven uses two types of repositories: local and
remote
• Local – inside the computer
• Remote
• Internal – Within the company
• External – Via internet, from the original repo

Best Practice - Using a Repository Manager
•A repository manager is a dedicated server application designed to manage repositories of binary components. The usage of a repository manager is considered an essential best practice for any significant usage of Maven.
Use the POM
•Project Object Model (POM) is an XML representation of a Maven project held in a file
named pom.xml
•Contains the configurations of the project
•developers involved and the roles they play
• the defect tracking system
• the organization and licenses
• the URL of where the project lives
• the project's dependencies
•Etc…

Discuss some other contemporary tools and practices widely used in the software industry

1. NPM

Each project can use a package.json file setup through NPM and even managed with Gulp(on Node). Dependencies can be updated and optimized right from the terminal. And you can build new projects with dependency files and version numbers automatically pulled from the package.json file.
NPM is valuable for more than just dependency management, and it’s practically a must-know tool for modern web development. If you’re confused please check out this Reddit thread for a beginner’s explanation.

2. Bower

The package management system Bower runs on NPM which seems a little redundant but there is a difference between the two, notably that NPM offers more features while Boweraims for a reduction in filesize and load times for frontend dependencies.

3. RubyGems

RubyGems is a package manager for Ruby with a high popularity among web developers. The project is open source and inclusive of all free Ruby gems.
To give a brief overview for beginners, a “gem” is just some code that runs on a Ruby environment. This can lead to programs like Bundler which manage gem versions and keep everything updated.

4. RequireJS

There’s something special about RequireJS in that it’s primarily a JS toolset. It can be used for loading JS modules quickly including Node modules.
RequireJS can automatically detect required dependencies based on what you’re using so this might be akin to classic software programming in C/C++ where libraries are included with further libraries.

5. Jam

Browser-based package management comes in a new form with JamJS. This is a JavaScript package manager with automatic management similar to RequireJS.
All your dependencies are pulled into a single JS file which lets you add and removeitems quickly. Plus these can be updated in the browser regardless of other tools you’re using (like RequireJS).

6. Browserify

Most developers know of Browserify even if it’s not part of their typical workflow. This is another dependency management tool which optimizes required modules and libraries by bundling them together.
These bundles are supported in the browser which means you can include and merge modules with plain JavaScript. All you need is NPM to get started and then Browserify to get moving.

7. Mantri

Still in its early stages of growth, MantriJS is a dependency system for mid-to-high level web applications. Dependencies are managed through namespaces and organized functionally to avoid collisions and reduce clutter.

8. Volo

The project management tool volo is an open source NPM repo that can create projects, add libraries, and automate workflows.
Volo runs inside Node and relies on JavaScript for project management. A brief intro guide can be found on GitHub explaining the installation process and common usage. For example if you run the command volo create you can affix any library like HTML5 Boilerplate.

9. Ender




Ender is the “no-library library” and is one of the lightest package managers you’ll find online. It allows devs to search through JS packages and install/compile them right from the command line. Ender is thought of as “NPM’s little sister” by the dev team.

10. pip

The recommended method for installing Python dependencies is through pip. This tool was created by the Python Packaging Authority and it’s completely open source just like Python itself.


No comments:

Post a Comment

RICH WEB BASED APPLICATIONS

Term “Rich Internet Applications” (RIAs) from “Rich Web-based Applications” (RiWAs). A rich Internet application (RIA) is a Web applicati...