Web/database development and more...

Pages: << 1 ... 7 8 9 10 11 12 13 14 15 16 17 ... 59 >>


PHP Variable names, Member names, Class names

  19:37:16, by fplanque   , Categories: PHP

I have just extended my PHP coding standard guidelines with these rules about variable naming:

  • Remember this is PHP, not Microsoft Visual C++. There is actually little value in naming variables something like strFullTitle . Something like full_title is definitely enough and much easier to read!
  • As an exception to the previous rule, we'll preferably prefix private or protected member variables of a class with an underscore as in _full_title. This serves as an easy reminder that the variable is not designed to be called in any other ways as in $this->_full_title .
  • Class names should start with a capital, as in Book .
  • Variable names should be all lowercase, as in $title = 'A brand new day'; except when they are object references as in:

    $a_Book = & new Book( 'A brand new day' );
  • When naming object references, always end their name with the name of the class as in $a_Book or $another_Book instead of Book_to_read for example. This allows to easily search & find all calls to a given method of a given class. You could for exampel easily search on this string: "Book->get_title(" .


Adobe engloutit Macromedia: pas glop!

  16:36:54, par fplanque   , Catégories: IT business, Media Web, Multimedia

Si vous avez un job en rapport avec le web et que vous n’êtes que modéremment-ou-pas-du-tout catho, il y a eu un évènement ces derniers jours qui risque d’impacter votre futur légèrement plus que l’élection d’un nouveau pape: Adobe s’est mis d’accord avec Macromedia pour les racheter

Il y a une FAQ à propos de ce rachat, pleine de formules ampoulées, de langue de bois et de blagues tellement énormes qu’on a du mal à imaginer qui peut y croire. Exemple:

Are there areas of duplication in product line? […]
[…] The companies are largely complementay, and thus the amount of competition between us is limited.

Pas de compétition entre GoLive et Dreamweaver? Pas de competition entre Photoshop/Image Ready et Fireworks? Mais bien sûr…

Ce qui commençait vraiment à titiller Adobe c’est qu’après l’écrasante domination de Dreamweaver sur GoLive, Macromedia Flash commençait vraiment à faire de l’ombre à Adobe Reader dans le domaine des contenus web propriétaires, pardon: “riches"! :crazy:

Ca me rappelle une histoire où Macromedia engloutissait Allaire parce que leur petit produit de complément – HomeSite – faisait de l’ombre à leur DreamWeaver et où leur plus gros produit: – ColdFusion, alors leader sur son marché – a été relégé au second plan (pour ne pas dire “euthanasié") car il ne faisait pas partir de la stratégie de développement de Macromédia.

Rappelons aussi qu’à ce jour, DreamWeaver MX 2004, même s’il est très bien et qu’il a évolué suite au rachat de Allaire, ne remplace toujours qu’incomplètement HomeSite/ColdFusion Studio dont une vieille version qui n’évolue plus vous est gracieusement offerte pour tout achat d’un Dreamweaver…

Résignons nous: si les actionnaires acceptent de se faire manger ainsi, on peut se préparer à pas mal de remous sur le player Flash, et surtout on peut d’ores et déjà ranger nos Fireworks au musée des produits disparus. Pour Dreamweaver, je ne suis pas encore très sûr si ils oseront… mais franchement, ça me déprime de penser qu’on risque de se retrouver contraints à GoLive, faute de mises à jour du vieux Dreamweaver qui nous sera gracieusement offert pour tout achat d’un GoLive à jour… :’(
Mise-à-jour: A lire également: Translation From PR-Speak to English of Selected Portions of Adobe’s ‘FAQ’ Regarding Their Acquisition of Macromedia


PNG alpha transparency in IE

  18:25:39, by fplanque   , Categories: HTML & CSS

Here are a few solutions to the same old IE/PNG issue, all revolving around the same hack: using JavaScript to replace IMG tags containing PNGs with a SPAN or a DIV into wich the PNG is filled using the IE proprietary AlphaImageLoader image filter.

It works... in a very disgraceful manner (try it with 200 PNG icons on the same page!)... and I don't think it degrades correctly to the ALT text display if images don't get loaded for some reason. (Not to mention CSS side effects an the rest which is usually documented along with each hack).


The illusion of DataBase Abstraction Layers or Classes

  10:08:14, by fplanque   , Categories: b2evolution, Bases de Données

Many people think that DB abstraction is cool. I get emails about this topic all the time. People suggesting we add a DB abstraction layer to b2evolution, or offering to do so themselves.

So why haven't we added one yet? Well, simply because DB abstraction doesn't work! :!:

DB abstraction layers will mostly hide the specific interface semantics between the application and the database. Thus you don't have to worry about the specific system call to connect to each particular DB. OK nice. So what? That's only the easiest part in porting an app from a DBMS to another... (BTW, we use a class (/evocore/db.class) in b2evolution for this too. You just have to slighlty alter this class if you want to connect to another DBMS than MySQL).

More sophisticated layers will also translate between different datatypes from one DBMS to another. But since datatypes tend to standardize among all popular DBMSes this is getting less of an issue as time passes by...

Finally, we get to the point where it hurts: the SQL syntax! There are vitually no two DBMSes that share the exact same SQL syntax, except for the most basic SELECT, INSERT, UPDATE and DELETE statements! >:-[ And it doesn't seem to be standardizing really... some still won't support even the minimalistic SQL 92 standard! >:XX

Just check it out with your 2 favorite DBMSes:

  • How do you perform a LEFT OUTER JOIN?
  • How do you concatenate columns into a single result string?
  • How do you limit results in the WHERE clause to a regular expression?
  • How do you handle the fact that when you INSERT and the primary key already exists, you want to UPDATE instead? (MySQL's REPLACE INTO syntax...)?

These are just a few common examples, but they're probably already enough to show you why you DB abstraction layer won't magically translate from you first favorite DBMS to your second... You'll have to rewrite many queries too... and sometimes you won't find equivalent functionnality (subqueries?) and you'll have to write extra application code...

Not to mention triggers and stored procedures where you wouldn't even dare to dream about some kind of compatibility.

The most advanced DB abstraction I have ever worked with was ODBC. Yes that thing actually did SQL syntax translation! But it depended on specific drivers to implement translation against a standardized syntax defined by Microsoft.

So today when I see some open source library pretending to perform DB abstraction and I can't find anything closely related to SQL syntax translation, I won't even consider it... It's useless to me. The real difficulty with handling multiple DBs is rewriting the SQL queries, triggers and stored procedures... it's not connecting to yet another fancy DBMS and SELECT 'hello'... |-|


There's more than the code...

  22:26:51, by fplanque   , Categories: IT business, Développement, b2evolution, Open Source, Software engineering

Oh well... I think it's been too long since I last read some great wisdom like the one on Joel on Software.

I read this really insightful peace today about all the important things beyond just the actual software code.

Here's a funny quote:

Human emotions can be really, really superficial. In particular people ridiculously overvalue aesthetics and beauty when evaluating products. It's one of the reasons iPods, and, for that matter, Keanu Reeves, are so successful.

...but the whole article is definitely a must read!

Of course, this so much applies to b2evolution as well... :-/

Pages: << 1 ... 7 8 9 10 11 12 13 14 15 16 17 ... 59 >>