You might think that Computer Science essentially comes down to programming concepts, data structures and algorithms, and to some extent that's kind of accurate. You can't really separate out the coding part from Computer Science in this day and age. But Computer Science stems back almost 100 years of history, even before programming languages existed, and as such they encompass many more principles than merely for loops and if-else statements.
As someone who spent years working on a degree in Computer Science, here are 3 fundamental concepts that you should pick up if you are interested in studying computation in any meaningful way.
Data structures
Data is really where everything begins. The entire purpose of a computer after all is to gather and to process data from various sources and to show that data to a user in some meaningful way. And this data has to be stored in some type of format digitally.
Welcome to data structures. Blueprints if you will for the way that data is stored. You might already be familiar with a few if you've ever worked with JavaScript arrays. An array is a type of data structure. One of the simplest and most useful ones. But there are others, and they each have their own use cases and functions.
Follow along as I break down some of the top most used data structures in Computer Science.
Stack - A stack (also known as a LIFO) is a collection of data that behaves, well, like a stack. That means that the last item that you added to the top of the stack is the first one to be picked (hence LIFO - Last In First Out).
Queue - Similar to a Stack, a Queue (also known as a FIFO) has the reversed priority.
Linked List - If you are going to be spending any time working with optimization, networking or just large datasets in general, then it might help to know how to implement Linked Lists in your day to day life. There's a good chance that the framework that you are using already has some kind of built in linked list data structure, but knowing how things are added, removed, traversed can be invaluable.
Multidimensional Arrays - We are talking 2D, 3D, 4D arrays here. Essentially matrices. While not the most common when working with web development directly, they do come into play depending on what it is that you are building.
In this day and age everything is data. And knowing how to store, sort and manipulate that data can make the difference as to whether you finish the job or not. This does not solely apply to just data scientists.
Algorithms
Technically speaking, any code that you write can be considered some form of an algorithm. And to take it further, anything that you do in your physical reality can be considered an algorithm as well. Eating lunch for example follows an underlying complex series of instructions in which hunger hormones are released at various times throughout the day signaling you to feast. But from a Computer Science perspective, there are a few algorithms that every programmer should know to some extent. Some of those would include:
- The Fibonacci sequence
- Sorting Algorithms
- Bubble sort
- Merge sort
- Searching Algorithms
- Binary search
To just name a few. And those mentioned are really just the more popular ones that you often see in university classrooms and in job interviews. There are much more scientific formulas that are being daily in different fields to solve grander worldly problems than simply finding an item in a list.
Take a standard Breadth-first search implementation as an example.
procedure BFS(G, root) is
2 let Q be a queue
3 label root as discovered
4 Q.enqueue(root)
5 while Q is not empty do
6 v := Q.dequeue()
7 if v is the goal then
8 return v
9 for all edges from v to w in G.adjacentEdges(v) do
10 if w is not labeled as discovered then
11 label w as discovered
12 Q.enqueue(w)
While you probably won't be using this to build your webpage, you might end up using if for example you are building on a search-engine.
But really more important than just memorizing someone else's algorithms is the ability to come up with your own. To be able to take a complex word-problem or specification and to implement the most efficient and functional code that you can. And working with algorithms like those mentioned above, is more of a practice than anything else.
Object Oriented Programming
Some would argue that OOP is an outdated concept and that it needs a rival to step in and to take its place. Because it is a fundamental component to most university degree programs regardless of where you are in the world, it will probably not lose any market share anytime soon though.
OOP essentially comes down to 3 main principles. The first being the ability to create Classes and Objects as data structures. Hence the name "Object" oriented. Everything is an object with properties and built methods. A car is an object with a make and a model. A student is an object with a name and age typically. Objects represent real-world things in digital key-value format essentially.
The second principle is inheritance in which one object can inherit properties from other base objects. As an example, you can think of the Car object from above. At a higher level, a Car is also a Vehicle. In fact, many other things are vehicles, such as boats and airplanes. And that means that they share similar properties, such as number of doors, manufacturer and so on. In this case, you could create a Vehicle class with all of these attributes, and any new Car object could inherit from this parent class.
And lastly, the 3rd principle of OOP is one that isn't talked about too frequently, but still important and still useful. And that is the concept of polymorphism. Think of polymorphism as the ability for many objects of the inheritance to implement their own versions of certain functions or methods.
As an example, working with the Vehicle, Car and Boat classes, each of those types can share a function called Drive() , that essentially drives the vehicle. But because they are different types of vehicles, each class can have its own code to do so.
car.drive()
boat.drive()
The implementation of this really depends on the programming language that you are working with as every language tends to have its own flavor of OOP logic.
While there is a ton more to Computer Science that I could have mentioned in this list, these 3 are the core really and fundamentally important before you take on more complex topics.
Expect more Computer Science articles in the future folks.