4 Pillars of Object Oriented Programming

Abstraction is a process of exposing essential feature of an entity while hiding other irrelevant detail. Why would you want to use abstraction? abstraction reduces code complexity and at the same time it makes your aesthetically pleasant.

We have to take in consideration that Encapsulation is somehow related to Data Hiding.
Encapsulation is when you hide your modules internal data and all other implementation details/mechanism from other modules. it is also a way of restricting access to certain properties or component. Remember, Encapsulation is not data hiding, but Encapsulation leads to data hiding

The ability of creating a new class from an existing class. Like the word Inheritance literally means it is a practice of passing on property, titles, debts, rights and obligations upon the death of an individual. in OOP this is somehow true(Except the death of an individual) ,where The base class(the existing class sometimes called as the Parent class) has properties and methods that will be inherited by the sub class (sometimes called a subtype or child class) and it can have additional properties or methods.

Inheritance is also a way to use code of an existing objects.

4. Polymorphism
Just like in biology, Polymorphism refers to the ability to take into different forms or stages.A subclass can define its own unique behaviour and still share the same functionalities or behavior of its parent/base class.Yes, you got it right, subclass can have their own behavior and share some behaviour from its parent class BUT!! not vice versa. A parent class cannot have the behaviour of its subclass.

What are Stacks and Bubble Sorts

Stacks are a type of list in which all inserts and removals happen at one end

class stack
    stack(void);                // Constructor and Initializer

    bool push(int data);        // Push onto stack
    bool pop(int data);         // Pop from stack
    int  peek(int depth);       // Peek several layers down

    const int MAX_SIZE;         // Maximum stack size
    int   stack_data[MAX_SIZE]; // Stack Data Array
    int   stack_top;            // Keeps track of Stack Top


// By convention, 'n' is usually the size of the
// array to be sorted.
void bubblesort( int array[], int n )
  for ( int i = 0; i < n-1; ++i )
    for ( int j = 1; j < n-i; ++j )
      if ( array[j-1] > array[j] )
        // Note the use here of swap()
        swap( array[j-1], array[j] );

Top New Game Engine List

Game development is becoming a huge money making industry. Game developers have countless tools, engines, and platforms to develop with. Here is a list of popular game development platforms and engines. Some can be used with almost little coding knowledge while others will require an advanced understanding of languages like C#, Javascript, HTML5 etc.

So get learning, you could easily with a few months of work develop the next big iPhone, Android, Xbox, or PlayStation game!


Cocos 2D-X

Develop: Mobile Application Games
OSX / Windows
Cocos2D-X is an open source cross-platform game framework written in C++ / Javascript / Lua. It can be used to build games, apps and other interactive programs. There are some independent editors in the cocos2d community, such as those contributing in the areas of SpriteSheet editing, particle editing, font editing and Tilemap editing as well as world editors including SpriteBuilder and CocoStudio. Games include Angry Bird Fight, Clash of Kings, and Brave Frontier.


Compile Games

Develop: Platform / 2D Games / Mobile Applications
Windows / Ubuntu / Linux / OSX / iOS/Android
GDevelop is an open source, cross-platform game creator designed to be used by everyone – no programming skills required.



Develop: 3D Games
Environments: Windows / OSX / Linux
Torque has been around for a while, and used for everything from driving simulators to MMOs to interactive coral reefs. Under the permissive MIT open-source license, you can do what you want with the source code. Some notable games include; Frozen Cortex, Tower Wars, and Airship Dragoon.



Develop: Real-Time Strategy Games
Environments: Windows / OSX / Debain / Ubuntu / Fedora / Linux / Others
OpenRA recreates and modernizes the classic Command & Conquer real time strategy games. It’s a flexible open source game engine that provides a common platform for reimagining classic 2D and 2.5D real-time strategy games. Native support for modern operating systems and screen resolutions and also integrates online multiplayer functionality.



