Git and GitHub Workflow

git_banner

 

Once you dive into the open source community, you quickly realize the scale of a project and the importance an efficient workflow plays on the project’s success. Utilizing version control technologies such as Git not only tracks changes in files but makes collaborating with multiple people possible. A key factor to any successful project. To gain some exposure to the process of creating, maintaining, and contributing to an open source project, we were tasked with developing our own library which could be implemented by a developer to complete a set of tasks.

The goal of this assignment was to create a new GitHub repository, design and manage a library that can be used to obtain various pieces of info about a given file on disk.

Basic functionality requirements:
• filename without path
• file size in bytes
• sha1 digest for a file at the given path
• MD5 digest for a file at the given path

In this post I will be discussing my experience with creating a GitHub project, programming with Node.js, and collaborating with other students. I’ll be writing a future post which will go more in depth about the library I’ve created.

Feel free to check out and contribute to my FileSide repository.

Init

Since we were given the freedom to develop a library in any programming language we pleased, I had elected to work with Node.js. Having worked with Node.js in the past I felt this would be a great opportunity to build on my existing knowledge.

Node.js is an open source platform for creating applications that uses JavaScript on server side as well as on the client side. It is also capable of asynchronous I/O that makes it lightweight and efficient.

Although I have experience with Node, I’ve never actually developed a library from scratch. I wasn’t sure what a suitable project structure would be best. Before getting started I read a few articles and examined existing libraries to gain some insight on the most efficient project structure. Many people have different preferences when it comes to organizing their work and it really depends on the functionality of your project.

One feature I love about Node.js is its thousands of modules made accessible to developers through its default package manager. The command line client ‘npm is backed by an online database of public and paid-for private packages, called the npm registry. If you could think it there’s a good chance ‘npm’ has it. Making it simple and worry free to implement other modules in your project.

I was able to import and existing modules such as filesize. It provides a simple way to get a human readable file size string from a number (float or integer) or string. This was useful in returning a readable file size to the user without having to process the file manually.

Collaborating

In addition to creating our own library we were also encouraged to collaborate on other student’s projects. This time around I decided to step outside my comfort zone and dive into a completely new programming language, because I’m on my fourth cup of coffee and its 1:00AM so why not?

I came across Sean Prashad’s  Rust project repository, ‘Lust’. A simple Rust library intended to retrieve information about your local file system.

For those of you unfamiliar with Rust, join the club. I’ve heard many great things about the new programming language but never had a chance to dig deeper in to it. Rust is an open-source systems programming language that is syntactically like C++ but focuses on speed, memory safety and parallelism.

Once I setup my development environment I went straight to the documentation for some guidance. Let’s face it, some documentations can be confusing, cluttered, and extremely vague. I was surprised to see that the team at Rust created a beginners introductory book, with a helpful getting started guide and descriptive examples of Rust concepts. Each example has interactive code snippets that can be executed for testing. You could tell the team is focused on simplicity and ease of use.

The issue I had selected to work on was a new feature request to implement loop functionality to re-prompt the user to retrieve additional file metadata until they quit the process. I found working with Rust to be very similar to C++ but with cleaner and simplified syntax.
For more information on my changes, you can check out the pull request.

Reflection

Working with Git to manage a project on a smaller scale has been very helpful for developing my comfort and skill with the tool. Git can be extremely intimidating for new users. I mean there’s five different ways to perform one function, but one wrong move and you’ve somehow deleted the internet with the --force flag. Practicing your git workflow on a personal project helps give you a better understanding of the commands your executing and how they can be applied to different scenarios.

Related Posts

Categories