Tuesday, November 25, 2008

Working Modal for Development

Most developer / software house does not put time to organise their concept of development.
Especially in Malaysia, most companies try their best to tender for project which squeeze their time and budget to as minimal as possible, leading to untested and non-flexible (rapid) system.

One of the best modal to work on will be:
AMDD - Agile-Modal Driven Development

It uses modal concept to plan overview system flexibility, while implementing TDD (Test-Driven Development) to have system test unit developed before the actual development begin.
By using this concept, development can be planned from overview to tasks to-do, and allow brain storm on variety of posibilities of business processes.

Project estimation has to be planned with a range of posibilities, problem from: simple case scenario to worst case scenario (everything that could involve, and more...) .

Each client have to understand that development of software requires proper planning.
Any changes on the system could involve major changes. For example, we can refer to any building structure. We can do changes on or in the building itself, but not changing the overall structure of the base nor the pillar concept. Changes on the overall structure could lead to reconstruction of the entire project, which could lead to duplication of afford and time used.

As a professional, we who is in the software development industry should see things in a long run. We should set a border line for time and money, in order to ensure everyone have a fair treatment and time constraint. For example: standardization of petrol price. If each petrol supplier tend to fight for lowest price, quality of product will reduce. People will tend to find the cheapest cost to deliver the software.

Comparing TDD and AMDD:

  • TDD shortens the programming feedback loop whereas AMDD shortens the modeling feedback loop.

  • TDD provides detailed specification (tests) whereas AMDD is better for thinking through bigger issues.

  • TDD promotes the development of high-quality code whereas AMDD promotes high-quality communication with your stakeholders and other developers.

  • TDD provides concrete evidence that your software works whereas AMDD supports your team, including stakeholders, in working toward a common understanding.

  • TDD “speaks” to programmers whereas AMDD speaks to business analysts, stakeholders, and data professionals.

  • TDD is provides very finely grained concrete feedback on the order of minutes whereas AMDD enables verbal feedback on the order minutes (concrete feedback requires developers to follow the practice Prove It With Code and thus becomes dependent on non-AM techniques).

  • TDD helps to ensure that your design is clean by focusing on creation of operations that are callable and testable whereas AMDD provides an opportunity to think through larger design/architectural issues before you code.

  • TDD is non-visually oriented whereas AMDD is visually oriented.

  • Both techniques are new to traditional developers and therefore may be threatening to them.

  • Both techniques support evolutionary development.


Reference:
http://www.agiledata.org/essays/tdd.html

Please correct us if we did any mistake on the article above.
Feel free to drop us comment :)

Thursday, September 4, 2008

Google Browser is up! - Chrome


Google came out with the Best Browser ever made from open source software,
"Webkit" (also used by Konqueror & Safari). http://www.google.com/chrome
On top of that, they have made a very impressively fast performance Javascript engine named "V8". The results were so impressive! It is more than 10X faster than traditional javascript engine made used in Mozilla Firefox 3.0 and M$ IE 7.

But its too bad that Chrome is yet to be available on Linux / Mac at this moment.

They managed to separate each tab / window process of Chrome into multiple process. Even plugin has their own separate process :)

With the new separated process, any crash on 1 window/tab can be controlled and constrained any crash into that particular tab/window without crashing on the other tabs or window. Even plugin works the same way!
This is what future browser need!

Recently, Mozilla has also optimized their JavaScript engine to a new level, named "Spider Monkey". They claim to have higher performance compared to Chrome "V8" engine. But compared to V8, V8 separates each tab processes independently, making it more stable.
http://www.mozilla.org/js/spidermonkey/

There has been claimed that some of the users are unable to open gmail or gdocs from google Chrome. As far as our testing goes, it works perfectly fine.
But we still like the "Home" button to be there on the chrome interface. Missing that features, make it awkward.

Here is a speed comparison chart on Chrome:

http://asia.cnet.com/crave/2008/09/03/speed-test-google-chrome-beats-firefox-ie-safa/

