Versioning

Semantic

Versioning

Semantic, what?

absence of ambiguity

versioning, that has a story to tell

Mayeenul Islam

UX Designer & Web Developer

SemVer - Semantic Versioning

https://semver.org/

Semantic Versioning 2.0.0

Nature

X.Y.Z

Patch

Minor

Major

Patch Release

bugfixes

X.Y.Z

patches

Minor Release

new features

X.Y.Z

backward compatible

improvements

Major Release

breaking changes

breaks backward compatibility

completely refined UX

X.Y.Z

Example - Let's Assume

Windows 7

1.0.0

Patch Release

1.0.1

HACKED 😈

New Feature (Voice Recognition)

1.1.0

New Feature (Screen Reader)

1.2.0

Windows 8

2.0.0

New Features (Remote Desktop + Games)

2.1.0

Improvements

2.2.0

Bug Fixes

2.2.1

Bug Fixes

2.2.2

Type of Releases

pre-release

stable release

0.1.0-alpha

0.1.0-alpha-sha-13d1c54

1.0.0

158.7.11

3.0.0-RC-1

0.1.0

1.0.0-Alpha

Understanding

1.0.0-alpha          <    1.0.0-alpha.1

1.0.0-alpha.1       <    1.0.0-alpha.beta

1.0.0-alpha.beta <    1.0.0-beta

1.0.0-beta            <    1.0.0-beta.2

1.0.0-beta.2         <    1.0.0-beta.11

1.0.0-beta.11       <    1.0.0-rc.1

1.0.0-rc.1              <    1.0.0

B*s*t Example

15.147.216

216 Fixes/Patches on v15.147

147 Feature Upgrades on v15

15 Breaking Changes

Non-linear over Linear

1.0.0

1.0.1

1.1.0

1.2.0

2.0.0

2.1.0

2.2.0

2.2.1

2.2.2

1.2.1

1.0.0

1.0.1

1.1.0

1.2.0

2.0.0

2.1.0

2.2.0

2.2.1

2.2.2

Long Term Loyal Support

A fix on legacy code

How Code are Versionified (?)

<?php
declare(strict_types=1);

/**
 * Foo.
 * 
 * @param  string $bar The bar.
 *
 * @since 1.8.2 Initiated to support foo.
 * @since 2.3.1 Added type declaration in favor of PHP 7.
 * 
 * @return string      The modified bar.
 */
function foo( string $bar ) : string
{
	return $bar + 'Foo';
}

Using Code Documentation

example.php

Versioning - Why?

Versions - Why?

A Measurement of Efficiency

Versions

measure

efficiency

TutorLMS

by Themium

Versions - Why?

Valid Message to the Audiences

Easier Upgrade Decisions

Versions - Why?

Technical Support

Support specific to the Problem

Fixed

v1.9.6

Bug

v1.9.5

Versions - Why?

Assets Caching

Version-specific caching can be achieved

<script src="assets/js/app.js?ver=1.0.0"/>
<script src="assets/js/app.js?ver=1.0.1"/>

Versions - Why?

key value
version 1.0.1
foo bar
// Main project variable
var version = 1.0.1;

var version_current = get_db_val('version');

if( version > version_current ) {
    
    // add new data to db specific to newer version
    add_update_db_val( 'foo', 'bar' );

}

// finally update the version in db
add_update_db_val( 'version', version );
key value
version 1.0.0
// Main project variable
var version = 1.0.0;

// add the version in db
add_update_db_val( 'version', version );

Dynamic Software Updates

concept

concept

Versions Comparison - How?

PHP

http://php.net/manual/en/function.version-compare.php

.NET

https://docs.microsoft.com/en-us/dotnet/api/system.version.op_greaterthan

Versions Comparison - How?

Python

distutils.version.StrictVersion
(or)
distutils.version.LooseVersion

Java & JavaScript

(not by core - third-party available)

Versioning Code using Git

git tag -a

Compatible with Github Releases and Gitlab Tags

# Displays all the tags
git tag

# Adding new tag (release)
git tag -a 1.0.0 -m "First Public Release"

# Adding new tag on specific commit
git tag -a 1.0.0 9fceb05 -m "First Public Release"

# Pushing local tags to remote
git push origin --tags

Versioning Code using Git

git tag -d

Compatible with Github Releases and Gitlab Tags

# Displays all the tags
git tag

1.0.0

# Deleting local tag
git tag -d 1.0.0

# Deleting tag on remote
git push origin :1.0.0

Github Releases

Releasing on Github and Github Releases API
(in Bengali)

http://tuts.nanodesignsbd.com/releasing-github-project/

Inspiration

an example from npm package.json (JavaScript)

"dependencies" : {
    "jquery" : "^3.3.1",
    "lodash" : "2.x"
}

Semantic Versioning is Everywhere

Inspiration

Semantic Versioning is Everywhere

"require": {
    "php": "^7.1.3",
    "laravel/framework": "5.7.*",
    "laravel/tinker": "^1.0"
}

an example from composer.json (PHP)

Inspiration

Semantic Versioning is Everywhere

an example from NuGet (.NET)

Inspiration

Semantic Versioning is Everywhere

an example from Maven (Java)

Automation

grunt version::patch

Grunt Version/Gulp Bump

https://github.com/stevelacy/gulp-bump

https://github.com/kswedberg/grunt-version

Automation

https://threedots.tech/post/automatic-semantic-versioning-in-gitlab-ci/

GitLab CI

Further Study

SemVer
https://semver.org/

npm SemVer Tool
https://semver.npmjs.com/

3 Effective Techniques For Software Versioning
https://10kloc.wordpress.com/2013/01/05/3-effective-techniques-for-software-versioning/

Go Semantic...

Versioning

By Mayeenul Islam

Versioning

Product/Project/Artifact versioning using Semantic Versioning (SemVar v2.0.0)

  • 305