My talk proposal at Confoo 2011 on How to integrate Text Mining into (Web) Applications has been accepted.

For more information on Confoo, please visite their website : www.confoo.ca

PHP Québec, Montréal-Python, Montreal.rb, W3Qc and OWASP Montréal are proud to announce the second edition of the ConFoo Conference. From March 9th to 11th 2011, international experts in Java, .Net, PHP, Python and Ruby will present solutions for developers and project managers the prestigious Hilton Bonaventure Hotel, located in downtown Montréal.

I will be giving a presentation at the Montreal Java User Group (JUG), next thursday at the ETS.

1111 Notre-Dame Ouest
Room A-1300
Thursday the 9th december 2010 at 17h45.

For more info

The slides of the presentation I gave yesterday are now available on slideshare.

If you are interested in knowing more about Text-Mining and how to integrate with your (Web) Applications, I am giving a presentation this week at the monthly meeting of PHPQuebec.

I will present the core notions related to Text-Mining, we will see some of the existing technologies, their features. The talk will be focused on the added value and benefits that Text-Mining may provide to your application.

Date : 13 Mai 2010
Hour : 19h00
Location : École de technologie supérieure, Montréal

More information are available at : http://www.phpquebec.org/modules/piCal/index.php?smode=Daily&action=View&event_id=0000001121&caldate=2010-5-10

Hope to see you there.

Recently, I have been bugged by a new translate bar appearing on the top of my Chrome navigator each time I visit a foreign site. That bar would take an extra line space (Very annoying when you are using a netbook) and I had to click each time on the “X” to close it.

toolbar_chrome1

Usually Google is good with user experience, however in that case I was surprised by that very annoying feature. I would bet I am not the only one who got annoyed by it.

The good news is that with the latest release (4.1.249.1045), you can disable that feature (Why is it enabled by default however ?).

To do that, go to Tools > Options > Under the Hood > Translate and deselect the box next to “Offer to translate pages that aren’t in a language I read.”

popup_chrome

Thanks to Pierrick, some new minor fixes and enhancements have been added to the PHP autoloadManager.

You may find the updated version on github :

http://github.com/alfallouji/PHP-Autoload-Manager

Documentation has been updated also (Please take a look at the README file).

Yesterday, the Confoo conference held in Montreal ended. I had the chance to assist to the three days of the conference.

confoo.ca Web Techno Conference

The presentation slides are available here : http://www.confoo.ca/en/download or you can view some of them on Anis blog.

Thanks to a very good organization, this conference was a real blast. All went very smoothly.

I can’t wait for Confoo 2011 !

So, again I will talk about Singleton and why you should be carefull with them. Everytime I think or discuss singleton the following things come in to my mind :

– Global State;
– Hard to test (refer to unit test post);
– Singletonite (I see Singletons everywhere);
– Violating the Single Responsibility Rule.

I could spent a few pages arguing and / or explaining those issues. Instead of that, I would recommend you to watch Miško Hevery’s presentations.

“Ok great,  I am  convinced. Singleton are bad. What are the alternatives ?”

Let’s suppose we have a class named article, that has a save() method allowing to persist this instance of an article (in a database or any kind of persistency layer).

/**
 * Singletons are my best friends
 */
class article
{
    public $title;
    public $text;

    public function save()
    {
        $storage = storage::getInstance();
        if(false === $storage->save())
        {
            logger::getInstance()->log("Sorry !");
        }
    }
}

$myArticle = new article();
$myArticle->title = 'I love sushi';
$myArticle->text = 'I really do...';
$myArticle->save();

What are the problems with the previous code ?

Well, first you can’t mock the storage object and therefore this class can be hard to unit test. Secondly, the save method has a dependency with two objects, those dependencies are hidden within the save method and as a consumer of this API, you would expect to be able to know what the collaborator and / or the dependencies of a class are without having to look at the implementation of some methods.

So, let’s get rid of all singletons !

/**
 * No Singleton, use collaborators instead
 */
class article
{
    protected $storage;
    protected $logger;

    public function __construct($storage, $logger)
    {
        $this->storage = $storage;
        $this->logger = $logger;
    }

    public function save()
    {
        if(false === $this->storage->save())
        {
            $this->logger->log("Sorry !");
        }
    }
}

// Having to instantiate "manually" the storage and logger
// is a actually a bit a pain
$storage = new storage($param1, $param2, ...);
$logger = new logger($paramA, $paramB, ...);

$myArticle = new article($storage, $logger);
$myArticle->title = 'I love sushi';
$myArticle->text = 'I really do...';
$myArticle->save();

We just need to pass the storage and logger objects into the constructor of the article object and now the article class is easier to test (easier to mock objects).


This is definitely not PHP or IT related but is worth talking about 🙂 The com department of the UQAM (Universite du Quebec a Montreal – Canada) has done an awesome and incredibly popular lipdub video.

This LipDub has been produced during the integration week of UQAM with 172 communication students. It was made on September 10th 2009, the footage lasted approximately 2h15min.

Available on youtube / google video, it is getting more popular every hour / minutes (more than 750k views already) and it is creating kind of a buzz on the web.

They even got an interview on CNN.

Congratulation to them all. As an ex-student of UQAM, I specially enjoyed watching it.

Once again, Thanks Google for their tech talks.

Here is a video from Steve Souders named “Life’s Too Short – Write Fast Code”. This video talks about how to write efficient code and discuss speed optimizations techniques in Web programing.

Steve works at Google on web performance and open source initiatives. His book, High Performance Web Sites, explains his best practices for performance; it reached the top of the Amazon computer and Internet bestseller list. His follow-up book, Even Faster Web Sites, provides performance tips for today’s Web 2.0 applications. Steve is the creator of YSlow, the performance analysis extension to Firebug, with over one million downloads.

(Source : http://stevesouders.com/bio.php)

You can also find his latest book named “Even faster websites” at books.google.com.

Who am I?

My name is Bashar Al-Fallouji, I work as a Enterprise Solutions Architect at Amazon Web Services.

I am particularly interested in Cloud Computing, Web applications, Open Source Development, Software Engineering, Information Architecture, Unit Testing, XP/Agile development.

On this blog, you will find mostly technical articles and thoughts around PHP, OOP, OOD, Unit Testing, etc. I am also sharing a few open source tools and scripts.

  • Trinzia: Well done, my friend! [...]
  • vivek raj: Hello Bashar, It's really good that you wrote this code. but I'm confused some part. can you suppor [...]
  • irfan: I saw watch your youtube talk on clean and testable code. By the way very good talk. I was wondering [...]
  • Mohamed: Hello bashar, I hope you are doing well. Thank you for your hard work, and thank you for sharing [...]
  • alex davila: Hi Bashar is there any pick up example?? Regards Alex Davila [...]