Automagic Platforms

Few years a go, Ruby on Rails (RoR) start shinning because it was only framework able to speed up the Web development with a set of all-in-one tools. As Java experienced programmer and architect, I’ve to recognize that the RoR team made their point. I still remember that video with a guy with a lot of jars on top of a table (check it here) that made me LoL for a while -an awful truth. Now we have a lot of solutions that offers similar out-of-the-box scripts and frameworks that build code as RoR does -the fancy but power/useful scaffolding, the code generators, and others. Few of them:

The list could be huge, but the main point is not to check them all but to provide few tips to start a Web-based project and choose the right tool.

The .NET and Java mistakes
I do love Java, I’m a fan-boy of JEE technology and portability but, I’ve to say, even if it hurts, Java is a huge rock. It means you need to have a huge infrastructure, a huge processing capacity and a lot of tools to start a JEE project. Why? Let’s face it, you need more than your imagination to start a project and it isn’t easy nor cheap to find a great hosting solution, to properly setup an environment for development (with sandbox and preproduction/test environments). Even if your project is really small it is a good idea not to have the test environment on the developer computer -I hope you don’t think this is a joke, it happens ALL the time.

So, instead of being easy to start with a basis, you have to deal with complex configuration problems -it is good to have all those options if you are on a banking/financial project with a couple millions as budget, but in a real economic-crisis world you should look for “point-n-shoot” solutions -if you know what I meant.

The Apache Friends
So you have a lot of alternatives on the Apache HTTPD side, with PHP (the popular), Perl (the bad cousin), Python (the genius), RoR (the cocky brother) and all others.

I’m not a scripter guy, the compiling hell is for me but, the simplicity shows us that you don’t have to deal with complexity all the time for Web projects. So, give non-corporate-supported technologies a chance. It was hard to me, but they worked faster and cheaper than expected -there is not measure to say better. It is cheaper to create a top-class development and testing environment and work with remote teams if you use open solutions -not necessarily open source. It is not all about the language you love, the server you own, the database that rules the world. It is about cost, simplicity and efficiency. It is easier to get/hire great developers on these tools than for Java – .NET is for chickens and everybody knows it (check this article if you do not believe me). Software development is not about coding, is about solving, that’s what Microsoft doesn’t understand. They code a lot but they do not solve too much, right? You should notice since Windows 95 and the coming of the Blue Screen ERA!

The Automagic
Before I became a senior developer I worked migrating some applications from Oracle Forms and PowerBuilder to J2EE -we used to put a horrible 2 in the middle few years ago. And those tools were great for the task they were created. So it took almost a decade to have those tools on the Web -and they do not work as fine as those mentioned. However, the Automagic isn’t new at all. ActiveRecord exists since, I don’t know, the Z81 maybe? He He He!

So now we have tools that reverse the database and create ORM models, pre-formatted pages and objects that speed up -years- the development. So you can concentrate in other IMPORTANT STUFF like, User Experience (UX), Information Architecture (IA) and the forgotten design.

The generated code is clean as possible (I remember the JBuilder and its generated & encrypted code). And this is thanks to the separation of concerns and excellent pattern implementations – the commonly used for the Web is the MVC supported with other ones like ActiveRecord and IoC, but you can find a whole universe on each platform and framework – I do have an old poster of J2EE patterns as wallpaper for example!

The Verdict
Before fan-boys appears into the scene while you are deciding what platform should use, please take a look to the ones you probably will not look at -don’t waste your time with .NET :-) . During these 7 (should I said 8?) years working on Web development I’ve noticed that only big companies uses robust (slow development) platforms like Java and .NET -by big  companies I meant with more than couple billions of dollars on their budgets. They spent a lot of money in servers and infrastructure and ironically most of the time they use always versions old versions of platforms, servers, databases and all. So even if they spent a lot of money they cannot move as fast as it happens with the technology. Microsoft still produces Adobe Flash banners right, even if they have their own Silverlight. And it also happens with JavaFX. When you develop Flash components some companies still requests Flash 6 or 7, when we all know that we have version 9 and 10 running on most of the computers on the web. But hey, they want to be sure and even those computers that are off since 1995 can see them! – why?

