Binnooh.com

design
develop
detect
debug

...a software engineer’s blog about computer science, security, and development

Why/What is the importance of Metaphors?

+++++Metaphors is important in sense of compression and expression of one’s perspective of newly discovered matter.
As McConnel describes it

Metaphors contribute to a greater understanding of software-development issues in the same way that they contribute to a greater understanding of scientific questions.

McConnell, Steve (2009-11-30). Code Complete.

+++++By comparing and contracting, new idea’s born that might turn to be hypothesis or theorem later on.
A good example of the importance of metaphor is Galileo and the Aristotelian who looked at a swinging stone and thought that the heavy object moved naturally from “higher” position to a state of rest at “lower” one; when Galileo saw the swinging stone, he saw a “pendulum”. He thought that the stone is moving in repeating motion and almost at the same speed. In sense, both observers had seen the same thing, but their different interpretation of “what it is” had lead to different “base models”; the Aristotelian had thought of weight, height and gravitational effects, whereas Galileo observed the stone’s weight, the radius of the pendulum’s swing, the angular displacement, and the time took per swing. Galileo, and base on his observation and the metaphor he first thought, discovered laws that the Aristotelian could not discover.

Why is Software Construction Important?

+++++Software time construction, depending on the scale project, is generally 30 to 80 percent** of the total time spent on the whole project, hence, that much of time gives “Software Construction” the back bone of Software Engineering.


+++++To put it differently, Software construction, or you can call it “coding” “programming”, is the core aspect of any software project, a project can’t exits without construction; and it’s logically as important as the project itself.
McConnel, in his book “Code Complete”, gives “Software Construction” the highest point in software Engineering.

The quality of the construction substantially affects the quality of the project. (McConnell 2009)

** rough estimate from authors(Albrecht 1979; Glass1982; Jones 2000; Boehm et al. 2000; McConnell 2009).

What is the difference between Class and Object?

+++++I was asked this interesting question, and for a second, I had to revised my understanding on “Classes” and “Objects”. Although the question was meant to be about java, I answered in general way, saying that classes are definition of structured data type, and Objects are a data of class.

+++++Obviously, I crossed my initial response of “what is objects?”, because it too general and doesn’t specify the proper definition of object.
So, What is the difference between class and object?

Classes: are definitions of data type and holder for its static data.
Objects: are instances of structured data types (ex. classes) and has a lifespan.

What is Software Construction?

Researchers identified activities that go into software development
+++++• Problem Definition
+++++• Requirements’ Development
+++++ Construction Planning.
+++++• Software Architecture (high level)
+++++Detailed design
+++++Coding and debugging
+++++Unit testing
+++++• Integration testing,
+++++ Integration
+++++• System Testing
+++++• Corrective Maintenance.

** Bold are core components.

Tasks/Activities involved in Construction
+++++• Verifying that the groundwork has been laid so that construction can proceed successfully.
+++++• Determining how code will be tested.
+++++• Designing and writing classes and routines.
+++++• Creating and naming variables and named constants.
+++++• Selecting control structure and organizing blocks of statements.
+++++• Unit testing, integration testing, debugging code.
+++++• Review other team members’ low-level design (Peer review, peer construction planning.)
+++++• Formatting code.
+++++• Integrating software components that were created separately.
+++++• Performance optimization.


Not Construction Activity*
• Management requirement
• Software architecture
• User interface design
• System testing
• Maintenance
*These are components that affect the success of project within expected time.


Summary:
+++++Software Construction is the act of developing software, it involves multiple “Activities” that some are necessary and others are process success “Methods/activities”.
Above is the list of (construction and non-construction) activities.

What are the Steps in Designing a Database?

+++++In creating a database, first question and the hardest for developers would be “What and how to design a database?”


+++++The question is beyond creating a schema for specific Database management system, ex. MySQL, MSSQL, PostSQL,SQLite. The goal of the question is to specify the process of designing a database.
Before you dive into the points, you have to understand database elements and Entity-Relationship model, ER.
The “Database Management systems” by identifying ER as

The entity-relationship (ER) data model allows us to describe the data involved in a real-world enterprise in terms of objects and their relationships and is widely used to develop an initial database design. It provides useful concepts that allow us to move from an informal description of what users want from their database to a more detailed, precise description that can be implemented in a DBMS.


So understanding ER model, you can sum up the database design process to:
• Requirements Analysis: Gather information + know requirement.
• Conceptual Database Design: High level description and constrains of data.
• Logical Database design: Convert requirement and conceptual design into DB schema.
• Schema Refinement: analysis schema for potential problems.
• Physical DB design: consider typical expected workload and DB performance.
• Application and Security design: Consider UML and look for loop holes or risk involved/ potential harm.


An equivalent flow chart of theses steps would look like:

/bin vs /usr/bin or /var/bin

+++++Very interesting question that I read somewhere, while I was searving the Internet, is What is the difference between /bin and /usr/bin (also /var/bin) folders?
Beside what “might” seems obvious that the first is a root “binary” directory and the other is set for users.
The actual difference between the location of the two bin folder’s goes long when UNIX first created.
/bin = root (sum distros can’t be modified as it’s “manufacture binaries” ex. Early AT&T versions.)
/usr/bin = was ment to local uses (users, softwares or distro-extensions).
Some Linux distributions have software binaries stored in /var/bin instead of storing it in /usr/bin.



References:
Busybox mailing list

Rock, Paper and Scissor

+++++It has been some time since the last time I worked on C++ program, so I decided to pull some of my C++ books.
I started reading “C++ without fear” enum chapter, I came cross a really old, but fun, game program “Rock, Paper and Scissor”.
I remember creating something like it, in either classes or structs, but not in enums.