And another comparison:
http://gizmodo.com/5044958/dr-frankensteins-browser-the-strangely-obvious-ancestry-of-google-chrome




On top of that, we think that Adobe should seriously look into fixing up their Flash engine. It is so unstable on Windows, and even worst on Linux. The version we tested were Flash 9 and Flash 10 Beta.

Disclaimer:
Logos and photos used in this article are copyright of their respective owner. The content published above is solely for information purpose.

Tuesday, July 29, 2008

PHP Coding Ethic

Everyone can be programmer...
But we need to ensure that our coding is easy to be follow up by others...
Okay, maybe you don't care about others, but what if YOU are the one following up other peoples code?
Any nice feeling? i bet ya ;)

Okay, this might be not the only standard way of making things looks nice,
but it is our way of doing things in the company.

---------------------
Bad Coding:
$var1 = 123;
$var2 = "xxxx";
$var3 = true;
Why?
  • Bad Naming:
    - Who would have known the purpose of the variable "var1"?
    - Variable type is difficult to know... especially long piece of codes...
Better Coding:
$iCounter = 123;
$sMsg = "xxxx";
$bCheck = true;
Why?
  • Good naming:
    - $i... indicate variable type of number
    - $iCounter indicate what it is used for..

Its best to have proper naming. We include the starting 1st charactor in our variable naming as the variable type. List of naming:
  • $i... - number
  • $f... - float
  • $s... - string
  • $b... - boolean
  • $m... - mixed type
  • $o... - object
-----------------

Bad Coding:
if($bCheck == true) { $xxx = 1;
echo $xxx; }

foreach($xx as $yy ){
echo $yy; }

echo (($bXx == true) ? (($xxx==1)? "1": (($bYy==$xxx-1)? "true": "false")) : "ok" );
Why?:
  • Bad spacing if($bCheck <-- look too compact
  • Bad curly bracket positining and indent...
  • Too compact formula, look cool!, but it is definitely not easy to debug if problem risest! Even for the developer him/herself!
Better Coding:
if ($bCheck == true)
{
$xxx = 1;
echo $xxx;
}

foreach ($xx as $yy)
{
echo $yy;
}


if ($bXx == true)
{
if ($xxx == 1)
{
echo "1";
}
else
{
if ($bYy==$xx-1)
{
echo "true";
}
else
{
echo "false";
}
}
}
else
{
echo "ok";
}


Why?
  • Easier for reading and debugging
  • More spacing and proper curly bracket positioning


Disclaimer:
Logos and photos used in this tutorial are copyright of their respective owner. The content published above is solely for education purpose. Feel free to close this website if you are not happy here.. :)


PHP Tutorial #3 - The Basic

Previous*

Okay, time to get your hand dirty :D

For Ubuntu / Debian distribution:
1st, the starting page for apache is default pointed /var/www/
it is configured in /etc/apache2/sites-available/default assigned as parameter of DocumentRoot
The default file to open for directory will be in /etc/apache2/mods-enabled/dir.conf as parameter of DirectoryIndex

PHP files need to be declared as .php extension by default.
The starting page will be index.php

Create a file in /var/www/index.php
Enter the content:
<?php
$sNo = 123;
echo $sNo;
?>
You will get output:
123
In this tutorial, we will only show you the very simple basic.
For more information, please refer to php documentation or tutorial found here:
http://www.php.net/manual/en/language.basic-syntax.php

In PHP, a variable type is not needed to define. You may reassign the variable at any time to any type. "$" indicate it is a variable. Each statement must end with ";"
Example:
$mVar = 123;
echo $mVar;
echo "\r\n";
$mVar = "xyz";
echo $mVar;
Output:
123
xyz
"echo" is the simple function like c print.
you may also use the function print to do it.

To call a function:
$mResult = myFunction([parameter...]);