Before you spent more then 6 months working on a project without a single release -could be a partial one, but functional- keep in mind that probably it will take other 6 months before you see the product/result you are expecting. Automagic means fast, so I hope you do not spend more time thinking on if you should or not, and how, than coding… Otherwise it will demostrate my point :-)


Facebook & CodeIgniter – Definitive Guide

I spent more hours than the expected starting a simple development for a new Facebook application that runs on top of CodeIgniter. First I read A LOT, then I checked for solutions and, of course, I read a little bit more. After several hours reading and coding I knew it wasn’t good at all so I decided to start a new integration method from the scratch using only the code I found as guide. Here’s the result:

0. Environment

Before you get excited just review a few things before spent time reading another useless post :-)

  • PHP Version 5.2.6
  • MySQL 5 (It doesn’t affect Facebook integration at all but it is good to know)
  • HostMonster is my hosting provider (it is not a marketing initiative, just they have a nice environment set up for PHP)
  • Facebook platform 5 – I upload a copy of it to ensure you get the same copy I used.
  • CodeIgniter 1.6.3 – latest version available at the time of this post.

1. Do not hack CodeIgniter

I found a lot of solutions about hacking CodeIgniter by overriding functions or classes. NO, YOU DO NOT HAVE TO DO IT.

2. Install facebook library as plugin

  • Download the facebook platform ZIP
  • Unzip the files wherever you want -outside your Code Igniter application
  • Copy the WHOLE content under /php folder (under means files inside the folder and not with the container folder) to yout ./system/plugins folder inside Code Igniter application -Note: Yes, you have to include the jsonwrapper folder.
  • Rename the facebook.php file to facebook_pi.php

It is done! You already have installed facebook framework as plugin.

3. Autoload facebook plugin [optional]

To avoid the need of including the “load plugin” sentence inside every controller/class you can modify the ./system/config/autoload.php to include facebook plugin as required. It is almost a requirement for Facebook applications. Add to your $autoload['plugin'] array the facebook plugin. It could look like this:

$autoload['plugin'] = array('facebook');

Note: If you skip this step you will have to include the following line every time you need facebook functionality available.

$this->load->plugin('facebook');

4. Setup your application [updated]

Update your configuration file and set the ./system/application/config/config.php and change it as follows:

$config['uri_protocol'] = "PATH_INFO";
$config['base_url'] = "APPLICATION_URL";

Note: If you want to test your application locally, you can set base_url to http://127.0.0.1/path_to_your_app/

5. Extend your Controller class

Because I’m building a 100% facebook application, all my controllers require facebook API available. So I decided to extend my main Controller class as follows – BTW: By the date of this post the CodeIgniter documentation WAS WRONG about how to extend the core classes (CodeIgniter User Guide Version 1.6.3 – Creating Core System Classes). It is not true -i.e. it is false- that you have to extend the CI_ClassName. At least it didn’t work for me at all. Extend the ClassName directly.

Facebook Controller class should be placed under ./system/application/libraries folder.

Filename: XX_Controller.php (where “XX_” is the prefix you set on your ./system/application/config/config.php file – subclass_prefix parameter)

class FB_Controller extends Controller {
 
	// Facebook application key
	var $API_KEY = 'YOUR_API_KEY';
 
	var $facebook;
	var $uid;
 
	/*
	 * Custom Controller constructor.
	 * Adds Facebook support.
	 *
	 */
	function FB_Controller() {
 
		parent::Controller();
 
		// Authentication key
		$secret = 'YOUR_SECRET_KEY'; 
 
		// Prevent the 'Undefined index: facebook_config' notice from being thrown.
		$GLOBALS['facebook_config']['debug'] = NULL;
 
		// Create a Facebook client API object.
		$this->facebook = new Facebook($this->API_KEY, $secret);
		$this->uid = $this->facebook->require_login();
	}
}

