Tuesday, August 28, 2012

Software Engineering

Introduction

                   Software... is the brain for the body (Hardware). An iPhone device is useless if it is not programmed to work the way it should. Lot known about Software and its methodologies nevertheless when we start coding we forget most of the concepts. When someone shoots at us the jargon of words, it all sounds familiar but we are never sure. In most cases, its always like we know what it is, but we don't know its name or the term that is used in the industry to refer it.

This is my effort to learn for myself some terms, concepts and methodologies of Software Engineering.

Some terms and the meaning behind them

Framework and Application Programming Interface (API): 
          Straight from the dictionary, framework is "A structure for supporting or enclosing something else, especially a skeletal support used as the basis for something being constructed".

Now walk into the programming world. We know that operating system has all the software required to manage the computer hardware, and hence when shipped it comes with a default set of functionality that the company releasing the OS would have designed, developed, tested and released to the market. Now you want a different behavior from the default for example, on an iPhone screen, when a user touches a letter on the keypad the corresponding letter appears on the screen. This is the default behavior. Suppose we want a different behavior here, like let user type only numbers on your notepad. For this, we need to override the default behavior and here comes the framework.

Software framework is a package that includes everything necessary to build an application. It includes compilers(so your programming language dependent code is compiled and converted to machine language), libraries, an API and tools(debugger, IDE) that aid in the development. Some important features are:
  • The program flow is controlled by the framework.
  • Some of the code can be overridden to provide user specific functionality.
  • The framework code is not modifiable.
Framework handles all the work from developing an application to publishing it.

API is  

Sunday, March 27, 2011

Convert ticks to Date object

I needed to display how many days, hours and minutes are remaining for an event at this instant and the event date being in ticks.

//convert the event day to a date object
var startticks = new Date(ticks * 1000);

//convert today to ticks will be in milliseconds
var todayticks = new Date().getTime();

var diff = startticks - todayticks;
var days = Math.floor(diff/(24*60*60*1000));
var hours = (diff/(60*60*1000)) % 24;
var mins = (diff/(60*1000)) % 60;

Here ticks was in seconds, so multiplying it with 1000 to convert to milliseconds.