To define your function:
Example:
function myFunction($param1, $param2)
{
$iResult = $param1 + $param2;
return $iResult;
}
To call it:
Example:
$iResult = myFunction(123, 555);
echo $iResult;
Output:
678

For comment, use c like concept:
// Line based comment
/*
Multiple line
comments...
*/

Operators

Operators in PHP is alike C.
Example:
$iResult = 123 + 555;
//result to 678

$iResult = 111 - 10;
//result to 101

$iResult = 500 / 2;
//result to 250

$iResult = 50 * 3;
//result to 150

$bResult = (1==2)
//result to false (boolean)

$bResult = (1==1)
//result to true (boolean)

$bResult = (1!=2)
//result to true

$bResult = (1!=1)
//result to false

// AND operator
$bResult = (true && false)
//result to false

$bResult = (true && true)
//result to true

// OR operator
$bResult = (true || false )
// result to true

$bResult = (false || false )
// result to false
Next*

Disclaimer:
Logos and photos used in this tutorial are copyright of their respective owner. The content published above is solely for education purpose. Feel free to close this website if you are not happy here.. :)

Wednesday, July 16, 2008

Development CheckPoint

We have been working on PHP framework since 2006.
The development was inspired by the popular J2EE project called hibernate data layer, with Zoop Framework for PHP.
Yet, we can call this another PHP Framework.
We wanted full control over the system flow, therefore we have to develop a new one.

There have been many changes on the framework. As we develop on more business modules, we have evolved the framework for many times.
The initial framework was to have a standardized runtime platform to standardize all page call.
From the long URL request,
[Old Method]
http://www.xyz.com/index.php?request=xxx&module=yyy&var1=12345&var2=56443
[New Method]
http://www.xyz.com/runtime.php/xxx/yyy?var1=12345&var2=56443

The end result of URL is much more shorter.
Data Layer
The concept of data layer helps a lot on the standardization on each table.

Example scenario:
On the traditional method, it is difficult to change business /data logic especially on data validation. Any changes on the data logic requirement will effect all modules which uses that table. Traditional method will burden the programmer to work on more modules on each changes requested from the business view. With the new data layer concept, we need only to add the validation onto 1 class file, and it applies to all the modules. This save time and hassle for the programmer.

Presentation Layer
By using PHP Smarty templating, we were able to change the layout of the website easily and fast. Each template can be utilized in many other modules, thus saving time on development.

AMFPHP Web Service
It was later on that we have made our framework to be AMFPHP Service class compatible. Each call to the service (likely to be flash) goes through similar process as the webbrowser. The debug function of our page call were replaced by NetDebug function of AMFPHP for AMFPHP projects.





S.O.A.P Web Service
Then, it was SOAP trend. People were asking if its possible to extend what we develop with third party solutions! It was amazing ! By using XML technology, developer from different languages are able to cooperate on a concept where nearly every development platform could understand. But the initial development wasn't easy. We have to create WSDL defination file to define our services. And in the final stage, our framework took care of the WSDL generation by using Class! No more hassle on WSDL XML file. Just simple OOP declaration! Cool and Simple :)

http://en.wikipedia.org/wiki/SOAP


Modular Concept
It was later we got inspired by Drupal modular and event hook concept. We couldn't resists more of our ego to implement the concept. W00t, we got it running. We each module detectable by the system, user may install, activate or deactivate modules, and even uninstall the module. It was a big leap for us. We no longer requires all files to be chunked into the objectclass folder, but instead, those files now belong to their respective module folder.

Each module is able to have its own data layers and objects folder. It was able to define its own menu list, installation function, uninstall function, page header runtime, page footer runtime, and even declare its own dependencies module list.
User will be able to adminstrate these modules easily from a form in the back office administration screen.



Google Map API