Note: Inside the facebook application I built I always require an authenticated users, so that’s why I do have the require_login() call. However you can also validate if the user already have the application added. You should do this manually inside controller classes because there are a few exceptions where it is needed that user is authenticated but without adding the application.

6. Create your own controllers

Now you can extend your controllers from your Custom Controller. Note: You do not have to add any include or require sentence in your other classes, CodeIgniter will load directly your XX_Controller.php file -if it doesn’t load please check the config.php file and validate the subclass_prefix parameter.

Below you will find an example of a Controller that will validate if the user has the application added in his/her profile.

class Welcome extends XX_Controller {
 
	function Welcome() {
 
		parent::XX_Controller();
 
		// Check if the application has been added by the user
		try {
			if (!$this->facebook->api_client->users_isAppAdded()) {
				$this->facebook->redirect($this->facebook->get_add_url());
				return;
			}
		}
		catch (Exception $x) {
			// Clear cookies for your application and redirect them to a login prompt
			$this->facebook->expire_session();
			$facebook->redirect($this->facebook->get_login_url());
		}
	}
 
	// You should place your Controller's methods below.
 
}

7. Get out and celebrate

CodeIgniter is running as cleaner as you expected and Facebook API was included nicely!

I hope you find this post useful as I said at the beginning.

  PHP Client Library (34,3 KiB, 2.935 hits)


The interactive agencies that develop software

From creative to coders

Do you believe that the cold war has ended? If yes, it is because you don’t work in an interactive agency (a creative agency that produce a kind of interactive software) or in a web development company (a software development company that delivers creative content via Web).

Agencies are internally informal companies -but serious companies of course. Agencies fight with their PMs to keep their projects running without concern but at the same time, are permissive with their creative teams because they know about the free-sense of the design process. I’m pretty sure no body told God that he has to end the world creation by the seventh day EOD (end of day). Creation/Creative is related to the feelings and passion, and we all know they cannot be scheduled. However it doesn’t mean that creative process could take whatever it takes, it means you need trained team members to understand the business model.

Developers are the creative nemesis. Probably, developers are persons that will want to have their life planned, or at least under control. They (should I say we?) want to reduce the risk and be a step ahead of the opportunities and treats. Why they don’t like designers? It is easy as this sentence, designers -for interactive agencies/web development companies will not deploy their deliverables to the client. Developers are forced to takeover the designers outcomes and create real applications or products. So, at the end of the day, how will carry the whole pressure? Who will have to understand the client needs and the designer approach to deliver the expected result?

So, what happen when you came into a company where developers and creative are working together? A lot of things could happen, but the most probably will be a formal and tangible separation of the teams. The cold war has begun and the PM will have to deal with it as a double agent.

