Tuesday, May 28, 2013

Test Driven UI Object Inference


UI objects are an invaluable resource when it comes to writing UI tests for enterprise applications. They identify and represent elements, sections or sometimes web pages or windows (depending on the context) as “objects” which can be used with an object oriented language and a browser automation tool such as Selenium to create your tests.

There are significant advantages of this approach. First, representing UI elements as objects which can be used within your test code allows you to re-use the UI objects in different tests. Also, by using UI objects, you can clearly segregate test logic from the UI logic as all the UI related complexities are encapsulated within the UI object.  

One of the major disadvantages of using UI object approach is that the UI object creation/generation process is not governed by tests (See Figure 1). This surfaces some critical issues. First of all our UI object repositories can get really large and clogged with objects that are not required for our tests at all. This happens because UI objects are generated early before the tests are created, we don’t exactly know which part of the UI elements we require for the test. Furthermore, this disconnect approach restrict us  to make the UI Objects more context aware, i.e. there might be an opportunity to refactor the UI object to handle some responsibilities other than encapsulating sub components and its location. For instance, it will be more logical to encapsulate the “login” functionality within the Login UI object rather than handling that logic within the tests. However, we can’t make an informed decision about this until we get down to writing actual tests. Also, the approach of creating UI objects first set a trend to write the test based on the generated object rather than basing them on the actual business requirement.

Figure 1 illustrate the usual approach of using a UI object repository



As a developer or a tester our objective is to test the functionality of our application through the UI, however, the above approach will force us to focus unnecessarily on object creation. The situation worsens when we consider the fact that the action of creating UI objects and the action of writing tests are independent of each other. UI object creation should be done as part of creating tests and it should be a natural flow rather than a step we must follow.

UI Object repositories are just a mere tool that we use to write tests. Hence, there is a clear dependency between the two, test objects will always be composed of UI objects and UI objects can’t exist without a test.

Figure 2 illustrates this dependency



The flow depicted in Figure 1 above doesn’t endorse the relationship shown in figure 2.

We propose a solution for the above presented issues and to ensure that relationship shown in figure 2 is always honored. The proposed approaches ensures the UI object creation process is governed by tests, it follows a flow defined in below  in figure 3




As shown in Figure 3, this approach enforces you to write a failing test first. You are forced to use a UI object that doesn’t exist; hence, your test will fail. You will then define the minimum required object to pass the test. This is the most important aspect of this approach, rather than mapping your UI’s one to one into objects, you are creating a UI object that is only complete enough to pass the test you are writing at that moment. 

Further explaining the “Minimum Required Object”, properties of being minimum and required should be maintained at all times. I.e. these objects should have 100% code coverage from the test suite. The approach shown in figure 3 ensures this will always be true. At the inception of the object creation, you will only represent UI components that are absolutely required to run the test you are writing at the given time, obviously you will revisit this object multiple times as your test or test suite grows. 

While this approach will resolve many issues in creating objects prior to writing tests, the problem of context switching can still be a problem if you are using a 3rd party tool to generate objects for your tests, in that case you will be switching context very frequently since you should neither create the object nor the test at one go. However, this issue is heavily dependent on the mechanism you use to generate UI Objects. For instance, if you are not using a 3rd party tool and choose to create UI objects directly using the object oriented language you use to write tests, i.e. manually creating UI objects; there’s no issue of context switching since you are doing it within the same context. This approach has merit of removing the dependency on 3rd party object generators, remove the learning curve of a 3rd party object generator and provide the maximum control of your objects. One negativity in this approach is that you are responsible of organizing your objects; and how quickly you can do changes to UI objects will entirely depend on your ability to organize them in a meaningful manner. Figure 4 illustrates this approach. 


Organizing your objects in a separate project and under well-structured packages will help you to avert the aforementioned issue.


Monday, October 22, 2012

SCRUM, SCRUM and SCRUM


