๐ฃ Languages: Many options to accomplish similar outcomes.
The number of programming languages that exist seems to be anywhere from 700 to 25,000. There's no way you're going to learn them all, and in reality, there are probably about 50 that are in any sort of wide usage in the wild, so don't waste your time learning some esoteric programming language. This list is not exhaustive, but the reality is that you're likely to run into one of these open-source languages in your travels:
It would be a fool's errand even to think that we could cover all the beautiful nuances and depths of each of these
languages. We will briefly go over each one, give a quick overview, discuss a few strengths and weaknesses, and show you
what the code would look like to fetch from an imaginary API
that returns cheeseburgers, just so you can see the
differences. These are not exhaustive overviews, and every fan of each language will argue as to why theirs is the best.
Remember, we're just trying to get some high-level visibility...so calm down, person who is scrolling for the comment
box right now...
๐ Ruby
A great language that people really love. Almost too much sometimes. But it's all good.
Strengths
- Active and friendly community.
- People love writing in Ruby.
- The language is concise and clean.
- Many libraries (known as
gems
) for your problem.- People love using Rails, a framework to build web applications with Ruby.
Things To Consider
- It can be slower than compiled languages like Java
Example of fetching from an API
require 'rest-client' # require a rubygem (code someone else wrote)
require 'json'
response = RestClient.get "https://cheeseburgerapi.com/api/burgers"
parsed = JSON.parse(response.body)
# print out the first cheeseburger
puts parsed["data"][0]["cheeseburger_id"]
๐ง Learn more about Ruby:
> https://www.ruby-lang.org/en/documentation/quickstart/
> https://www.rubyguides.com/ruby-tutorial/
๐ Python
A favorite of the data-science community.
Strengths
- Many libraries available
- Clean, concise, nicely formatted language
- Great for data science, a favorite in the community
- Long, mature history
Things To Consider
- Again, slower than something like Java. That might not matter, though.
- Tends to be memory hungry
Example of fetching from an API
import json
import urllib.request
# download raw json object
url = "https://cheeseburgerapi.com/api/burgers"
data = urllib.request.urlopen(url).read().decode()
# parse json object
obj = json.loads(data)
# print out the first cheeseburger
print(obj['data'][0]['cheeseburger_id'])
๐ง Learn more about Python:
> https://www.codecademy.com/learn/learn-python
> https://shop.learncodethehardway.org/access/buy/9/
๐ฟ Javascript / Node.js
Wait. What? We covered Javascript above...what the heck? Well, thanks to the rising popularity of Node.js, Javascript runs on the server, and it runs fast. Given that we covered Javascript a bit above, we'll focus on Node.js here specifically.
Strengths
- You may already know Javascript, so developers can easily become full-stack.
- Speed and performance (can handle lots of traffic).
- Large, active community.
- Potential for code reuse from front-end to back-end.
Things to consider
- Not good for heavy computational tasks (video editing, for example).
- One of the most popular frameworks, Express, requires you to bring many of your own components.
Example of fetching from an API
const fetch = require('node-fetch');
(async () => {
const response = await fetch('https://cheeseburgerapi.com/api/burgers');
const json = await response.json();
// print out the first burger
console.log(data[0].cheeseburger_id);
})();
๐ง Learn More about Node.js / Javascript
> https://nodejs.dev/learn
> https://learnnode.com/
โ๏ธ Java
On this list, Java is the grand-daddy of "enterprise-level" languages and is generally used at larger companies. Many Android apps are also written using Java.
Strengths
- Multi-threaded - meaning a program can perform many tasks at the same time.
- Strictly-Typed - makes it easier to find bugs and not shoot yourself in the foot.
- Simple, when compared to something like C++.
- Because of its age, the ecosystem is quite mature.
Things to consider
- Not the most terse of languages.
- For most modern web stuff, other languages are going to get you there quicker. Node or Ruby are all compelling things to look for before you reach for the Java hammer.
Example of fetching from an API
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.Scanner;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser;
public class MainGET {
public static void main(String[] args) {
URL url = new URL("https://cheeseburgerapi.com/api/burgers");
HttpURLConnection conn = (HttpURLConnection) url.openConnection();
conn.setRequestMethod("GET");
conn.connect();
String inline = "";
Scanner scanner = new Scanner(url.openStream());
//Write all the JSON data into a string using a scanner
while (scanner.hasNext()) {
inline += scanner.nextLine();
}
scanner.close();
// Using the JSON simple library parse the string into a json object
JSONParser parse = new JSONParser();
JSONObject data_obj = (JSONObject) parse.parse(inline);
// Get the required object from the above created object
JSONObject obj = (JSONObject) data_obj.getJSONArray("data");
System.out.println(obj.getJSONObject(0).get("cheeseburger_id"));
}
}
๐ง Learn More about Java
> https://www.udemy.com/course/java-programming-tutorial-for-beginners/
> https://www.codecademy.com/learn/learn-java
๐ PHP
PHP is the Nickelback of programming languages. It gets a lot of hate, but for some reason I can't seem to grasp, it's selling out a lot of arenas still.
PHP is behind the popular WordPress content management system, and even Facebook got its humble beginnings with PHP (although they've since built their own hyper-performant version of it)
Strengths
- Super-easy to get started
- Large developer community
Things to consider
- Not the best at handling huge numbers of requests with very complex logic.
- Maddening language inconsistencies
- Other languages are frankly more exciting (I'm quite biased)
Example of fetching from an API
<?php
//set burger api url
$url = "https://cheeseburgerapi.com/api/burgers";
//call api
$json = file_get_contents($url)
$json = json_decode($json);
$burger_id = $json->data[0]->burger_id;
echo $burger_id;
?>
๐ง Learn more about PHP:
> https://www.learn-php.org/
> https://www.codecademy.com/learn/learn-php
That's all we'll cover for now. Let's take a look at what makes a language fun in the real-world...some server-side frameworks...
More in this series
Can't stop, won't stop...
- Level 0: The Intro
- Level 1: HTML + CSS + Javascript - the 3 Amigos of the Web
- Level 2: Frontend Frameworks - Building blocks for your wildest dreams
- Level 3: APIs, REST, and GraphQL, Oh My!
- Level 4: ๐ YOU ARE HERE
- Level 5: Server-Side Frameworks - Trust me, you don't wanna write this crap from scratch.
- Level 6: Databases - Your Excel sheet in the sky.
- Level 7: How to internet - Domains & DNS, Hosting, The Cloudโข, & Serverless
- Level 8: Authentication and Authorization - House keys vs. giving your neighbors a temporary combination to your garage.
- Level 9: Content Management Systems - A fill-in-the-blank adventure!
- Level 10: Working With Engineers: Happiness, Agile, and Git
- Level 11: Working With Engineers: Time, Team Chemistry and Van Halen
- Level 12: Working With Engineers Tracer Bullets, Team Sizes, and Making Space.