Below some tips for those who has to deal with this.

  • Designers are not coders / Coders are not designers. Are you or your senior management considering this option? Are you crazy? Designers are guys with an open mind -they have to. They should bring light when nobody else can give you a little spark. On the other hand Coders are those guys that do not create a square but resolve your needs with success. One thing is about create from scratch, other thing is to use the tools to deploy solutions -languages, frameworks, and formal products. Keep it as it is. Do not reduce costs using a CODEsigner, a coder that knows how to use Paint IS NOT A DESIGNER. There are few Titans that will walk between these two worlds, if you have them, lucky you!
  • Define with the senior management the business model. It could be whatever it be, that address your company needs. However, take a look to the ones I present below
    • One team, one soul. Bring developers and designers to work together. Push them as a unit, make them feel as all are involved. Most of the time, agencies give creative designers flexibility that will cost long nights for developers, while Software companies will reduce more than needed the importance of their work resulting in motivation issues and poor creative design quality. As PM you can get involve and takeover those team members (I don’t want to use the word resources) avoiding those situations. Get time to know the creative process, push them since the beginning -the most part of the creative guys will be lazy at that phase. Measure their time, keep the whole team under constant medium pressure to avoid relax/stress situations. Once the team get used to it, the pressure will not exists more than in their own minds and desire for deliver.
    • Providing code development. Developers can be providers for creative. Offshore teams will work great with this approach. You will reduce the risk at development side. However you probably will have to spend more with your team leaders. If those guys are not like the Musketeers -all for one and one for all- you are lost. Provider model will give you some freedom within the teams but during integration process you will need real experts to avoid technical/creative issue or change.
    • Providing creative assets. This one is my favorite. Let creative do their work -whatever it is, they do it and developers will not be involved. Set unmovable dates for delivery and let your coding team use those assets. Be formal during the assets’ specs definition. Do not let creative set the dates, be a extra formal PM. With some time you will get the enough experience to understand why creative ask for a lot of time and do their work in a quarter of that.
    • Limited creative. The most amazing hit from coders was to create the templates. Templates are great!, they give the designers enough freedom to make their changes, but not too much to screw everything. Templating if possible is the greatest solution. Your coders will have time to do their work and will share with the designers the integration responsibility. -Of course, this is not the case for the most of the agencies, they will feel your are cutting out their freedom and they will say: “Our strength is our creative freedom“, so you will have to sell this idea.

Modeling business needs for software projects

One of the most complicated things in the whole word is to get the business needs that will drive a software project to address or support a company strategy. This whole science has been supported by a new company role named Business Analyst. This person could be the hero or the villain, depending on how happy is the client and how clear are the requirements gathered.

First, you have a nice client -keep in mind you should be starting a project and everybody is happy; you as a provider, are a kind of new toy :-) -. Most of the times clients are confused about their needs or have a lot of needs that are not properly presented to the provider -this could be extremely dangerous. On the other hand you should have as designer/business analyst a team waiting for your directions. So how you deal with this pressure and ensure a good project start? I present you five points that could be helpful.

  1. Customer is always right! NO, NO, NO, NO. Have you ever seen a woman with a lot of money in a new useless/stuffy store? A little boy in a candy store with 100 dollars? Ok, first of all, bring your expertise and experience, be the mentor of the client, give them what they want but take your time understanding the root causes of those needs. Pay attention to the client, how he/she/they communicate the needs.
  2. Spend time with your client to know their needs. This is a common item, if you want to know your client needs, you must spend time with them, not in meetings but good quality time -I hate the meetingitis syndrome.
  3. Bring help. At this point you should be thinking “I’m the man” and your boss should be thinking the same -probably because they don’t want to pay more. However, any doubt during the business needs gathering process will mean hundreds or thousands of hours wasted because that little misconception. There is a lot of ways to bring help, thought expert consultants, through team empowerment -from client and vendor teams- and my favorite: from the community (geek Internet knowledge community -they are not always right but probably will have a lot of help and feedback for free!.
  4. Share with all (the Wiki model). As certified PMP I know that the key of the leadership is communication. An effective way to delivery quality design documentation -for example, business use cases, use cases, interaction diagrams or even the hated wireframes (a horrible invention of something that is not similar to reality but should represent it… in some how!) – is to involve the team since the beginning. My personal recommendation, use a Wiki software to share with all in a simple way -Does Wikipedia the biggest online dictionary sounds familiar? Do you know you can participate too and improve or add your own definitions?
  5. Be formal. The previous point was about to share, but you cannot post a letter or send an email every time you have an idea or new requirement defined. Be smart, be formal, keep in mind your work is not only about define needs, is about defined the correct needs in a clear way. So my suggestion is: do not reinvent use templates, spend time customizing your owns or check in the company records. Let the team participate but keep the power and control. TIP: good templates can be found at ReadySET for free.

There is a lot of knowledge that you can use, share and improve. Projects are not always the same, clients are not always the same, success not only depends on how good/excellent you do your work but for sure, you are reducing the risk and increasing the chances to be a hero.