Develop: Real-Time Strategy Games
Environments: Windows / OSX
Openage is a volunteer project to create a free engine clone of Age of Empires II, primarily aimed at POSIX platforms such as GNU/Linux, comparable in its goals to projects like OpenMW, OpenRA, OpenTTD and OpenRCT2. Openage uses the original game assets (such as sounds and graphics), but (for obvious reasons) doesn’t ship them. To play, you require an original AoE II : TC installation or AoE II: HD (installation via Wine or Steam-Linux).


Unity 3D

Develop: 2D / 3D Games
Environments: Windows / OSX / Linux
Unity is a cross-platform game engine developed by Unity Technologies and used to develop video games for PC, consoles, mobile devices and websites. First announced only for OS X, at Apple’s Worldwide Developers Conference in 2005, it has since been extended to target 27 platforms.


Atomic Engine

Develop: 2D / 3D Games
Environments: Windows / OSX / Linux
The Atomic Game Engine is powerful 2D/3D technology developed by industry veterans and contributors from around the world. It is lean, full source, technology for mobile and desktop. It has a powerful core API with access to raw, down to the metal, native performance.



Develop: Web-Based Games
Environments: Windows
Construct is an HTML5-based 2D game editor. It is aimed primarily at non-programmers, allowing quick creation of games in a drag-and-drop fashion using a visual editor and a behavior-based logic system.


GameMaker Studio

Develop: 2D / 3D Games
Environments: Windows / OSX
With a drag-and-drop development environment, GameMaker eliminates the barrier most people face when starting out in game development. Using the built-in GML language, you learn to program as you go and not jump in at the deep end of coding. A single development workflow allows you export your game directly to Windows, Mac OS X, Ubuntu, Android, iOS, and HTML5. Bring your games to life with 2D physics, create a thriving player base with cross-platform network play, and create stunning visual effects using shaders.



Develop: Web-Based Games
Environments: Browser
Gameblox is a game editor that uses a blocks based programming language to allow anyone to make games. It’s free and no downloads are required. You can make games online that you can play both on this site and on your mobile device.


Develop: 2D / 3D Games
Environments: Windows / OSX / Linux
By leveraging C# and other .NET languages on Microsoft and Mono platforms you can write modern, fast, and reliable game code. Currently supports iOS, Android, MacOS, Linux, all Windows platforms, OUYA, PS4, PSVita, and Xbox One. Over 1,000 shipped games Mono has built up a vibrant community of developers.



Develop: Story Lines Games
Environments: Windows / OSX / Linux
Twine is an open-source tool for telling interactive, nonlinear stories, such as which way games. You can utilize graphics and sounds for developing simple yet fun story games.

Creating Hashtables in C#

Creating a Hashtable Object with the Hashtable Class in C#

The hashtable class in C# is used to create a hash table. The syntax to create a new hash table is:

public Hashtable name_of_hashtable = new Hashtable ();

When you create a new hashtable, it is empty. Let’s create a hashtable called hashtableexample and place three integer keys inside it:

using System.Collections;
using System;
class Example
    static void Main()
                Hashtable hashtableexample = new Hashtable();
                hashtableexample[1] = "One";
                hashtableexample[3] = "Three";
                hashtableexample[29] = "Twenty-Nine";
                foreach (DictionaryEntry entry in hashtableexample)
                    Console.WriteLine("{0} : {1}", entry.Key, entry.Value);
29: Twenty-Nine
3: Three
1: One

In this program, we have created a class called Example to hold the hashtable named hashtableexample. We added three integer keys to that hashtable, with different entry key numbers and values. The integer keys we added belong to the DictionaryEntry type, which contains keys and their corresponding values. We added three keys with different key entries and values. In the final part of the program, we printed the keys with the corresponding values to the screen using the foreach loop.

It’ll be easier to learn the language as a whole instead of bits and pieces, so we recommend you check out this advanced course in C# to learn more about hashtables.

Adding Entries to a Hash Table

Now that we know how to add keys to a hash table, let’s see how to add entries to it. The syntax to add an item to a hashtable object is:

name_of_hashtable.Add(Parameter 1 (Data), Parameter 2 (Data))

