Sunday, February 24, 2019

Coding Concepts: What's the Difference Between a Platform, a Framework, and a Library?

I remember way back when I was getting started in coding and programming (and dinosaurs roamed the earth), one of the things that I always found confusing was the differences between a platform, a framework, and a library. Was their some sort of hierarchy between the 3 terms - like a platform hosting a framework that's based on multiple libraries? To further confuse matters, many coders and programmers seemed to use the words interchangeably. Let's break each term down to determine what makes a framework different from a platform, a platform different from a library, a library different from a framework, and a platform that identifies as a framework, but is still really just a platform.

Hacky's Coding Concepts: Understanding the Differences Between a Platform, a Framework, and a Library!

What is a Platform to Programmers?

Let's start by discussing the platform - what it is, what it provides, and how your code couldn't operate without it. In the programmer's world, a platform refers to the support or base that provides the code or applications you develop or that other's have developed to function. In coding, the platform is just the base or foundation upon which an application can run. It provides platform users with conformity, standards (how a coding language or program is interpreted by the computer), storage, and execution of the application. For instance, the iPhone is considered to be a platform. Thousands of app developers will typically use a different platform (like say an iMac) to develop applications to run on the iPhone platform. 

The key to remember is that the platform provides the foundation upon which other applications and programs can run. Over the last few years, the term has been broadened to include solely software based platforms - such as the browser you're using to read this article. Take Chrome for instance. Chrome has thousands of extensions you can install to add additional functionality to your computer. Why in my browser alone, I have a bunch of free extensions which anybody can pickup from the chrome web store. Here's just a few of my favorites: *deep breath*
  • Eye Dropper - Tells me the color of any color on the screen I click on.
  • Picture in Picture - An extension that lets me miniaturize and watch youtube videos in the lower corner of my browser while moving around the web (handy for tutorials ;) )
  • eBates - A plugin that offers cashback from the most popular websites (that you probably already shop anyways. This one is a must have!) I've been a member for about 3 years now, and have over $300 in cash back that's been paid into my paypal account. 100% automated after setup and added as a browser extension to chrome or firefox. It couldn't be easier to get back close to $100/year!
  • My Code Stock Clipper - Let's me save code snippets from anything I find online directly to my online code library. 
  • Adblocker Ultimate - Good bye popups and annoying ads!! 
There's thousands of free apps that make the online experience - each designed to make you more enlightened and efficient. In this case, Chrome is the platform upon which the programs run and operate. Maybe it's time for a hacky plugin extension for chrome! Hmmmmm.

What's a Framework to Coders?

In a lot of ways, a framework isn't very different from a platform - at least since we consider a browser to be a platform. The big thing that separates the two is that while a platform is the base, the framework is the tool. A framework is an application that is typically compatible with a particular platform (or multiple platforms which is referred to as 'cross platform compatible' - ie works on windows and apple products) that is used to develop and deploy other applications.

Think of a framework as you would the framework of your house or apartment or your mom's basement. The framework is the wooden (or sometimes metal) supports that provide the support for everything else in your home. It is the canvas upon which home renovators create their masterpiece (or in my case, a bunch of half finished projects that never quite seem to get done). In the case of programming, the renovator is a lot like the programmer. They may alter many different things about the house, or even add an extension, but the framework - the main support structure of the house - typically remains unchanged. In a coding framework, the underlying code typically remains unchanged, though it can be modified by a programmer - typically by using various calls and methods predefined by the framework. Thus, if your framework can't support putting a fireplace in your bathtub, you wouldn't do it. I suppose you could 'technically' build an extension to your framework to add such luxurious amenities, but you'd likely be the laughing stock of all the other renovators and probably everyone else - then again, you could start a new trend and retire a multi-bajillionaire. 

So here's where we're at - you start with a platform as the foundation for your project. It's the hardware and software that combine to allow you to code. The subset of this a framework, which is a specific tool you can use that operates within your platform to make developing applications faster and easier. 

What's a Program Library?

Sometimes I wonder if my brain needs to be upgraded, because I can only recall about 1/3rd of what I read. My wife on the other hand never seems to forget anything. Just try and win an argument with her and you'll see what I mean, lol.

Right, let's talk about one of the greatest time savers in the programmers coding arsenal - coding libraries. One of the smartest things a professional developer once told me was something I heard about 5 or 6 years ago after I asked, 'What's the one bit of advice you'd give aspiring programmers?' 'Hacky,' he says, 'if you're thinking about writing some code, chances are it's already been written.' What a jip. I was like, that's not how you become one with the Force! What kinda Jedi bullshit is this?! Turns out (even if it wasn't done in a manner that presented as much flare and creativity as I'd like), his advice was priceless; and thanks to libraries, much of that code is now at our fingertips if you know where to look! 

Let's take a look at some of the most popular coding languages to examine just how useful a library can be. We'll start with javascript!

Javascript Libraries

Javascript is an object oriented programming language or OOP for short. "Ya down with OOP, yeah you know me! Ya down wit OOP, yeah you know me!" Showing my age there for a second! Object oriented programming is a programming methodology that concerns itself with object analysis and manipulation rather than an action and logic driven response. A simple example of OOP is to consider a car. The car is the object, and a car can have attributes (or descriptors). Some attributes the car might have are: color, type, and model. The descriptions provided are the values: red, truck, and F-150. 

There are a couple thousand javascript libraries that you can tie your code into to make programming easier. In essence, a library prevents the need to reinvent the wheel every time you code. Let's take a look at just how many wheels and rims are available by searching javascripting.com. Since my whip has got to look fresh, I'ma gonna get me some spinners. The number of libraries is so expansive, that it literally brings up a library called spin.js when I search for libraries named 'spinners'. Now, the library isn't for making images of cars wheels spinning, spin.js is actually a library for the spinning/loading animated graphic that you see when an app/page is loading. Still pretty cool, huh? It got me thinking though. I wonder if bubrub and lil sis's 'whistle tip' will show up....bah, no such luck. The point is, check it out! You never know what you'll find. For instance, while searching for 'whistle tip', I came across jQuery-JSONP...why it brought that up I have no idea, but it's an interesting library I might have to check out for one of my apps in the near future. 

The Conclusion When Examining Platforms, Frameworks, and Libraries

There is a hierarchical structure built into the coding ecosystem - a library is typically used in various frameworks by coders looking to bring a sense of simplicity and conformity while coding on their favorite platform. That doesn't mean you can't have a framework and library named the same thing. For instance, there are both javascript libraries and javascript frameworks. The difference is determined by their functionality. Consider the following diagram: 

A framework will call your code for instructions, and your instructions may include to 'include' a specific javascript library. Hence, the framework now contains a library.

Hopefully, this coding concept tutorial has helped shed some light on the differences between platforms, frameworks, and libraries. Any questions, post in the comments section below. :) 

No comments:

Post a Comment

Feel free to send along any questions, comments, or hacks you'd like to see :)