+++++So I decided to give it a try, and was shocked that the compiler didn’t not compile it, giving me all that errors about a enum class “Error: undefined type or tag”. With a little research I found out that C++ standards now does not support “enum [:type]” anymore! It’s giving me no chance but use enum without a type.
So The books sample revised version would look like:

//#include "stdafx.h"
#include <iostream>
#include <string>
#include <ctime>
using namespace std;

enum selection { rock, paper, scissors };

selection player_choice;     // Holds user's move
selection computer_choice;   // Holds computer move
string words[3] = {"rock", "paper", "scissors" };

selection get_computer_choice();
void decide_winner();
string get_msg(selection winner);
int rand0toN1(int n);


int _tmain(int argc, _TCHAR* argv[])
{    srand(time(NULL));  // Set seed for randomization.
string input_str;
int c;
while (true) {
	cout<<"Enter Rock, Paper, Scissors, or Exit: ";
	getline(cin, input_str);
	if (input_str.size() < 1) {
		cout << "Invalid input." << endl;
		continue;
	}
	c = input_str[0];
	if (c == 'R' || c == 'r')
		player_choice = rock;
	else if (c == 'P' || c == 'p')
		player_choice = paper;
	else if (c == 'S' || c == 's')
		player_choice = scissors;
	else if (c == 'E' || c == 'e')
		break;
	else {
		cout << "Invalid input." << endl;
		continue;
	}
	computer_choice = get_computer_choice();
	int p = (int) player_choice;
	int c = (int) computer_choice;
	cout << "You chose " << words[p];
	cout << "," << endl;
	cout << "I chose " << words[c];
	cout << "," << endl;
	decide_winner();
}
return EXIT_SUCCESS;

}
selection get_computer_choice() {
	int n = rand0toN1(3);
	if (n == 0) return rock;
	if (n == 1) return paper;
	return scissors;
}
void decide_winner() {
	if (player_choice == computer_choice) {
		cout << "Result is a tie." << endl << endl;
		return;
	}
	int p = static_cast<int>(player_choice);
	int c = static_cast<int>(computer_choice);
	if (p - c == 1 || p - c == -2) {
		cout << get_msg(player_choice);
		cout << "YOU WIN!" << endl;
	} else {
		cout << get_msg(computer_choice);
		cout << "I WIN!" << endl;
	}
	cout << endl;
}
string get_msg(selection winner) {
	if (winner == rock)
		return string("Rock smashes scissors...  ");
	else if (winner == paper)
		return string("Paper covers rock...  ");
	else
		return string("Scissors cuts paper...  ");
}
int rand0toN1(int n) {
	return rand() % n;
}


+++++It’s either the book is bit old, or C++ standards is moving too fast. Anyways, this is a pain for developers and book writers to catch up with C++ moving train.

Why EBNF? Why not use BNF?

+++++EBNF Stands for “Extended Backus–Naur Form”, is one of the early advance, and still in use, syntax notation that it’s used to specify “context-free” programming language.
Its parent BNF had succeeded for sometime, until new programmers needed an easier form of syntax description. EBNF was created for that reason, and It has been developed to become RFC and ISO standard for programming syntacts, and I wouldn’t be surprised to see that coming.


+++++I like Lars Marius Garshol quote, who pointed out some of Lack of BNF functionality and explaintion on why do we need to use EBNF instead of BNF.

In DL I had to use recursion (ie: DL can produce new DLs) to express the fact that there can be any number of Ds. This is a bit awkward and makes the BNF harder to read. Extended BNF (EBNF, of course) solves this problem by adding three operators:
? ? : which means that the symbol (or group of symbols in parenthesis) to the left of the operator is optional (it can appear zero or one times)
? * : which means that something can be repeated any number of times (and possibly be skipped altogether)
? + : which means that something can appear one or more times


A simple example of EBNF decimals (fractions) syntax:

	S := '-'? D+ ('.' D+)?
	D := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'


If you would have to write it in BNF form it would look like:

       S  := '-' FN |FN
       FN := DL | DL '.' DL
       DL := D |D DL
       D  := '0' | '1' | '2' | '3' | '4' | '5' | '6' | '7' | '8' | '9'

So, why EBNF? It’s easier and more human readable form of program syntax specification.

Open Album – Android Augmented Reality App

+++++I’m proud to create and build an Android augmented reality mobile application. It was my pleasure and privilege to have this application open source project.


+++++The project is completed and it’s under the process to be merged with Mixare, an augmented reality application also.
I decided to merge the project, which was a fork of old version Mixare, because I want to support open source and join cooperative efforts of Mixare-development community.


+++++I forked Mixare into a new project, since it wasn’t active at that time, and made major enhancements and code improvements. I didn’t stop their, I create new feature “photo’s” augmented reality, which was the main point of “Open Album.” You can find all the metadata, weekly progress reports and my announcement of Open Album in Mixare-developer community at Open Album repository.


+++++Currently, I’m part of Mixare-development, and you can follow my progress at Github or here in Binnooh.com. (Network graph of DevBinnooh’s contribution)

If you want to download the application on your phone, visit (Market app for android, Or App Store for Iphone)

Site Update

+++Binnooh.com is in process of updating the site to include more posts, and tips and experiences that I would like to share with public.

+++I have large a mount of notes and projects that it might be helpful for you, now or later.
I will be discussing projects that I worked on and currently working on. I will also create a repository for some my projects that can be found at DevBinnooh.

I will also share some of notes of interesting books that I read, and I hope it helps you in any way or form.

So tune in for more post and discussion.