Why is SCRUM successful in developing software?  This was the question that was haunting my mind during last week while I was undergoing training in Agile SCRUM. It’s evident that SCRUM has shown great results in delivering satisfactory software, but I was wondering why SCRUM works while so many structured, well defined, rule based methodologies have failed.  Well, if you have worked in an agile environment you must be thinking, “That’s easy; SCRUM works because it’s about people”. But my real question is why it’s about people?  If you really think about it for a second, SCRUM encourages team work, collaboration, taking into account the “people” factor, but in reality what does it really mean? In actual scenarios up to what level do we consider the people factor? I mean, come to think of it, it’s a very scary thought; people are unpredictable and imperfect and how do we rely on them for a project success? So, why does SCRUM really work?

Just the other night while flying back home from the training, It all of a sudden struck me; I was thinking how does great artists and craftsman create art? What did it really took to create Last supper? 

If it’s the tools they used or the approach (the process) they used to make their masterpiece then I’m sure overtime everyone would be a Picasso. Don’t miss understand me here, I’m not undermining the tools or the approach that has evolved for thousands of years in creating great artwork, all I’m saying is that those were not the decisive factor. The realization that I had while thinking deep into this factor is that it’s not the process or the tools, but the people that created the masterpieces. When it comes to great artwork I’m sure many of you will agree with me, but I would like to take this a step further. I suggest that what we do in creating software is in fact exactly the same as creating artwork. If you really give a minute or two for the idea to sink in and analyze it with an open mind, you will be amazed how similar these two fields are.

First of all, they are both knowledge based disciplines, I.e. you have to master certain tools and skills in order to become an artist/craftsman or a software engineer. Secondly, it’s very difficult to say whether you succeeded or not until you have the finished product (I.e. both professions deals with uncertainties and risks). Thirdly, what is expected in the end product is not just a product but a “beautiful” product which you can really be proud of. Another very important fact is that in order to be successful in both fields, one needs to be passionate about the work they do. If an artist is asked to draw a human, all it takes is 5 straight lines and a circle to communicate the message; but can it be compared to Mona Lisa? Same way, we can write software that gets the job done, but will it be considered a “good”, “quality” product?  Think about this, you can write an enterprise software application without giving a damn about code quality, re-usability, test coverage or usability; it will get the job done, but will anyone use it? Will any developer be proud of the work they have done?

So, in essence, to build beautiful software that everyone, including yourself would appreciate;  you have to be more than a software engineer (who was trained to use a set of tools and follow a set of rules), you need to become a Software Craftsman.

Agile SCRUM enables you to create software crafters within your team quickly and easily than any other methodology. It ensures self-governess and freedom to think, which triggers deepest creative neurons in once brain. It enables people to express them and provide them a canvas where they can draw an important stroke of great masteries. By empowering and enabling the team to overcome their own problems and by removing blocks that slows the team down, SCRUM sparks a wonderful synergizing effect within passionate set of software crafters that will always produce a software masterpiece which will be appreciated and admired by everyone.

This is why SCRUM is so unique, and this is why the people factor is so important. I feel companies need to understand this and ensure they hire passionate people who with the right empowerment can work wonders for them. Great people are always free thinkers and Agile SCRUM ensures people are given that freedom in a manageable framework. Companies need to take advantage of this; they should empower the teams to be self-organized and self-governed rather than trying to “manage” teams with waterfall based practices that will hinder both productivity and joy of creating beautiful software. 




Sunday, October 9, 2011

Selenium Object Repository - Part 1