You’d understand the syntax better with an example program. We’ll write a simple hashtable that contains the name of three authors and the number of books they’ve sold recently:

using System.Collections;
using System;
class Example
    static void main()
                // Creating a simple hashtable called hashtableexample.
                Hashtable hashtableexample = new Hashtable();
                hashtableexample.Add("JKRownling", 5000);
                hashtableexample.Add("JArcher", 3000);
                hashtableexample.Add("AChristie", 1000);

We created a simple hashtable with three entries inside it. As you can see, we used string values as well as integer values. Both your entries could have contained string or integer values. You can try writing the hashtable to the screen to see what it looks like (using the foreach loop, as we showed you earlier).

Hashtable Methods

There are several methods that you can use with the hashtable class. The Add method, for example, adds an entry to the hashtable class (like in the program above), the Clear method can be used to wipe the hashtable clean, the Clone method creates a copy (shallow) of your hashtable and the GetHash method returns the hashcode for a specific key. You will need to get familiar with most of the hashtable methods if you’re going to get a good grasp on hashtables and handle them properly. You can check out the different methods in the official documentation on the Microsoft Office website. Learn more about these methods in detail with this C# course.

We’ll write a simple program that demonstrates the use of the Contains method to help you understand the concept better. We’ll just extend the program we wrote earlier:

using System.Collections;
using System;
class Example
static Hashtable GetHashtable()
                // Creating a simple hashtable called hashtableexample.
                Hashtable hashtableexample = new Hashtable();
                hashtableexample.Add("JKRowling", 5000);
                hashtableexample.Add("JArcher", 3000);
                hashtableexample.Add("AChristie", 1000);
                return hashtableexample;
static void Main ()
Hashtable hashtableexample = GetHashtable ();
Console.WriteLine(hashtableexample.Contains (“JKRowling”));

The Contains method checks the hash table to see if a specific key is present. If it is, it will return a true value. If not, it returns a false value. We created a simple hash table called hashtableexample and then returned its value. We then checked to see if any of the keys in the hash table match “JKRowling” with the Contains method.

C# also has a newer, much more efficient class called the Dictionary collection which is quite similar in functionality. If you’re going to operate or maintain one of those programs for a company, you need to know about the hashtable class. The .NET framework makes C# sharp portable and platform independent, just like Java.  There is a growing demand for C# programmers in the industry and a shortage of good programmers. You may want to explore C# programming as a career option. This three part course gets into the details of C#(Part I, Part II, Part III) – from the basics to the advanced concepts – to help you along your journey.

Star Wars Javascript Game

I wanted to see if I could create a simple game example using numerical randomized values and using Javascript one page coding. I will probably expand the gameplay of this game in the future but here is the initial coding for a Star Wars game.

