-
Computing Concepts Part 1
Wednesday, December 23, 2020
Defining a Computer A computer is any digital device such as a smartphone, desktop PC, smart watch, game console that can be programmed to carry out a set of instructions. Notice that the definition contained the word digital. Undoubtedly, you’ve probably heard some devices described as digital and others as analog. Consider a scale that measures the weight of an object. A scale contains a needle that points to a number and this number is not the weight of the object, it’s a number that represents the weight.…more
-
Intro to C++ - Types
Friday, March 13, 2020
We’ll be investigating the primitive types C++ has to offer in this post and reference types in the following post. Integers The Integer type store whole numbers and come in four sizes: short int, int, long int, long long int. In addition, each type can be signed (negative whole numbers permitted) or unsigned (only positive numbers). A short is typically 2 bytes in size and an int is 4 bytes. A long is 4 bytes on everything except on 64-bit Linxu/macOS where it is 8 bytes.…more
-
Intro to C++ - Getting Started
Tuesday, March 10, 2020
To begin, we write human-redable C++ code in a source file which is then compiled to produce machine code that our computers can run. Here’s an example of a minimal source file: // main.cpp #include <cstdio> int main() { printf("Hello, World!"); return 0; } The above declares a function called main which serves as an entry point to our program, after all, the program has to stat somewhere. Within our main function we call another function printf which prints the text to the terminal.…more
-
Intro to Rust - Collections
Friday, March 6, 2020
Collections are data structures that contain multiple values. However, unlike arrays and tuples that are stored on the stack, these types are stored on the heap. Vectors Vectors are similar to arrays except they can grow dynamically. Like an array, it can only store a single data type. To a create a new vector, we write: let a: Vec<u32> = Vec::new(); The type annotation above is necessary as we’ve created an empty vector so Rust has nothing to infer from.…more
-
Intro to Machine Learning
Thursday, March 5, 2020
Machine learning is the field of study that gives a computer the ability to learn without being explicitly programmed. As an example, the spam filter from your email provider can learn and analyze what emails are being reported as spam and then apply that filter before the email even reaches you. If we were to program this manually, we might use regular expressions to search for certain keywords we provide in the email and feed each email that comes in through that algorithm.…more
-
C# Namespaces
Wednesday, March 4, 2020
In large programs or if you’re using third-party libraries, you’ll often encounter types with the same name as your own. In order to avoid such naming collisions, you can namespace your types. A namespace is simply a grouping of related code under a single name. In our previous articles on C#, you’ll notice we used: using System; Console.WriteLine("Hello"); However, this isn’t the fully qualified name for the WriteLine method. The full name is System.…more
-
Intro to Rust - Structs
Tuesday, March 3, 2020
A struct is a data type that allows you to group multiple related values under a single type. To define a struct in Rust, we use the struct keyword: struct Point { x: i32, y: i32, } And we create an instance of the struct like so: let p = Point{ x: 3, y: 4 }; And to access a field on the struct we use dot notation: println!("x: {}, y: {}", p.…more
-
Intro to Rust - Ownership
Monday, March 2, 2020
Every programming language has to have some way to manage the memory it consumes while the program is running. In higher level languages like JavaScript this is managed with a garbage collector or with lower level languages like C, the memory is allocated and freed manually. Rust uses a different approach with a concept known as ownership. Stack and Heap The stack and heap are parts of memory that your program can utilize at runtime.…more
-
C# Generics
Sunday, March 1, 2020
Imagine that you created a method that accepts an array of numbers and loops over them and writes the value at each index to the console. Now imagine you wanted similar functionality, but applied to an array of doubles, strings or booleans. Now, you can’t use your original method because it only accepts numbers so you have two alterntives: You could create a method that does the same thing for each type.…more
-
C# Interfaces
Thursday, February 27, 2020
An interface defines a contract that specifies what methods a class must implement in order to satisfy that contract. Any class that implements an interface is guaranteed to have those methods or the code will not compile. Creating an interface is similar to creating a class or a struct: public interface IFileReader { void Read(string filename); } As you probably notice, the interface does not implement the method, it only declares it.…more