Thursday 21 November 2013

Web Application Frameworks

A Web Application Framework is a software framework that is designed to support the development of dynamic websites, web applications, web services and web resources. The framework aims to alleviate the overhead associated with common activities performed in web development. Most of these frameworks based on the popular MVC architectural design pattern. Most MVC frameworks follow a push-based architecture also called "action-based". For example, many frameworks provide libraries for database access, templating frameworks and session management, and they often promote code reuse. 
Examples of  frameworks according to language ;-

PHP
  • CodeIgniter
  • Yii
  • Zend framework
  • CakePHP
  • FuelPHP
  • TYPO3

Java
  • Spring 
  • Java Server Faces(JSF)
  • Apache Struts
  • Google Web Toolkit(GWT)
  • Grails
  • JBoss Seam

Python
  • Django
  • Flask
  • CherryPy
  • Web2Py

Javascript
  • Meteor
  • SmartClient
  • Wakanda

C++
  • CppCMS
  • Wt

Java Persistence Frameworks

A persistence framework is software that assists and automates the connection to the databases, especially relational databases for storage, access or retrieval. Acts as a level of abstraction between the application and the databases. Since Java is an objet-oriented programming language it happens that many frameworks are also object-oriented which enables them to map the application's data and the database's data this is called Object-Relational Mapping(ORM). Many frameworks are ORM tools and use XML and metadata to annotations for their mappings. Examples ;-
  • Hibernate
  • iBatis SQL Maps
  • MyBatis
  • Slick
  • Ultra-Lite Persistence


 

Code Editor

An advanced text editing software that is specifically designed to aids the programmer/developer to write/edit source code and  perform special checks on the source code in a certain programming language. It makes it convenient for the development process by providing a way to run interpreters, translators, compilers, debuggers and other software development programs. It may be a stand-alone application or built into an Integrated Development Environment(IDE). One of the advantages as a programmer when using the  code editor is syntax highlighting, auto-complete feature, formatting of code blocks(indenting), etc. Most popular and well-known IDEs ;-
  • Notepad++(Windows) - Can write/edit very many programming languages.
  • NetBeans(UNIX, Windows)
  • Eclipse(UNIX, Windows)
  • IntelliJ IDEA(UNIX, Windows, Mac OS)
  • Microsoft Visual Studio(Windows)

 

Wednesday 20 November 2013

Source Control

Source Control also known as Version/Revision Control which aid in the management of the software configuration, source code changes and other collections of information.
In Software Development, source control has been employed in the need to keep track of development releases and where there are many developers need to work together to make large complex software systems, therefore the need for Version Control Systems(VCS). The source control mostly is managed according to changes of source code which is related to time.
Before Version Control Systems came into play there was Report Control Systems(RCS) which was a software implementation of revision control that automates the storing, retrieval, logging, identification, and merging of revisions. Revision Control System is also capable of handling binary files, though with reduced efficiency. Examples of VCS would be Apache svn, Git, Mercury, and others.



Design Patterns

A design pattern is a reusable solution that can be implemented on software problems that commonly occur in development. There are very many design patterns that are employed in software design and they are classified according using concepts such as delegation(representation), aggregation(constituent components), consultation(reference) which are into groups, creational patterns, behavioral patterns, structural patterns and concurrency patterns. There is another architectural design pattern that is also becoming very common Model-View-Controller pattern. Object-oriented design patterns typically show relationships and interactions between classes or objects.
 

Creation Design Patterns
Based on object creations although could result in design problems or added complexity to the design. The approach is to solve this problem is control of object creation. They are grouped further into Class creational and Object creational patterns. Well-known design patterns;-

  • Abstract Factory pattern
  • Builder pattern
  • Factory method pattern
  • Prototype pattern
  • Singleton pattern

Behavioral Patterns
In software engineering, behavioral design patterns are design patterns that identify common communication patterns between objects and realize these patterns. By doing so, these patterns increase flexibility in carrying out this communication.
 

Examples;-
  • Observer pattern also known as Publisher/Subscriber pattern;-
Objects register to observe an event that may be raised by another object.The observable object holds reference to many observer objects that are registered(subscribed) to it and can be removed(unsubscribed). The observable gives information(publishes) to the observers(subscribers) that are registered(subscribed) and also updates the observers too.
  • Iterator pattern
  • Chain of responsibility pattern
  • Command pattern
  • State pattern
  • Strategy pattern
  • Template method pattern
  • Visitor pattern
  • Null object pattern

Structural Patterns

Design patterns that ease the design by identifying a simple way to realize relationships between entities(aggregation).
Examples:
  • Facade pattern -  create a simplified interface of an existing interface to ease usage for common tasks.
  •  Adapter pattern
  • Aggregate pattern
  • Decorator pattern
  • Composite pattern
  • Proxy pattern
  • Pipes and Filters pattern

Concurrency Pattern
Concurrency design patterns are those types of patterns that deal with the multi-threaded programming paradigm. Examples:
  • Thread pool pattern - acts in a round-robin fashion.
  •  Monitor Object pattern
  • Balking pattern
  • Double-checking locking pattern
  • Guarded suspension pattern
  •  Reactor pattern
  • Read-write lock pattern
  • Scheduler pattern
  • Thread-specific pattern

MVC(Model-View-Controller) pattern
In Software Architecture, it is a design pattern that involves de-coupling of business rules, data, functions, logic from user's interaction with it. The Model consists of business rules, data, logic, functions and View consists of representation of data, such as a diagram. Controller is the mediator of communication between the two, Model and View.





Tuesday 19 November 2013

PHP 5 Configuration