In our recent project, we were requested by our client to develop a map positioning system to map their site intranet software. It was just the right time when Google open up their Google API. It was fantastic! We linked the data type in the data layer of the table column as Google GPS. And several tweaks on the frontend via javascript enable us to allow user to plot their site position on the map. They were as excited as we are :D. We save both the Longtitude and Latitue with the zoom level to the table field. and Wala, our 1st web based Map plotting software integrated as part of our framework :)
We just found out that Google Map API is now available for flash... cool :)


AJAX Field Update
Ajax has been the fancy word behind Web2.0 trend. We were dreaming of having full control of web front end with data layer. As we have a popup "pick" a record window to allow user to choose the field value from another table, we couldn't control the pick data from the value entered into another field. Therefore, we had put ourself in day and night sweat to work on a Ajax field update concept, similar to DotNet concept. The data layer class were stored into database. Everytime someone update a field in the form, it will trigger ajax call to update the data class. JQuery proves to saved us lots of time. Using the Ajax function of jquery was simple and easy. By using JSON, we were able to convert the updated changes from data class to the front end for updates on the form.


Hmm mm.. okay, lets look at our files count, 91 + 4 files of classes ...


PHP Tutorial #2 - Installation

Previous*

Installation

There are many methods and installation packages available on the internet.
What I will be showing here are the one we used.

For Windows developer:
http://www.wampserver.com/en/

Download the installation and install.
As of this tutorial, it was
WampServer 2.0c
Includes :
- Apache 2.2.8
- MySQL 5.0.51b
- PHP 5.2.6

For Linux developer:
For debian / knoppix /ubuntu based distribution:
Run this command in terminal / console:
sudo apt-get install apache2 php5 php5-cli php5-gd php5-mysql mysql-client mysql-server
The installation of MySQL will prompt you for root password.
This password will be mysql root user password, not your operating system root user password.
Therefor, you may enter a different password for security purpose.

Your root folder to localhost will be /var/www/

For CentOS / Redhat:
Run this command in terminal / console:
yum install httpd php php-mysql php-common php-gd php-mbstring php-mcrypt php-devel php-xml
Note*: this section need further information...


Finalising:
Once Installed, you may test your installation by opening this url in your browser:
http://localhost/

To Test PHP,
Code this in notepad(windows) or gedit/mousepad (linux), and save it as test.php in the root of web folder (example: /var/www/test.php)

<?php
phpinfo();
?>
Next, test it on your browser as http://localhost/test.php
You shall see a page that look like this:




Misc. Info:
Important files involving web:
/etc/hosts - management of domain to ip
/etc/apache2/sites-available/default (ubuntu / debian based) - virtual host control or other apache configuration
/etc/resolv.conf - dns server setting

Next*

Further References:

Disclaimer:
Logos and photos used in this tutorial are copyright of their respective owner. The content published above is solely for education purpose. Feel free to close this website if you are not happy here.. :)

PHP Tutorial #1 - Introduction

Interested to do a little web programming?
This is a simple tutorial for people who have no experience about PHP, but with little knowledge on designing website using Adobe Photoshop or GIMP, and Macromedia Dreamweaver or Amaya or etc...

We will try to make it simple, KISS (Keep it short and simple).

Introduction
PHP is a widely-used general-purpose scripting language that is especially suited for Web development and can be embedded into HTML.


According to netcraft, there have been 20,917,850 domains with 1,224,183 IP addresses hosting PHP services by 2007.
Source: Netcraft






Pros:
  • a very rapid development platform
  • based on scripting language
  • embeddable into web design
  • fast and efficient (subject to code ethic)
Cons:
  • Memory management needs improvement - especially involving huge classes, but can be improve by using auto_load function
  • Flexible variable type make it vulnerable to attacks
  • Security issue might rise from use of eval alike function
  • Single Threaded
  • Memory issue with session variable when it gets big...
  • Does not come default with framework like dotnet
*Note: the above cons has their work around...


Next*


Recommended resources:

Disclaimer:
Logos and photos used in this tutorial are copyright of their respective owner. The content published above is solely for education purpose. Feel free to close this website if you are not happy here.. :)