Here is a link to the game: https://sethmh82.github.io/week-4-game/index.html
Here is a link to the GitHub source code: https://github.com/sethmh82/week-4-game

 var myHealth = 100,
    enemy1Health = 100,
    enemiesKilled = 0,
    attackPower1 = 1,
    attacking = 0,
    enemyLoaded = 0,
    enemy1dead = 0,
    enemy2dead = 0,
    enemy3dead = 0;

    function isGameOver(){
      if (enemiesKilled === 4) {
      $("#you-won").html("<h1>YOU WIN</h1><br><h2>You defeated all enemies</h2>");
      document.getElementById("you-won").style.background = "#f4af0a";
      document.getElementById("you-won").style.padding = "30px";
      document.getElementById("enemy-image").style.display = "none";

    function iAmAttacking() {
          if (enemyLoaded === 0) {
          } else {
                var myAttack = attackPower1;
                enemy1Health = (enemy1Health - myAttack);
                document.getElementById("healthBar").style.width = (enemy1Health + "%");
                      if (enemy1Health <= 0) {
                            document.getElementById("healthBar").style.width = "0%";
                            $("#enemy-image").html("<img class='enemypic' src='assets/images/explode.gif'>"); 
                            $("#kills").html(enemiesKilled + " /4");
                           document.getElementById("bottom-col").style.opacity = "100"; 
                            enemyLoaded = 0;
                            enemy1dead = 1;
                      } else {

    function enemyIsAttacking() {
        if (attacking === 1) {
        var enemyAttack = Math.floor(Math.random()*10);
        if (attacking === 2) {
        var enemyAttack = Math.floor(Math.random()*18);
        if (attacking === 3) {
        var enemyAttack = Math.floor(Math.random()*7);
        if (attacking === 4) {
        var enemyAttack = Math.floor(Math.random()*4);

          myHealth = (myHealth - enemyAttack);
              if (myHealth <= 0) {
              document.getElementById("myHealthBar").style.width = ("0%");
              $("#you-won").html("<h1>YOU LOST</h1><br><h2>You were defeated by the enemy</h2>");
              document.getElementById("my-attack").style.display = "none";
              document.getElementById("power1").style.display = "none";
              document.getElementById("you-won").style.background = "red";
              document.getElementById("you-won").style.padding = "30px";
              document.getElementById("enemy-image").style.display = "none";
              } else {
              document.getElementById("myHealthBar").style.width = (myHealth + "%");

        $("#power1").on("click", function() {

        $("#reset").on("click", function() {


        //PROBE DROID
        $("#enemy1").on("click", function() {
          document.getElementById("enemy1").style.opacity = "0";
          document.getElementById("bottom-col").style.opacity = "0";  
          attacking = 1;
          enemyLoaded = 1;
          enemy1Health = 100;
        $("#enemy-image").html("<img class='enemypic' src='assets/images/probe.gif'>");
        document.getElementById("healthBar").style.width = "100%";
        $("#enemy2").on("click", function() {
         document.getElementById("enemy2").style.opacity = "0";
         document.getElementById("bottom-col").style.opacity = "0"; 
          attacking = 2;
          enemyLoaded = 1;
          enemy1Health = 100;
        $("#enemy-image").html("<img class='enemypic' src='assets/images/stormtrooper.gif'>");
        document.getElementById("healthBar").style.width = "100%";
        //AT-ST WALKER
        $("#enemy3").on("click", function() {
         document.getElementById("enemy3").style.opacity = "0";
         document.getElementById("bottom-col").style.opacity = "0"; 
          attacking = 3;
          enemyLoaded = 1;
          enemy1Health = 100;
        $("#enemy-image").html("<img class='enemypic' src='assets/images/at-st.gif'>");
        $("#enemy-name").html("<b>AT-ST Walker</b>");
        document.getElementById("healthBar").style.width = "100%";
        //BOBA FETT
        $("#enemy4").on("click", function() {
          document.getElementById("enemy4").style.opacity = "0";
          document.getElementById("bottom-col").style.opacity = "0"; 
          attacking = 4;
          enemyLoaded = 1;
          enemy1Health = 100;
        $("#enemy-image").html("<img class='enemypic' src='assets/images/boba-fett.gif'>");
        $("#enemy-name").html("<b>Boba Fett</b>");
        document.getElementById("healthBar").style.width = "100%";

Currency Convertor Using Math.js Javascript Library and Fixer.io

For this currency convertor to work we have to link the math.js Javascript library and pull the current currency conversion rates from fixer.io.

Using a text inbox you can generate almost and string of currency values. I have the decimal place set to 2 but you can change that to be more or less by changing the precision value in this line:

 var resultStr = math.format(math.eval(expr.value), {notation: 'fixed', precision: 2})
<!DOCTYPE html>
  <title>Currency Conversion</title>

  <script src="http://cdnjs.cloudflare.com/ajax/libs/mathjs/3.11.5/math.min.js"></script>

    input {
      font-size: 11pt;
      font-family: Gotham, Verdana, Arial, Sans-Serif;
      color: #4d4d4d;
      max-width: 600px;

    h1 {
      font-size: 120%;

    input {
      padding: 5px;
      width: 400px;
    .lbl {
      font-size: 13px;

<p id="info">
  fetching currencies...
  <label class="lbl" for="expr">Enter an expression with currencies:</label><br>
  <label class="lbl" for="expr">EXAMPLE: 25 GBP + 5 EUR + 25 AUD in USD</label><br>
  <label class="lbl" for="expr">The above expression adds 25 British Pounds with 5 Euros and 25 Australian Dollars and outputs the amount in US Dollars.</label>
<div id="form" style="display: none;">
    <input id="expr" value="25 GBP + 5 EUR + 25 AUD in USD" /><br/>
  <p id="result"></p>

      .then(function (currencies) {
        document.getElementById('expr').oninput = evaluate;
        document.getElementById('form').style.display = '';
        document.getElementById('info').innerHTML = 'Available currencies: ' + currencies.join(', ');


  function fetchAndImportCurrencies () {
    // this calls for the actuall currency conversion rates from fixer.io
    return fetch('https://api.fixer.io/latest')
        .then(function (response) {
          return response.json();
        }).then(function (data) {

          // import the currencies
          Object.keys(data.rates).forEach(function (currency) {
            math.createUnit(currency, math.unit(1 / data.rates[currency], data.base));

          // return an array with all available currencies
          return Object.keys(data.rates).concat(data.base);

  function evaluate () {
    var expr = document.getElementById('expr');
    var result = document.getElementById('result');

    try {
// precision: 2 gives 2 decimal places.  
      var resultStr = math.format(math.eval(expr.value), {notation: 'fixed', precision: 2})
      result.innerHTML = '<span style="color: dodgerblue;">' + resultStr + '</span>';
    catch (err) {
      result.innerHTML = '<span style="color: red;">' + err.toString() + '</span>';

Setup a MacBook Java Development Environment

As we’ve become more mobile it’s important to enable our travel work stations to handle a multitude of development environments. Most developers will want to setup a Java SE development kit on their laptop. This is a step-by-step walkthrough outlining the elements necessary to develop Java applications on your iMac, MacBook, or any OS X device.

Step 1 : Install Java Development Kit (JDK)

Java SE Development Kit 8
Download the MAC OS X installation file jdk-Bu121-macosx-x64.dmg (233 MB).

java development kit installation

Step 2 : Setup JAVA_HOME Environment Variable

If you’ve never setup a bash profile open up Terminal and enter:
cd ~/

This will take you to the root directory. Then type:
touch .bash_profile to create the new file.

I personally prefer to edit files in Terminal using Vim editor:
vim .bash_profile

When the editor opens, the file should be blank. Press V then I to activate editing and copy and paste the following line into the file:
export JAVA_HOME=$(/usr/libexec/java_home)

To exit the editor and save the document press ESC and then type a colon : ( shift + : ) which will bring up a colon : at the bottom of the file. Now type in wq! and hit ENTER. This will save the .bash_profile file with your new JAVA_HOME entry.

Lastly, type:
. .bash_profile
This will reload .bash_profile and update the function we just added.

To check our work type in:
source .bash_profile
This should display:

You can skip all of step 3 by installing Homebrew.
I recommend installing it as you will need it down the road to install other environments.
To install Homebrew via SSH type the following line into terminal:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Now that you have Homebrew installed you can install Apache Maven:
brew install maven

Check you have Maven installed by entering:
mvn -version

Now you can skip Step 3A and go to Step 3B.

Step 3A : Install Apache Maven

Go to Apache’s Website here: Apache Maven

Then download the source zip archive file apache-maven=3.5.-src.zip found halfway down the page:
Apache Maven Install File

Step 3B : Setup Maven Symbolic Link

I recommend making a symbolic link to the Maven installation folder inside of an opt folder by entering the following:
First create the folder name “opt”
mkdir opt
Enter the opt folder:
cd opt
Create a folder named “maven”
mkdir maven
Now go back one folder:
cd ..
Lastly, make a symbolic link inside the maven folder by typing the following:
ln -s ~/apache-maven-3.5.0 ~/opt/maven

Then we will go into our .bach_profile file:
vim ~/.bash_profile

Add the following 3 lines into the file (after our previously added JAVA_HOME line).

export M2_HOME=/path/to/maven
export M2=$M2_HOME/bin
export PATH=$M2:$PATH

Remember to close the file using wq! to save changes.

Now type:
. .bash_profile
To initialize those changes.

Step 4 : Install GCC and GIT

There are a couple different ways to install Git and the GNU Compiler Collection GCC.
The easiest is to install Homebrew

brew install gcc
brew install git

Grab a brew because this is gonna take some time to install.

Step 5 : Install IntelliJ IDEA

A Java IDE (Integrated Development Environment) is a software application which enables you to easily write and debug Java programs. IntelliJ provides features like syntax highlighting and code completion. Some popular ones include Eclipse, NetBeans, ItelliJ IDEA, JDeveloper and Android Studio.

I’m going to have you install IntelliJ IDEA (418 MB) from their download page

After the zip file has downloaded, unzip it and drag the IntelliJ_IDEA_CE.app file into your Application folder.

You are now technically done! Launch IntelliJ and start developing the next big application.

Here are some extras you can install to add more features to your JAVA development environment.

NodeJS – Download Page
I’m brave so I installed the latest version 7.9.0 but you can choose to install the most stable version 6.10.2 if you feel that suits you better. The difference between the stable and latest version is you may experience issues with the latest version that are due to its current code.

Linked List Example

Here is the code structure for the linked list:

class linked_list {
    linked_list(void);     // Constructor
    ~linked_list(void);    // Destructor

    void print(void);      // Prints Entire List
    void insert(int item); // Insert Function
    void remove(int item); // Remove Function
    bool search(int item); // Search Function
    linkedNode *first;     // Pointer to first node

class linkedNode {
    int data;            // Data held by this node
    linkedNode *next;    // Pointer to next node

What Exactly IS a Relational Database Management System RDBMS

IBM doesn’t just make hardware. They also have laboratories like mad scientists. It was in their San Jose Research Laboratory that Edgar Frank Codd developed the DBMS (database management system) relational model. RDBMSs still encase the backbone of most systems worldwide, even with the introduction of object-oriented database management systems or OODBMS …seriously not every computer term needs an acronym.

MySQL by Oracle Corporation is still deployed on 50% of database backed sites according to Gartner. Because it’s open source (free!) it is typically the introductory database most developers come across. The other big giants are Microsoft’s SQL Server and Oracle Database. Structured Query Language (SQL) is a specific language used to insert, query, update, and delete data inside the database.

Here’s the basic structure of an SQL Statement:
SQL example statement

Working with MongoDB

Advantages of MongoDB over RDBMS (relational database management system).

Schema less − MongoDB is a document database in which one collection holds different documents. Number of fields, content and size of the document can differ from one document to another.
Structure of a single object is clear.
No complex joins.
Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that’s nearly as powerful as SQL.
Ease of scale-out − MongoDB is easy to scale.
Conversion/mapping of application objects to database objects not needed.
Uses internal memory for storing the (windowed) working set, enabling faster access of data.

Why Use MongoDB?

Document Oriented Storage − Data is stored in the form of JSON style documents.
Index on any attribute
Replication and high availability
Rich queries
Fast in-place updates
Professional support by MongoDB

Where to Use MongoDB?

Big Data
Content Management and Delivery
Mobile and Social Infrastructure
User Data Management
Data Hub

Here is an example of a MongoDB query. As you can see, you call out an item and then fields can be whatever you want them to. Unlike MySQL there is complete freedom over item values.

   { item: "journal", qty: 25, size: { h: 14, w: 21, uom: "cm" }, status: "A" },
   { item: "notebook", qty: 50, size: { h: 8.5, w: 11, uom: "in" }, status: "A" },
   { item: "paper", qty: 100, size: { h: 8.5, w: 11, uom: "in" }, status: "D" },
   { item: "planner", qty: 75, size: { h: 22.85, w: 30, uom: "cm" }, status: "D" },
   { item: "postcard", qty: 45, size: { h: 10, w: 15.25, uom: "cm" }, status: "A" }