Archive for the 'Software Engineering' Category

PHP can scale

Aug 10, 2006 in Software Engineering, PHP

I will keep this post short. I found a presentation about Flickr’s architecture from John Lim’s blog while google-ing for “smarty with yahoo ui”. John Lim btw, is the developer for ADOdb, a PHP database abstraction library…. and it is one of the BEST one out there IMHO. And I am proud that he is a Malaysian. =D



After looking at the 41 slides on Flickr’s architecture… it has made me rethink the way I design web applications. I used to normalize my database design all the way… (thx to uni lectures) but doing that would sacrifice performance as “JOIN” are expensive operations. I might wanna start exploring database session instead of using web server’s session. Replication sounds great as well. 1 master database server for insert/update/delete and a farm of replicated database servers for ’select’, since almost 50% of database transactions are select statements. Anyway, I am just repeating what is written in the presentation, so download and read about it yourself. ^_^



*p.s. but try not to over-engineer… a habit which I do often.

Picking up the pieces

Jul 08, 2006 in Software Engineering, PHP

What is worst then reinventing the wheel? Correcting “SHIT” codes…. -_-”

I am doing this emergency development (or fixing) of a Social Network web application. It is written by someone irresponsible… very irresponsible. He was partnering with this veteran company to develop this project, then all the sudden he stop developing it and got himself out of the partnership and even DARE to request for the rest of the payment. He is already 2 weeks off the DEADLINE.

After examining his work, now I know why he call it quits. He developed a piece of crap. I might sound harsh but it is true. He uses outdated Template engine, and a very old version of ADOdb. The way he architect the application could never be able to scale and meet the requirements of a successful social network. So now I have to fix everything in less than a week…. during World Cup finals’ week!!! This is torturing!!!

Anyway, I have to fix this up. First off… by replacing the ADOdb with the latest stable version. It looks like a Malaysian developed this piece of high quality database abstraction library for PHP. :)

pitAuth:User authentication for CakePHP

May 24, 2006 in PHP, CakePHP, Encryption

pitAuth is a user authentication implementation for CakePHP, ya ya… there are some implementations out there already.. like othAuth, and rdAuth. Although I do support the open source community, I got a company to grow. @_@ I also want to have a more secure implementation.

Drafted feature:

  • “salted” SHA1 encryption instead of MD5 (would probably use more resources than MD5)
  • User can be in one or more Group
  • Each user and group might have one or more permission
  • Integration with CakePHP ACL
  • Generate new password for password retrieval
  • Plugin-ready for LDAP and other method

I will continue to add once I figure them out. The comments on PHP Manual on SHA1 has some useful information on security and improving performance.

PHP full-text search engine

May 24, 2006 in PHP, Full-text Search Engine

After intensive research on full-text search engine for PHP, I found the following solutions if I want to use CakePHP as the main underlying framework.
Utilize Java Lucene by using a PHP JAVA Bridge

This is quite challenging. The performance seems promising, but it does look complicated. Basically we will have to develop the indexing with Java and process input/display results with PHP. Now… will I wanna do that?

Pros

  • You can use a unported Apache Lucene
  • Tons of resources on using Lucene
  • Can upgrade Lucene libraries and use it. Rather than waiting for the ported version to be fix

Cons

  • Complicated
  • Too many technologies to master

Zend Framework integration with CakePHP

The strong point of Zend Framework is the ported Apache Lucene, the zend_search_lucene library. That’s about the only thing I like about Zend Framework, that’s why I might wanna integrate this zend library into CakePHP, this tutorial about using zend lucene looks familiar enough.

Pros

  • Those who used Apache Lucene before will feel like home
  • Lucene IS the best Java full-text search engine out there

Cons

  • Works only in PHP5, CakePHP works on both PHP4 and PHP5. The integration will kill one of CakePHP’s strong point
  • Have to learn another framework. We had enough right?

MySQL full-text searching capabilities

MySQL has a built-in full text search feature. This article here has some information about it. But I would need to write MySQL statements rather than using CakePHP ActiveRecord pattern, and the application would be MySQL database-dependent.

Pros

  • Should be quite fast, since it is a native MySQL operation
  • Can be converted to a plugin for various framework

Cons

  • Will be lock down to MySQL
  • Building a search engine is not a fun task

Xapian using PHP-Binding

Xapian looks promising as well. I think the performance of Xapian should be quite good as it is programmed with C++. I can’t comment much on this. You guys might wanna check it out and probably help me out.

Solr

I just found this a minute ago. Solr is built based on Lucene by CNET Networks who donated the source code to Apache. The unqiue feature of Solr is the XML/HTTP APIs and it is actually a server! So you can have a Java application… a PHP application or any type of application which is capable of handling XML, all of those application can access Solr. This looks like a good solution, but I am a bit worried about the security of transfering XML between servers. I will keep an extra eye on this one.