The idea behind object oriented programming was to introduce a coding methodology that could help in running the code in modules by dividing the execution paths. The basic difference between structured and modular code is that much of your code does not have to be initialized which can save system resources and avoid a lot of compile errors or warnings. Think of it like, doing some extra work on a piece of writing or research which you never use in the actual article. The research might not even be used as direct reference within the actual content so you don’t want to send it with the actual content, just to prevent misreading and extra load on the editor’s or compiler’s (no pun intended) end.
That approach has become more constrained now with so many build references and files being used combined within a project. With so many JavaScript related projects such as Node.js or Angular, this modular approach itself has become a little bit more messy and error prone. Gulp.js is one of those build tools that allows you to divide and automate many processes being done within a large chunk of code and run it with less errors, very less errors.
So what is Gulp?
Like the name suggests it allows you to process or digest a large chunk of code. And this does it by breaking it down in smaller components which is what I meant by talking about running certain processes separately. They can be something as simple as concatenation (and yes it can be difficult and done on larger scale in some projects), which would be handled by Gulp. Now how Gulp works is via Streams and streams do what I just pointed out. They divide the software component in several smaller coded modules or components which then combine and run as a whole.
Let me show you a sample run up of how a very basic Gulp coding stream looks like.
Now, in your project, install gulp as a developer dependency
Next, make gulpfile.js in the root of your project
Lastly, run gulp from your command line gulp
You can read more on the overall tutorial for beginning with Gulp from Jeff Lembeck’s article.
This example is good way to find out the positives surrounding Gulp and more importantly it shows the emergent need for such tools which allow modularity within the code on a more superficial level. I know Im probably getting stick from a lot of you hardcore web developers and WordPress artists for this, but this is the wholehearted truth of the matter. Modular code is needed in today’s business setting when codes are spread all over the place and multiple programmers work upon a single project.
Even with debugging a code of making minor changes within it, problems can arise if the processes are intrinsically linked to other major chunks of the code. Shift a few lines of code in one class and then you have to go and rewrite the field instances or types in the class definition. And that is just one example of problematic rewriting. When delegates, interfaces and other complex structures step in then this rewiring of the code becomes more complex so this is where it helps to have something like build tools which helps people who haven’t worked on the code from scratch to be able to work more upon the code and finish without hampering the software development process or their own working.
My own two cents upon such build tools are still in development (again pardon the pun). Tools like these are worth investing in if your overall return in investment’s margin is more catered to the long term view of things. If you are a small startup looking to minimize your costs then most build tools might not be for you, however if you are an entity that can sustain the early costs and then make your development process thrive with reduced time then Gulping your code might be a very viable solution for you.