January 3rd, 2019
C++ First Impressions
C++ is a language I've always wanted to learn. So many modern languages are influenced by C++ and their designs are often predicated upon the strengths and weaknesses of C++. For example, I recently wrote about how interfaces and the lack of multiple inheritance in Java is due to C++.
C++ is a low level language closely related to the C programming language. Originally called "C with Classes," C++ added object oriented concepts on top of C1. In most cases C++ is still a true superset of C. One of the main design philosophies of C++ was to make it so low level that no language would be needed below it2. Because of this philosophy, C++ is commonly used for low-level tasks such as system programming. However, being low-level causes C++ to contain some complexities.
January 2nd, 2019
C# First Impressions
I was recently told that my next project at work would be a .NET application using C# in the backend. C# has been on my radar for a while now, since it supports wide ranging applications such as .NET apps and Xamarin. While C# supports multiple programming paradigms, its mostly used for object oriented programming. C# is commonly referred to as a descendant of Java and C++1, which is great for me since Java is my strongest language and I'm learning C++ in parallel with C#.
C# is statically typed with strict type rules (type coercion is rare)2. Programs in C# consist of executable and library files (with the .exe and .dll file extensions, respectively). C# is a compiled language, just like its ancestors C++ and Java.
September 17th, 2019
Using LINQ in C#
During free time at work, I've been reading a book called C# 7.0 In a Nutshell. When I get home, I write C# programs based on what I learned. One of the really interesting topics I read about was LINQ (Language Integrated Query), which is the integration of query functions and keywords in the C# language1. LINQ can be used to query remote data sources such as an RDBMS or local data structures.
LINQ reminds me of writing PL/SQL, which is a procedural language provided for the Oracle database. PL/SQL is a superset of SQL, allowing for looping, variable declarations, conditional logic, error handling, and more. The best feature of PL/SQL is the integration of SQL queries directly into an imperative programming language. Unfortunately, PL/SQL is strictly tied to the Oracle database and has clunky syntax in my opinion. LINQ on the other hand can be used with multiple different databases along with local data structures. Also, in my opinion, C# has much nicer syntax.
May 12th, 2019
Delegate Objects in C#
C# has an object called a delegate which is similar to lambda functions and functional interfaces in Java. A delegate object has a single role - calling a method. This article explores delegates and compares them to similar language constructs in C# and Java.
February 3rd, 2019
Variance with C# Generics
Variance amongst generics in programming languages is a topic that interests me. Generics in Java are always invariant, however C# isn't as restrictive, making it fun to explore. Since variance is an advanced topic, this article starts with the basic concepts of variance. Once the basics are understood, I'll explain variance in C# generics.
August 18th, 2019
Revisiting Type Equality
In this article I'm revisiting the concept of type equality. Type equality is a topic that software engineers learn early on in their careers. Similar to any other profession, it's beneficial to go back to the basics for practice. Professional basketball players practice layups before each game. Professional programmers should work at the basics as well. I spent this past week re-learning type equality in 13 different languages. In the process I've reaffirmed my knowledge and gained new insights. The rest of this article discusses my findings.
June 23rd, 2018
Working with Bit Fields
I was recently reading a book on Java and read through a chapter on how to use bit fields. Bit Fields are a data structure that I never really understood completely (along with most of the bitwise operators), so I figured I would take some time to look at Bit Fields in detail.
A data structure that consists of one or many memory locations (bits). Each of these bits has a unique meaning defined by the programmer1. It is common practice to use an unsigned integer data type of a specified length for a bit field. For example, in C you can define a bit field as
unsigned int bitField : 2. This bit field consists of two bits which can be turned on or off - each of which has a unique meaning defined by the programmer.
November 14th, 2017
Sorting Lists with Comparison Functions
November 10th, 2019
The Basics of Programming Language Garbage Collection
While reading a book on C#, I came across a section about garbage collection. I always knew that programming languages such as Java performed garbage collection, but I never researched how garbage collectors (GCs) worked. The book mentioned that C# uses a tracing GC with generations and marking. These were foreign concepts to me, so I decided to conduct additional research on the topic. This article gives a high-level overview of garbage collectors and the APIs available to interact with them in Java and C#.
September 30th, 2019
Integrated Queries with LINQ and SQL Server
My previous article explored LINQ, a module that brings query syntax to C#. All the examples in that article queried local data structures. While using LINQ on local data is valuable in itself, LINQ can do much more. LINQ really shines when used to query remote data sources. Queries on remote data sources such as relational databases are known as integrated queries. In this article, I explore integrated queries with a SQL Server database. First I create the SQL Server database instance with Docker and then query it using LINQ.
December 22nd, 2018
How Languages Enforce Multiple Inheritance
I recently read a book discussing multiple inheritance in Python. Python is one of the few object oriented languages that permits multiple inheritance of classes. Many other languages include workarounds for multiple inheritance. For example, Java allows for classes to implement multiple interfaces. On the other hand, PHP allows for classes to use multiple traits. This article looks at programming languages I use and how they enforce multiple inheritance or available workarounds.
January 19th, 2018
Swift 4 @objc Annotation
Today I upgraded my iOS app SaintsXCTF from Swift 3 to Swift 4. The process was extremely easy, with many of the automated conversions consisting of API changes and String struct upgrades. However there was one change that had me confused - many of my functions were given an
@objc annotation. So what is this mysterious annotation and why was it added to so many of my methods?
@objc annotation allows for functions to interact with Objective-C code1. Since many of Apple's APIs are built in Objective-C, a lot of my functions were actually interacting with non-Swift code without me even knowing! This communication between Swift and Objective-C is called Interoperability and it enables usage of Objective-C code in Swift and vice versa2.