Programming Theory

Best practices, structuring of code, dissecting algorithms and talking about the “Why?”

Structs vs Classes in C#

Many times on the forum people have asked about the differences between structs and their big brother "classes". How do the two differ and where are they the same? How do I know when I need one or the other and why don't I just use classes all the time? We will attempt to explore the differences from a basic introductory standpoint so that the beginner can understand. We will ...

Dijkstra’s Algorithm for C++

Who doesn't like graph theory? Come on... it is the foundation of all living beings! Ok maybe not but it is still a bit interesting from a theoretical standpoint. Graph theory is the study of graphs and their relationships between points on that graph and their overall collection. It is often made up of vertexes (aka nodes) and the connections between them known as edges. Linked together they form a ...

Speaking Mouse to Hunt Down a Popup Menu

The mouse is one of the most abused input devices on today's computers. Second to maybe the keyboard, it is essential for gathering input from the user. We tell it what to do but what if we stopped a second and had our application listen to it? I mean, REALLY listen to it and not just that listening you do when your favorite show is on TV and your girl ...

Lets Blow Bubbles in C++, the Bubble Sorting way!

Now dip the wand into the soap and take it back out, blow gently and voila! Your integer array is sorted! Wow, only if it was that easy huh? Well it can be with a simple straight forward demonstration of bubblesorting. In this entry I will attempt to quickly show you a simple bubblesort you can do at home and in your own projects. It may even help you pass ...

Amortization Definitive (C++, C#, Java, etc)

Amortization... it is the process of accounting for, and usually decreasing, an amount of money over a period of time. You can amortize a mortgage or various types of loans, and you can amortize assets based on their value and what their value will be in so many periods of time. Many newbies on our boards have asked about this very project as part of the computer science courses and ...

Kicking the BucketSort in C#

Ever hear the term "Kicking the bucket"? If not, it is usually used here in North America to mean someone died. Well rest assured I am not going to be whipping out expressions like "I see dead programmerssss" or anything in this post. Ok, maybe I just did, but the idea behind BucketSort (aka Bin sort) is just that, creating buckets of numbers which we attack with our choice of ...