As a developer so far  I have dealt with two web servers using PHP 5 on it that I would give you directives on how to setup the machine for running of your web applications. There are two web servers which I know Apache web server and Information Internet Services(IIS) web server.

Using Apache
You can start decide to start on whatever software to start installing either server or parser and Database Software preferably MySQL then configure afterwards.
  • Download right package of the web server and PHP 5 parser, that is, Apache 2(or version above) which may come in form of different packages, i.e., WAMP(Windows Apache MySQL), XAMPP(Cross-platform Apache MySQL PHP Perl) which eases your work to download in single packages. For now, we'll use AMP(Apache MySQL PHP) which you will install each in a single package, i.e., download Apache 2(or above version), PHP 5(or above version) which should be an archive(.zip, or .tar file) and MySQL 5(or above version).
  • Install Apache Server into your system and then you are supposed to see your web server at the taskbar up and running but its not yet configured for PHP. Still you can go to 'http://localhost/' on your browser you should see that it will display a default 'index.html' page.Its OK.
  • Install PHP 5 package by extracting the package contents into your root directory, that is, C:\ and then copy file 'php-ini-development' or 'php-ini-dist' to a folder named backup on your desktop. You'll need it if anything compromise on your environment happens in future.
  • Install MySQL package which should be an executable file package and choose standard configuration where prompted. Enter your new password and I would advise you to save the password somewhere safe if you forget easily because you don't want future distress from failure to connecting to database. Don't change any other options just leave them the way they are. Don't forget to select option of 'Add to your bin directory to your Path'.
  • Move to PHP 5 directory and you remember the 'php-ini-dist' file rename it to 'php.ini' file and open it with your text editor to configure. Find 'doc_root = ' in the file and change by adding the directory to "C:\Program Files\Apache Software Foundation\Apache2.2\htdocs" directory which is the default on Apache server or you may search on 'httpd' file on 'conf' directory that resides on web server root directory and search value for 'DocumentRoot ' so after it should be like this, 'doc_root = C:\Program Files\Apache Software Foundation\Apache2.2\htdocs'. Find 'extension_dir = '  and remove ';' if it has one and change it to by adding 'C:\<PHP 5 installation>\ext' at the end of '= ' should be like this, 'extension_dir = C:\PHP5\ext'. Find ';extension=' and uncomment by removing the ';' at the start of it for the following 'php_mysqli.dll', 'php_gd2.dll' only those which will allow you to connect to the database and the graphics library. Also uncomment 'session.save_path = "C:\Windows\Temp"' and change it if it has no or different value directory given.
  • Finally before we done with PHP 5 configuration add the PHP 5 directory to your PATH. If you don't know refer to my post on java configuration on this blog.
  • Go to Apache web server directory and move to conf directory you will copy the 'httpd' file to backup folder you backed up the 'php-ini-dist' file. You will need it if your web server gets compromised in future. Open 'httpd' file in text editor find '<IfModule dir_module>'  and add between the tags  after the 'index.html' add 'index.php' which must have a space between them. The 'index.php' file might be any of your wish, e.g., test.php or any other php file which we'll be the default php file. After the changes it should be like this, 'DirectoryIndex index.html index.php'.  
  • Finally add module to handle PHP applications, that is, add the following lines at the end of the file.
 LoadModule php5_module "C:\PHP\php5apache<version>.dll"
AddType application/x-httpd-php .php
PHPIniDir "C:\PHP"



Using IIS
  •  First you will need PHP 5 and MySQL 5 installed but you do not need it configured.
  • Hold Ctrl Key and punch R to get Run dialog window type in 'inetmgr' to get IIS manager window.
  • On IIS Manager, and then move to the server level.
  • Double-click Handler Mappings.
  • In the Actions pane, click Add Module Mapping.
  • In the Add Module Mapping dialog box, specify the configuration settings as follows:
    • Request path: *.php
    • Module: FastCgiModule
    • Executable: C:\[Path to your PHP installation]\php-cgi.exe
    • Name: PHPviaFastCGI
  • Click OK.
  • In the dialog box that asks you to confirm that you want to create a FastCGI application for the executable, click Yes.
  • To verify that the handler mapping works correctly, create a Phpinfo.php file in the C:\inetpub\wwwroot folder that contains the following:
    <?php phpinfo(); ?>
  • Open a Web browser, and then navigate to http://localhost/phpinfo.php. If everything was set up correctly, you will see the standard PHP information page.

Kudos!


Friday 8 November 2013

ACID


In Software Engineering, it is a software methodology consisting of set of properties to ensure there is guarantee during processing(committing) of the database transactions is reliable as planned to maintain integrity and security. A transaction by definition is a single logic unit of operation on data, that is, database which involves one or more SQL queries to be executed. In java, JTA API also involves the employment of ACID philosophy to ensure integrity of transactions for business applications. Deployments that ACID is also employed is in software testing for QA (Quality Assurance) and also software security to make an IDS (Intrusion Detection System).

Acid
Consistency
Isolation
Durability

Atomicity
This supposes that the transaction being committed (sent to the database to be stored) if any part of its SQL queries fails the whole of it is compromised and is considered as a failure or all of its parts successful to be considered  complete and successful. The transaction is said to constitutes very small (atomic) indivisible operations, that is, SQL queries that make up a transaction.
Consistency
The operations must be valid according the rules or standards specified which are predefined to be followed which ensures the data committed is consistent as specified. 
Isolation
By providing isolation we can have concurrency on the happening of transactions, that is, the database operations happen or occur at the same time without interference from other operations.
Durability
The data being stored in the database is permanently stored and can be recovered in case of any power shortages, or system failures.