Computer Science Fundamentals

32 videos clocking in at just over 6 hours. Get up to speed quickly with a video course based on The Imposter's Handbook.

Text lesson

Lesson 1:  Welcome!

I'm a self-taught coder and I've enjoyed learning things over my career... but I avoided binary and crypto like the plague! I just didn't need to understand that stuff to get my work done... at least I didn't think so. Let's just say I was wrong about that - so 3 years ago I dove in... and here we go!

Video lesson

Lesson 1:  Logical Foundations

Let’s jump right in at the only place we can: the very beginning, diving into the perfectly obvious and terribly argumentative 'rules of logic'.

Video lesson

Lesson 2:  The NULL Disaster

Logically-speaking, there is no such thing as Null, yet we’ve decided to represent it in our programs. Null is a crutch. It’s a placeholder for "I don’t know and didn’t want to think about it further" in our code and this is evidenced by it popping up at runtime, shouting at us exceptionally saying “ARE YOU THINKING ABOUT IT NOW?”. it's been described as a "billion dollar mistake"... let's see why.

Video lesson

You're George Boole, a self-taught mathematician and somewhat of a genius. You want to know what God's thinking so you decide to take Aristotle's ideas of logic and go 'above and beyond' to include mathematical proofs.

Video lesson

This is a famous interview question: 'write a routine that adds two positive integers and do it without using mathematic operators'. Turns out you can do this using binary!

Video lesson

We've covered how to add binary numbers together, but how do you subtract them? For that, you need a system for recognizing a number as negative and a few extra rules. Those rules are one's and two's complement.

Video lesson

Now that we know how to use binary to create switches and digitally represent information we need to ask the obvious question: 'is this worthwhile'? Are we improving things and if so, how much?

Video lesson

So far we've learned that we can use binary to represent information using just 1s and 0s, but it's useless unless we can share it with someone. In fact - the very definition of information required a sender and a receiver. But how do we do this with binary values? Let's learn the basics.

Video lesson

Encoding an alphabet for transmission can be ad-hoc, or we can spend a little time optimizing that encoding so our transmission can be sent more efficiently. This works well when there's no "noise" on the line - aka "chance for errors". One such algorithm is Huffman - which we'll learn now.

Video lesson

Optimizing our encoding scheme for a noiseless channel (one without transmission errors) is wonderful, but in the real world that just doesn't happen - anywhere. So we need to figure out a way to correct for errors and the good news is: this is math! There's always way.

Video lesson

We know that we can orchestrate bits in such a way as to 1) know when an error occurred and 2) locate the error if we have enough bits. But that's always the problem! We need more bits as our messages grow - but how do we orchestrate this? Once again, Richard Hamming comes to the rescue with his Hamming Code.

10 Lessons

Video lesson

Ciphers are simply algorithms designed to conceal information using a key of some kind. For decades it was thought that the stronger the cipher, the more secure your message. Over the centuries we've come to understand that the cipher doesn't matter at all - it's the key. Always the key.

Video lesson