On the contrary to popular belief, Selenium (http://seleniumhq.org)  is not a test automation tool. By definition , Selenium is a web browser automation tool. Hence, we might not see rich features inherited to Test Automation tools such as QTP. However, Selenium works really well as a browser automation tool.  It's light weight, portable and fairly easy to run, and it works well with many web application development platforms such as Java, PHP, Python etc... Another reason for its immense popularity is that it works really well with different browsers.

As a browser automation tool, selenium can be used in conjunction with an application testing framework (such as Junit for Java) to automate web application testing.  It has been used like this as an alternative for expensive and  complex test automation tools. However, one of the key things that was missing is an object repository. Popular test automation tools such as QTP provides a comprehensive Object Repository where we can represent application elements as objects and reuse them within test cases.

By utilizing the page object pattern which represent the elements of your web application as a series of objects, we can create an Object Repository which can be used with selenium. This will provide us a huge advantage of not having to duplicate browser automation code in order to test different aspects of the application. For example in order to test an application with a user login, we might need to login to the application initially in every test. In the conventional way we will have to duplicate the code for login inside every test case. With selenium page object pattern we can encapsulate login method of the application within a "LoginArea " object which we'll be able to re-use in every test case.

Using page object pattern we can de-couple selenium logic from the test case. This is really important since test logic has nothing to do with selenium operations. Below example will clearly demonstrate the difference and advantage of using selenium page objects.
Code Listing below shows a typical traditional selenium and Junit test to test a web application. The objective of the code was to test Gmail login  and "Move To Spam" operations.

package com.selenium.standard.tests;

/**
 * URL of the application will be created by concatenating the APP_HOST And APP_PATH
 */
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

import com.thoughtworks.selenium.SeleneseTestBase;

public class GmailTest extends SeleneseTestBase {
 public static final String APP_HOST = "http://www.gmail.com/";
 public static final String APP_PATH = "/";

 public static final String TEST_BROWSER = "*iexplore";
 public static final int SELENIUM_PORT = 4444;
 public static final String HOST = "localhost";
 public static final String MAX_TIME_OUT = "1000000000";

 @Before
 public void initialzeTests() throws Exception {
  setUp(APP_HOST, TEST_BROWSER, SELENIUM_PORT);
  selenium.open(APP_PATH);
  selenium.windowMaximize();
 }

 @Test
 public void testGmailLoginFail() throws Exception {
  // Enter a wrong login details first
  selenium.type("Email", "webappcenter");
  selenium.type("Passwd", "webappcenter123sds");
  selenium.click("signIn");
  String waitForXPath = "The username or password you entered is incorrect";
  selenium.waitForCondition("selenium.isTextPresent(\"" + waitForXPath
    + "\")", MAX_TIME_OUT);
  assertTrue(selenium
    .isTextPresent("The username or password you entered is incorrect."));
 }

 @Test
 public void testGmailLoginSucess() throws Exception {

  // login to gmail with correct logins
  selenium.type("Email", "webappcenter");
  selenium.type("Passwd", "webappcenter123");
  selenium.click("signIn");
  String waitForXPath = "//html/body/div/div[2]/div/div[2]/div/div/div/div[3]/div/div/div/div/div";
  selenium.waitForCondition("selenium.isElementPresent(\"" + waitForXPath
    + "\")", MAX_TIME_OUT);

  // test Login sucessfull
  assertTrue(selenium
    .isElementPresent("//html/body/div/div[2]/div/div/div[4]/div/div[2]/div/table/tbody/tr/td[2]/div[3]"));
 }

 @Test
 public void testMoveToSpan() throws Exception {
  // login to gmail with correct logins
  selenium.type("Email", "webappcenter");
  selenium.type("Passwd", "xxxpasswordxxx");
  selenium.click("signIn");
  String waitForXPath = "//html/body/div/div[2]/div/div[2]/div/div/div/div[3]/div/div/div/div/div";
  selenium.waitForCondition("selenium.isElementPresent(\"" + waitForXPath
    + "\")", MAX_TIME_OUT);

  // Get the UI to basic view
  selenium.click("//html/body/div/div[2]/div/div[2]/div/div[2]/div[2]/div[5]/div/div/a");
  waitForXPath = "You are currently viewing Gmail in basic HTML";
  selenium.waitForCondition("selenium.isTextPresent(\"" + waitForXPath
    + "\")", MAX_TIME_OUT);
  // Move first two items to span
  selenium.click("//html/body/table[3]/tbody/tr/td[2]/table/tbody/tr/td[2]/form/table[2]/tbody/tr/td/input");
  selenium.click("//html/body/table[3]/tbody/tr/td[2]/table/tbody/tr/td[2]/form/table[2]/tbody/tr[3]/td/input");
  selenium.click("//html/body/table[3]/tbody/tr/td[2]/table/tbody/tr/td[2]/form/table/tbody/tr/td/input[2]");
  waitForXPath = "2 conversations have been marked as spam.";
  selenium.waitForCondition("selenium.isTextPresent(\"" + waitForXPath
    + "\")", MAX_TIME_OUT);
  assertTrue(selenium
    .isTextPresent("2 conversations have been marked as spam."));
 }

 @After
 public void releaseTestResources() throws Exception {
  selenium.stop();
  selenium = null;
 }

}


As you can see, we clearly has mixed selenium operation logic with the test logic, this violate the single responsibility principle of good object oriented programming practices. Let's see if we can make it better. Below is the same test but with applied page object pattern.

package com.selenium.pageobject.tests;

import org.junit.Test;

import com.selenium.pageobject.libs.GmailEmailList;
import com.selenium.pageobject.libs.GmailLogin;
import com.selenium.pageobject.libs.GmailTopButtonPanel;
import com.selenium.pageobject.libs.common.PageObjectBaseTest;

public class GmailPageObjectTest extends PageObjectBaseTest {

 private GmailLogin loginPage; // This is the login page object
 private GmailEmailList emailListPanel; // This is the email list object
 private GmailTopButtonPanel buttonPanel; // This is the button Panel Object

 public GmailPageObjectTest() {
  loginPage = new GmailLogin(localSelenium);
  emailListPanel = new GmailEmailList(localSelenium);
  buttonPanel = new GmailTopButtonPanel(localSelenium);
 }

 @Test
 public void testGmailLoginFail() throws Exception {
  // Test for failed login
  loginPage.login("webappcenter", "adadjsdksdk");
  assertTrue(loginPage.verifyLoginFailure());
 }

 @Test
 public void testGmailLoginSuccess() throws Exception {

  // Test for successful login
  loginPage.login("webappcenter", "webappcenter123");
  assertTrue(loginPage.verifyLoginSuccess());
 }

 @Test
 public void testMoveToSpan() throws Exception {
  if (loginPage.loginBasicView("webappcenter", "xxxpasswordxxx")) {
   emailListPanel.selectFirstTwoEmails();
   buttonPanel.reportSpam();
   assertTrue(buttonPanel.verifyReportSpan(2));
  } else {
   fail("Could not login to basic view");
  }
 }
}


Firstly, we have 3 page objects defined (GmailLogin, GmailEmailList and GmailTopButtonPanel) and all the selenium logic to locate and handle these objects are now moved to the relevant object itself.  This approach has considerably improved our test by separating the selenium and test logic and improving the readability as well. Another advantage is that in most cases application changes are not affected to the test case. For example, say Google introduce a new login window  and IDs of text fields were changed, in the first code listing we'll have to change the test case itself in order to update this change. However, in the second example we only have update GmailLogin page object and our test case itself is not aware of this change at all.

During this series of articles we'll develop a fully functional  object repository for selenium which can be reused in any project. I'll be using  Java and related technologies as the development platform,  but with little changes you can implement the same for other platforms as well.
Having a clear understanding of the advantages of using a Object Repository, in the next article we'll start to implement our very own selenium Object Repository.

NB: It has been over a year since I've written the original article. Sorry I've never got the time to write the followup of this. However, the time isn't wasted. I have created a fully functional Selenium Object Repository in Java which you can use in your projects. Work of this framework is now completed. I'm in the process of documenting it. Please bare with me, I'll have all the details of using it in the next followup article to this.

Wednesday, September 14, 2011

TTL Formula for SCRUM

What are the key factors of a successful scrum team?  what is the magic formula that drive scrum teams to success? After wrestling around  with it for a while, I realized that 3 key factors, namely "Teamwork", "Talent" and "Leadership"  (TTL) determine success of a scrum team  above all else. and for the best performance, you need to arrange these factors in the correct order using a formula. Here's what I came up with

Collection of talented team players with leadership qualities = Successful Scrum Team
(Collection of Team Players)  X (Talent) X (Leadership ) = Successful Scrum Team


a(Teamwork)  X   b(Talent)   X    c(Leadership)   =  Successful Scrum Team
where a,b,c are constants.

As simple it may seems, I feel little description of this formula is necessary. It's obvious that each factor Teamwork, Talent and Leadership holds equal importance i.e. 0 value of any of these factors means a failing scrum team.

This surfaces the complexities of putting together a scrum team as well, you need to have the right combination of people. Also, it's vital that each individual of the team has leadership skills apart from talent and teamwork abilities, I feel this is a unique characteristic of scrum process. Unlike other SDLC processes having highly talented individuals with 0 leadership skills will not add any value to the success of the team.
Another point is , giving an effort to improve any of these factors (i.e. TTL) by increasing the constants (a, b and c) will have a direct impact on the success of the scrum team. I feel scrum teams need to put effort on improving these factors and try to improve teamwork, talent and leadership skills within the team to ensure the success.

Thursday, September 8, 2011

Why we blog

an interesting internal workshop we had today was about social media and blogging played a major role in it. many things were discussed about the advantage of blogging to promote yourself, company etc.. but none of it completely made sense to me on the question of "Why we blog?"  I feel many people are trying to force themselves to blogging for all the wrong reasons. for example, blogging only to create a web presence and to build an image or blogging to promote the company that you work for.


I feel we should blog for ourselves, one of my mentors (Hasith Yaggahavita - http://blog.hasith.net/) has described in his blog that "Generally I write here to structure my own thinking". I feel that's a very good reason to blog (Actually I think that's what got me started blogging really). You need to understand that blogger is a great tool that allow you to write what's on your mind clearly, and for me, more I write or talk about a given subject, more clearer it gets. Hence, I am fully agreement with Hasith, and I blog for myself and to make the subject I write about  more clear to me. Of course others are more than welcome to voice their own ideas and contribute by commenting and challenging my views :)

Friday, March 18, 2011

Heroes, Humans and Success in Agile Software Development

I love agile software development methods and techniques, I'm also a big fan of Agile Scrum process. I believe it has revolutionized how we develop software and in a good way. Although  it might not be the Aladdin's lamp which will provide a total solution to all of software development issues, it's the closest we have at the moment.

I believe the majority of us has identified how Agile processes can be utilized in developing successful software applications. But I think it potent to find out why agile is successful, as it turns out many concepts and practices that we follow in Agile processes have been there for sometimes, things like iterative development is also available in RUP which is not an Agile process.  So, what makes agile different and what leads to its success? "Human aspect", yes, Agile processes take into account the Human aspect in a software development environment. It allows team members to decide for themselves and provides a free and equal environment for them to perform at their own pace. It also embrace the concept of "Team", and encourage people to work as a group rather than individually. Humans by nature are social creatures, we almost always hate solitude. Agile processes utilize this fact in a beautiful way by removing limiting boundaries within the team that would hinder interaction between team members.

While Agile process highlights and even relies on the "Human Aspect" for its success,  using the freedom allowed within the agile team needs to be used in a very responsible way. As the famous quote from Movie Spider Man goes "With Great Power  comes Grate Responsibility", in Agile, "With Great  Freedom comes Great Responsibility". In the old days of software development, many areas were filled with ambiguity, and large systems were built by a design that was done at the beginning of the project, even though the iterations were practiced, iteration cycles were long and often the deliverables didn't match the client requirement, simply put the situation was chaotic. Just like in any such situation, this messy environment paved the way for  "Heroes" to immerge, i.e. there were some team member(s) within any software application development team who had better understanding of the application domain or the programming language etc... the chaotic environment of software application development of the old days allowed people like this to shine among others in a team, usually these team members were considered "High Valued" resources by the company and they were well looked after. In highly procedural bound processes that didn't consider the value of the "Human" aspect these "Heroes" actually rescued projects, they single handedly sometimes dragged the project to finish line using the special skills they have and often the ordinary  team members (who would have added lot of value if given the opportunity) were shadowed by this process and the concept of "Team" was never embraced.

Agile processors has changed all of that, it has created an environment where everybody can interact and add value to the project they are working on. Success of an Agile based software application depended on the Team not on the skill levels of its individuals, by allowing each team member to contribute and by respecting and identifying the importance of the "Human" aspect, Agile processes has given the opportunity for each and every team member to become a Hero. However, each individual of an Agile team must understand their strength and success of the project relies on the Team not themselves, so, the Heroes within the team has a great responsibility to use their powers carefully. A true agile hero would embrace the team more than anything, they would use their special skills to improve and empower team members and almost always would try their level best to develop the team. They would also understand that a team consists of "Humans" and that each individual is unique in this world, it's important to respect ideas of each individual in a team. Also, all team members need to understand that their personal egos doesn't add any value to the team, it almost always hinder teamwork which will intern destroy the unity within the team.

All in all, It's not a must for Heroes to exists within an agile team. what's important is that each individual in the team embrace the Human factor and utilize property to drive the project to success.

Sunday, October 24, 2010

How to setup a simple Continues Integration Server for PHP

Ok, finally found some time to finish this article :)

In the previous article I have explained the concepts of Application Life-cycle Management (ALM) and Continues Integration (CI). Here, I'm explaining in detail how to configure a fully working Continues Integration environment using Hudson in Windows.

I wanted to give a complete picture of the CI server configuration within windows and it's obvious that I can't explain this using a single blog post. hence, I have created .PDF file that explains the whole process step by step. You can download this article and keep it with your for future reference as well.

Download the article here.


Continues Integration Server for PHP



Please let me know if this has helped you. If you have any questions, just leave a comment and I'll try to resolve it for you.

I hope this article has been good learning experience for you as much as it has been for me. In the next article I'll be proposing a MVC based application design architecture that will be suitable for many enterprise level application development in PHP. Until next time, Keep blogging :)

Wednesday, August 25, 2010

Properties of a Large Scale Applications and Elements of Application Lifecycle Management

This is the 2nd part of a series of articles written to show how PHP and related technologies can be utilized to create large scale enterprise level software applications. You can read the first part here.

Before we drill down into specifics about this subject, I would like to share few thoughts about the term “Enterprise Software Applications”; I believe this will help us understand the properties of such software application in order to identify the necessary elements in developing them. Simply put, enterprise software applications are complex application software that are used in large scale corporate level (or enterprise level) business entities. These applications enable such large multi facade organizations to operate seamlessly across countries and usually capable of handling both B2B and B2C transactions. These applications are capable of operating in a distributed environment and provide multiple ways for clients or other applications to interact with them (i.e. the same application can have a standalone GUI, a web interface and a set of web services exposing selected functionalities.

With the above simple understanding, we can focus on a more organized list of properties for an average enterprise software application.
  1. Complex in nature. I.e. these applications are complex in all aspects (planning, designing, development, data storage and management, deployment etc…)
  2. Extendable and Scalable, Designed in a way that changes to the functionalities can be done easily and quickly.
  3. Secured, reliable and most importantly interoperable, i.e. the application can work with either existing legacy system or another 3rd party software application.
The list can go on, however, you can find good articles in the internet regarding this subject, hence I’m restraining from going onto explaining the nature of an enterprise level application in grate details (actually that will require another complete article ?). Important thing to understand here is that these applications are large, complex and usually will be used to manage the complete end to end business processors of an organization.

In developing such applications, it’s obvious to see the importance of following a suitable software development process and doing software analysis and designing. A good software design and architecture is essential to complete a project of such magnitude successfully. However, there’s another area that is absolutely imperative for the success of enterprise application development, and that area is the application development environment or to be more precise, the Application Lifecycle Management Environment. Most of the times we don’t tend to think about this factor and it leads to lot of issues or complete failures.

Application Life cycle Management (ALM) environment is essentially a collection of tools that enable one or more development teams to plan, design, code, manage builds, test and deploy enterprise level software applications. It automates most tedious tasks and helps to maintain a high standard in coding and documentation. Most of the times, enterprise level applications are developed by multiple teams and ALM provides an excellent environment for them to coordinate their day today tasks. Having said that, I should point out here that the exact set of tools that go into the ALM environment will depend on the software development process you are following. I am a big fan of Agile based processors (specially Scrum); hence, the environment I have presented here will be more suitable for Agile Scrum based software application development. However, it can easily be adapted to suite other software development processors without much effort.

Structure of a typical ALM is given below.



Major part of any ALM is the Continues Integration (CI) of the application you are building. CI is a very important concept in enterprise application development, this allows multiple teams working on the same application project to seamlessly manage the source code and create successful builds every time a commit happens to the SVN server. CI servers will also take care of checking the code for any coding standard violations, and unit tests and the whole process is completely automated.
If you are coming from J2EE background, chances are that you have worked in an CI environment before. Our target here is to port a similar environment for PHP based application development.

Our next article will focus on configuring a fully fledged CI server for PHP. But first, we need to identify the right set of tools. Normally, A CI environment will be configured within a Linux environment, there are many good articles that explain how to do this, however, most of us who are doing development still use Windows as our development platform. And it’s surprising to see how well the windows environment can be used as a CI server as well. So, I’ll be using Windows to show you how easy and quick it is to configure fully fledged CI environment. I’m using the following tools and environments
  1. Windows XP /Windows Vista/ Windows 7/ Any Windows Server version
  2. XAMPP (http://xampp.org/)
  3. Subversion (for Version controlling, server and client)
  4. Hudson (Continues Integration and Build Management)
  5. PHPDoc (http://manual.phpdoc.org/HTMLSmartyConverter/HandS/li_phpDocumentor.html)
  6. PHP Code Sniffer - PHPCF (http://pear.php.net/package/PHP_CodeSniffer/download/All)
  7. PHPDepend (Code Analyzer) (http://www.pdepend.org/documentation/getting-started.html)
  8. PHPUnit - Unit and Integration Testing (http://www.phpunit.de/manual/3.4/en/installation.html)
  9. XDebug – PHP Debugging tools

I’ll use the above tools and few others to configure our CI server in the next article, so stay tuned

Friday, August 20, 2010

Introduction Enterprise Application Development in PHP

In all my years of PHP Application development, one of the major questions I faced is how to properly plan out, develop and manage a large scale PHP based application projects. There was a time not so long ago that evens the idea of using a “scripting” language such as PHP to build large scale applications was only a dream. However, I believe PHP has matured enough now to be used in real life large scale application projects. However, most of us who has used PHP for the past 5 years know that PHP is still largely a functional or procedural programming language. However ability to code in 100% solid Object Oriented concepts is a must if you want to succeed in any large scale application. So, the question of how to properly use PHP to use large scale applications is still largely an open question.

My intension here is to share my own experience with you and to share my views on enterprise level application development in PHP. This is the first of a series of articles that are targeted to provide a wide coverage on this subject. An overview of what will be covered in this series is given below

1. Introduction to Enterprise application development in PHP (This one)
2. Elements and Properties of an large scale application and Application Lifecycle Management
3. How to setup a simple Continues Integration Server for PHP which is one of the major part of ALM
4. Tips to a successful PHP based application design architecture
5. Retrospect

I’m trying to make this a comprehensive learning experience as much as possible. Hence, I’ll be posting real code and command segments on the article. However, please keep in mind that this might NOT be the only or the Best we to develop enterprise applications in PHP, but, it’s another method and a method that has worked for me.

Is PHP enterprise ready? I’ve heard many people ask this question. And truly I believe it is. When it comes to enterprise application development you might think why do we use PHP to develop enterprise level applications? I want to ask you Why NOT? PHP is flexible, scalable, fast ,supports both procedural and Object Oriented programming, has a rich set of inbuilt functions, open source, excellent community support, easy to learn, supported by many high level development tools and IDE’s, and, backed by worlds most renowned web server Apache. So, I think we need to step out of the shell that we stayed for the past 5 or so year, PHP has come a long way since being a simple scripting language and it’s now time to harness its full power and make it a strong competitor in the enterprise level application development arena.

Having said that PHP is not without its cons, one of the biggest draw backs I see in PHP is that it doesn’t have a single governing body to govern and monitor the maturing process of the language. I believe this is evident if we consider the number of frameworks that are available for PHP based programming. PHP doesn’t have a OOP based or MVC based inbuilt API, at its core it’s still largely a functional or procedural language and hence its API is a functional one. This has opened a vacuum that has been filled by numerous none standardized OOP and MVC based frameworks. I think it’s excellent to have so many frameworks; however, the problem is that they don’t honor a common standard. I believe PHP will be a much better platform if PHP’s governing body standardized the OOP and MVC framework structures so people can use them without having to worry about learning a new frame work from scratch from vendor to vendor.

I will not justify or deny the use of PHP in enterprise application further more. If you have read this article up to now, that means you have already decided to use PHP and I’ll take it from there.

Surprisingly, in order to follow this series you don’t have to have a in-depth knowledge in PHP (however, you should have expertise on at least one programming language). The complete Continues Integration (CI) environment will be setup under Windows, although I’m providing you the set of commands, you are required to have a basic understanding on Windows commands and .bat files in order to use them effectively. That’s all we need and we are ready to go.

So keep my blog bookmarked, I’ll be posting the part 2 of this series soon.

Friday, July 2, 2010

Knowledge, IT guys greatest strength/asset?

Whenever I sit in an interview board, one of the most common questions I have heard is “What do you consider your greatest strength or asset?” and almost everybody has answered “Knowledge”. Just last week I was mentoring few interns in my office and I asked them to write what they expected to gather during their internship period and, yes, you guessed it, all of them said that they want to gather knowledge of specific technologies such as JAVA, .NET etc…

So, is it true? is knowledge our greatest strength as IT professionals? In my view this is far from true when it comes to an IT Professional. IT is one of the most volatile disciplines (if not the most) in the world, technologies changes over night, inventions are made hourly (not yearly) and what you know will become obsolete in a blink of an eye. Hence, if what I know will become useless in a matter of months then how can what I know be my greatest strength? The truth is what I know is ALWAYS less than what I don’t know or what I SHOULD know.
What should be my greatest strength then? What should an intern gather during their intern ship in a professional corporate environment? The answer is “learning to survive”; every IT guy must know how to survive in this industry. What do I mean by that? Being an IT guy is just like being Tarzan in the jungle, environment always changes and will always challenge your existence, knowing how to adapt to these changes quickly and addressing the problem at hand is the key to success in this field (that’s how Tarzan survive ). I believe in order to be successful in this industry you must have 3 things. If interns learn to master these 3 things during their internship period I think they will do grate as IT professionals once they graduate. The key 3 qualities are as follows

1. Self Confidence
2. Interest
3. Drive or Will to succeed

If you posses these 3 qualities you can learn any technology, adapt to any environment and handle any challenge this industry can through at you.

Self Confidence is all about BELIEVE you can (not knowing you can). Whenever you are faced with a problem or a challenge, first you should have the “can do” attitude. It will only come if you believe you can. This is the first step to overcome any challenge.

In anything you do, if you want to succeed you must have an interest to do it. Without interest you can’t keep the momentum going. However, we all have our different interests but in my experience if you keep on working on even something you don’t like, you’ll start developing an interest towards it.
Drive or will to succeed is very important because you are bound to fail initially, you must have the drive or will to try and try again.

So, in essence I believe what every one of us should be after is not knowledge but we should learn how to survive in the industry and we should build confidence, interest and drive within us and make them our greatest asset and strength.