Version Control with Git (Part 1)

In modern programming, it’s common for developers to work together. Sometimes, we just want to track the ‘history’ of work. Many have tried so many approaches to solving these problems. The common approach is generally the use of Version Control Systems.

A Version Control System allows developers to work together and see the history of work done. Generally there are 2 types of Version Control System

  1. Centralized Version Control Systems (CVCS)
  2. Distributed Version Control Systems (DVCS)

I will be discussing Git which mainly falls under the Distributed Version Control System. But to get a clearer picture, let’s discuss with a common scenario: You and a few programmers have been tasked with developing a website for a company. Among the team, you are mainly proficient with JavaScript whiles another collaborator is great with HTML and CSS. The third friend is great with databases but he’s very helpful in other fields too.

Centralized Version Control Systems

With this approach, there’s a central store of the project files. Everyone is supposed to be a collaborator to this central store. A great implementation of this type of version control system is Microsoft’s Team Foundation Version Control (TFVC).

There is one major flaw to this approach though. If the main store goes down, it means that there is no collaboration until it get back up. Even worse, when the disk gets corrupted then everything is lost. Another problem lies in the fact that network connection is needed when we want to publish every change made to the work.

It is worth noting that current implementations have found a way around this problem though but not all.

Distributed Version Control Systems

Just like CVCS, there is a central store but each collaborator also has a mirrored copy of that repository locally. One can focus on the local copy solely and commit all the changes or only a single change to the central store. This means that if the server goes down, any of the collaborators can copy their version onto the server to restore it. An implementation like Git doesn’t rely on the central store so any operation can be performed locally. A great benefit to this is that, you only need network connection when you want to publish changes to the central store.

I’m sure you are relating the description of the various version control approaches to the scenario earlier. If you did that, then you should have realized long ago why DVCS are the most used approach in software development.

Git

Git is a free DVCS that is used for software development. It is aimed at speed and distributed linear workflows. Git was created by Linus Torvalds (Father of Linux operating system) in 2005.

Back to the scenario mentioned earlier. You’ll have to create a central Git store for the project. Every collaborator will push final changes there. This could be created at GitHub, BitBucket, etc.

After that, each collaborator will create a local git repository and connect it to the central git store. This can be achieved like so:


git init

git remote add origin {url_to_central_store}

git pull origin master

Line 1 initializes Git in the folder you are using. Make sure you are already in the project folder of interest before initializing Git. Line 2 adds the url to your central store to your local Git using the ‘remote’ command. It is clear that all git commands are preceded with ‘git’.

Using Git requires you use command prompt or a bash to work things around. To use local Git repository effectively, clear understanding  of the structure is needed.

In part 2,  I’ll explore the Git commands and how to enhance collaboration with it.

Enjoy coding!!

 

 

The Journey To Web Programming

Web Programming! If your aspire to be a web programmer, that’s great. But, the journey isn’t easy. You’ll need to brace yourself to face all the hardships and roadblocks just ahead. I intend to help you on the way though.

The first and major step to consider is how to start. Starting well means having a promise of a good finish. To start a career in web programming means at least learning HTML and CSS. Many will insist on learning JavaScript and they are absolutely right.  JavaScript, as a client side programming language gives life to your web application.

Let’s break the basics down to functionality. It’s good to assign roles to the different moving parts. First, HTML will represent the structure. CSS will design or style your web application. JavaScript injects logic into the app.

Keeping these moving parts and their roles in mind will help you in your journey to be a web programmer.

Other concerns include financial benefits and the availability of jobs. To clarify those concerns, kindly imagine the total number of websites and applications that you can think of. These are very many – you may have unending results in your mind. This clearly illustrates the booming nature of the industry. A career in Web Programming means a career for the future. At this stage, hop on the bus!

Now that the moving parts are clarified and career prospects are established, lets discuss the technologies involved. You may have heard of HTML5, CSS3 among others. Of course, these technologies all help in Web Application development. But, not all are needed. Let’s break them down based on the moving parts of a Web Application.

Structure

The structure of a Web Application necessarily has to be HTML (Hypertext Markup Language). Hence any version of HTML is OK. Current version means more features (Cool features). The most recent version is HTML5.

Style

Though inline style can be applied in HTML, external stylesheet written in CSS (Cascading Style Sheet) can really enforce separation of concerns. Just like HTML, latest version means more features. The current version is CSS3.

Aside that, you also need to know the existence of CSS preprocessors. Currently, there are 3 in the market – Sass, LESS and Stylus. A CSS preprocessor is a scripting language that extends CSS. It compiles(at base level, if converts) down to CSS. Basically, it’s meant to make writing CSS a lot easier than it is already.

Logic

The brain of the Web Application lies in its JavaScript. Learning JavaScript opens a wide range of possibilities to be applied to a web page. These can range from showing dynamic carousel (Slider) images to timer related actions.

JavaScript also comes in versions but you won’t be typically concerned about these. JavaScript is based on another language called ECMAScript. Its current version is ECMAScript 2015 released in mid of 2015. Though not all browsers fully support the features of ECMAScript 2015, it’s worth noting that there are transpilers for converting code between current and previous versions. Some of these transpilers include Babel and TypeScript(My favorite).

Now, i think all that’s needed has been laid down. With the above provided information, one has the strength to hop on to the Web Programming train. If you have no knowledge whatsoever in any of the mentioned technologies, don’t worry. I intend to write articles on all of them. Leave a comment below, i may consider your request.

Please enjoy coding!