The core of asymmetric encryption (something we'll get to shortly) is the idea of the one-way function. The definition is straightforward: it's nearly impossible to guess the input based on the output.

Video lesson

If you read up on cryptography you'll quickly come to understand that "there is no unbreakable cipher" - which is true for the most part. A better way to think of it is "there is no unbreakable cipher... except for the one-time pad". Another invention of Claude Shannon - let's write our own!

Video lesson

It's a hard-learned lesson throughout history: ciphers don't matter! You have to keep the key safe! This was true until the early 1970s, when Witfield Diffie had an amazing idea: let's use computers, one-way functions and some tricky math to solve this problem with public and private keys. One of the top scientific breakthroughs in history.

Video lesson

Ron Rivest, Adi Shamir and Len Adelman leveraged the idea of a public and private key and came up with the RSA encryption algorithm - the most downloaded software in existence. You're using this algorithm to watch this video over HTTPS. You use it when you SSH into a private server as well. Brilliant, elegant and brutally simple - we're going to write this algorithm ourselves to understand how it works.

Video lesson

Sometimes you don't want to decrypt something you've encrypted but, instead, have a unique "signature" of its binary value. That's what a hash code is - and they're everywhere. Let's see how they're made.

Video lesson

The only way to know if a hashing algorithm is good is to see ways to break it. You can't decrypt a hash, but you can do things messed up things like pre-imaging every value you can think of to see if you get a match. Let's take a look at how hackers can go nuts with your secret data.

Video lesson

This is a video that I made for my YouTube channel but I think it fits perfectly here too! If you’ve had to store sensitive user information in a database, you’ve probably heeded the advice to “just use bcrypt”. But do you know why? What other choices are there? In this video we take a deep look at bcrypt, pbkdf2, scrypt and argon2!

Video lesson

Hashing algorithms aren't just for passwords - they are mostly used to uniquely identify things like files, string values and Git commits. This only works if a hashing algorithm produces a unique value *always*. If it doesn't, there's a collision.

Video lesson

It's not a bad idea - it's just that bad things have been done with it! No matter your opinion on Blockchain stuff - it's a good idea to know what you love/hate and how it works. Blockchains are basically Git repositories that store transactions. It's obviously more complicated - so let's build our own, shall we?

Video lesson

This is a video I did for my YouTube channel but, hopefully, encapsulates what you need to know. We'll be discussing Big-O throughout these videos so it pays to understand it up front.

Video lesson

The building block data structures from which so many others are built. Arrays are incredibly simple - but how much do you know about them? Can you build a linked list from scratch?

Video lesson

You can build all kinds of things using the flexibility of a linked list. In this video we'll get to know a few of the more common data structures that you use every day.

Video lesson

The bread and butter of technical interview questions. If you're going for a job at Google, Microsoft, Amazon or Facebook - you can be almost guaranteed to be asked a question that used a binary tree of some kind.

Video lesson

You will likely *never* need to implement a sorting algorithm - but understanding how they work could come in handy at some point. Interviews and workarounds for framework problems come to mind.

Video lesson

You now know all about trees and graphs - but how do you use them? With search and traversal algorithms (depth-first and breadth-first) of course! This is the next part you'll need to know when you're asked a traversal question in an interview. And you will be.

Video lesson

No, we're not talking about dynamic languages like Ruby or Python! Dynamic programming is an approach to writing algorithms. It gives us a way to elegantly create routines for various problems and can greatly improve the way you solve problems in your daily work. It can also help you ace an interview.

Video lesson

The use of prime numbers is everywhere in computer science... in fact you're using them right now to connect to this website, read your email and send text messages. This algorithm might not be a "core" CS algorithm - it does show you how you can solve a problem using a "sieve" approach.

Video lesson

How can you traverse a graph ensuring you take the route with the lowest cost? The Bellman-Ford algorithm will answer this question.

Video lesson

Bellman-Ford works well but it takes too long and your graph can't have cycles. Dijkstra solved this problem with an elegant solution.

Video lesson

Lesson 1:  Constructor

Most OO languages have a built-in way of creating an in- stance of a class and it typically involves the keyword new. I will assume you know how this works if you’ve written code.

Video lesson

Lesson 2:  Factory

Sometimes instantiating an object can be quite involved, and might require a little more clarity. This is where the Factory Pattern comes in.

Video lesson

Premium Builder

The Factory pattern can only do so much until it becomes too convoluted. This usually happens with very complex objects. Many developers consider this a “code smell” (when you find yourself needing it, it means there’s a simpler way). Overly complex objects are ripe for bugs and, typically, means you’ve probably over-thought your solution.

Video lesson

Instead of calling stringList.Add("...") or using a String- Builder directly, you can encapsulate what you’re doing into a class that uses a fluent interface, otherwise known as Method Chaining.

Video lesson

Lesson 5:  Singleton

A Singleton is a class that only allows one instance of itself. It’s not an easy thing to do correctly and many blog posts have been written about the perils of Singletons and threading or multiple processes.

Video lesson

Lesson 1:  Adapter

The Adapter Pattern is all about making one interface work with another. You see them used often with data ac- cess tools (ORMs) where the abstracted query interface needs to work against different databases, such as PostgreSQL, SQL Server, etc.

Video lesson

Premium Bridge

The Bridge Pattern is quite subtle and tends to look a lot like the Adapter Pattern, but it’s one step up the abstraction curve. You use the Bridge Pattern when your abstraction gets complicated enough that you need to split things out.

Video lesson

Premium Composite

The Composite Pattern deals with parent-child relationships that are composed to create a whole object. They can grow and shrink dynamically, and child objects can move between parents.

Video lesson

Premium Decorator

The Decorator Pattern adds behavior to an object at run time. You can think of it as “dynamic composition”.

Video lesson

Premium Facade

A Facade hides implementation details so clients don’t have to think about it.

Video lesson

Premium Flyweight

In the initial versions of GroovyQuery we decided it would be very useful to introspect our database whenever a write needed to happen (insert or update query). We did this be- cause knowing more about each table (data types, primary key fields, column names, and default values) would be extremely helpful in crafting up a very usable API.

Text lesson

Some people love it and claim it’s the only way to write software. Others see it as a fad and roll their eyes. Let’s come away from those extremes. Functional Programming is based on a foundational computational model called Lambda Calculus, which all programming languages (OO or FP) are based on . It’s not magical, nor is it something you should ignore because you’re amazing. It is simply something you need to understand.

Video lesson

Lesson 2:  Immutability

The first word that comes to mind whenever you hear “functional programming” is usually “immutable”. As I am sure you know, it means “not changeable” in plain English, but how does that translate to programming? Moreover: who cares?

Video lesson

Premium Idioms

Let's take a look, at a high level, of common structures and idioms that most functional languages share.

Video lesson

It takes a while to get into the functional groove and if you're new to FP then you might be wondering why all of this matters to any one! You're about to find out because everything we do in FP is all about transforming data.

Video lesson

Let’s compare and contrast a functional style vs. an OO style, and I’ll do that by creating a ShoppingCart in Elixir and also in JavaScript.

Video lesson

There are two terms that you often hear in discussions about functional programming: purity and side effects. Both terms stem from the idea of immutability. The whole notion of interacting with a system outside the scope of the function you’re in is called a “side effect” - something that happens as a result of your function being invoked. Working with a database, for instance, is referred to as a “necessary side effect” because you’re changing the state of something outside the scope of your function.

Video lesson

Premium Currying

Functions, functions, functions. They’re everywhere! Organizing a program full of them can feel overwhelming, especially when you’re just starting out with functional programming. Let’s look at one of the very first practices you’ll want to take advantage of: currying. Currying is the act of using smaller, single arity functions in a chain rather than a larger function with multiple/complex arguments.

Video lesson

Well here we go - let's see if we can tackle this extremely difficult subject in a simple, human way! By now you're hopefully seeing that we can wrap data with a little more structure as we push it through a transformation... and off we go...

Video lesson

We’ve decided to implement validations for our User and must orchestrate a bit of an approval chain. We can use the Chain of Responsibility Pattern for this, which is focused on moving data through a set of handlers. There is a better way! Moving objects through a process chain can be subject to many high-level patterns that are, frankly, much better than this one. I’m showing you this example because you should know the pattern – but when it comes to validations there are better ways to do this.

Video lesson

Premium Command

The Command Pattern formalizes requests from one API to the next. Our data access tool, GroovyQuery, is all about writing and reading data from the database. It does this by creating SQL statements that our adapter then executes. We could do this by passing in a SQL string and a list of parameters – or we could formalize it into a command.

Video lesson

Premium Mediator

We want to formalize our document storage capabilities, however adding methods and abstractions to our GroovyQuery will make the API more complex, which goes against some programming principles we’ll discuss in a later chapter. In short: simplicity is our goal. We want our class abstractions to do one thing and to do it well.

Video lesson

Premium Observer

The Observer Pattern facilitates event-based programming. You use this pattern whenever you wire up events in a language like C# or JavaScript (using the EventEmitter in Node or listening to DOM events in the browser). Many frameworks have the mechanics for observation al- ready built in, but let’s look at how we can construct an ob- server by hand by adding methods to our GroovyQuery that get fired when certain events occur. These are commonly referred to as callbacks

Video lesson

Premium State

The State Pattern changes an object’s behavior based on some internal state. Often this is done by creating formalized state classes. You often hear an implementation of this pattern called a “State Machine”, which is a fascinatingly complex way of handling process flow.

Video lesson

Premium Strategy

The Strategy Pattern is a way to encapsulate “doing a thing” and applying that thing as needed. Code is the easiest way to explain this pattern, as it’s quite simple and useful. Our document query capability is working well, but it turns out that SQL Server has excellent support for XML, and some users have asked that we support that along with JSON storage. We can do this using the Strategy Pattern.

Text lesson

Many of you will likely notice that I left a few patterns out of the above list – namely the Visitor Pattern, Memento, Template, etc. These are useful patterns to know about, but their use is rare. Now that you know the theory behind the Gang of Four patterns - let's get into when they're actually useful.

Video lesson

You’ve likely heard these terms before, they’re thrown around a lot and have straightforward definitions. Cohesion applies to how well you’ve thought out the concepts (and concerns, for that matter) of your application. Coupling is the opposite of cohesion. When you couple two or more things, their separate notion becomes one. You want high cohesion, low coupling. Your classes and modules should make sense for isolating ideas, and not rely on each other to exist. This is the goal, at least.

Text lesson

Separation of Concerns is about slicing up aspects of your application, so they don’t overlap. These are typically thought of (by developers) as horizontal concerns (they apply to the application as a whole): such as user interface, database, and business logic. The term can equally (and confusingly) be applied to more abstract ideas, such as authentication, logging and cryptography. Finally, there are vertical concerns, which deal with more business-focused functionality such as Content Management, Reporting, and Membership.

Text lesson

Premium YAGNI and DRY

I remember when I started learning Ruby. I loved the simplicity of the language as well as its dynamic design which, I know, many people dislike. You had to have some rigor and much care when building programs with Ruby because you didn’t have a compiler and static type checking. This was freeing, and it was also a little scary.

Video lesson

Another Rubyism that I quite like came from Ruby’s inspiration: Smalltalk. Whenever you invoke a method on a Ruby class you send it a message. You tell that instance that you need it to do something, or that you need some data back of some kind.

Video lesson

The Law of Demeter (LoD, or “Deep Dotting”) is an off- shoot of loose coupling. In short: you shouldn’t have to “reach through” one object to get to another. This can be further nuanced to mean you shouldn’t have to reach deeply into one object to do the thing you need to do.

Video lesson

One way to loosen up your code is to send in the dependencies that a class needs through its constructor. The best way to see this is with some code.

Video lesson

Premium SOLID

In object-oriented programming circles it’s almost impossible to escape Martin/Feathers/Meyer's SOLID principles. I have some opinions on the matter which I'll share with you as well.

Video lesson

I am, strictly speaking, not a practitioner of Test-driven Design (TDD) or Behavior-driven Design (BDD). I know what these things are and I feel why they are useful. I also know that people like to argue about what they think it is and what they think it is not.

Video lesson

Behavior-driven Development (BDD) is basically the same process as TDD, but you have a specific focus: behavior of the application. It’s a subtle shift, but an important one.

Video lesson

They're ugly, look intimidating, and are probably the most valuable assets any programmer has at their disposal: shell scripts! All it takes is a few hours to get comfortable with them and you'll never program the same way again!

Video lesson

I use the static site generator Jekyll to write my blog. I store the site at Github, who then translates and hosts it all for me for free. Jekyll is simple to use and I like it a lot. There's only one problem: it's a bit manual.

Video lesson

I use the static site generator Jekyll to write my blog. I store the site at Github, who then translates and hosts it all for me for free. Jekyll is simple to use and I like it a lot. There's only one problem: it's a bit manual.

Video lesson

Make is a build utility that works with a file called a Makefile and basic shell scripts. It can be used to orchestrate the output of any project that requires a build phase. It's part of Linux and it's easy to use.

Text lesson

No video with this one - just a post with lots of code. Make has been around forever and is often overlooked in favor of tools that recreate precisely what it does, but in crappier ways. Let's see how you can use Make to help your testing process.

Text lesson

Of all the things you learn as you go on in your programming life - the foundational patterns, principles and concepts are going to be the main thing you come back to time and time again. Good luck!

Pen
>