Me
About
Gallery
Company
Girl


Projects
Ruby on Rails
Basecamp
Highrise
Backpack
Campfire
Ta-da List
Writeboard


More
Feed
Archives

November 27, 20:41

The arch-PHP apologists

PHP or Java? by Harry Fuecks commits a discussion in separation. It completely ignores the cumulative effect a world of kludges brings on the programming experience as a whole. He represents the arch-PHP apologist down to the last "but interfaces are possible, if you just..." excuse.

The impressive amount of work arounds for object-oriented constructs in PHP is just that. Work arounds. In all their non-standard, patch-requiring shades of grey. They're not the equivilent to Java's consistent and thorough solution to OOP.

The point is that they don't have to be. It's okay that PHP isn't Java. It's good that PHP isn't Java. It's different tools for different jobs and different types of people. I would never think to recommend Java for web developers just starting out. It's a jungle of standards, open source projects, patterns, and abstractions. That doesn't make Java better. Just different.


Challenge by Harry Fuecks on December 04, 15:17

An "arch-PHP apologist" - great term! I'm going to duck it though - I wasn't attempting to apologise for PHP at all - the article was intended only to be a response to this: http://www.tek271.com/articles/JavaOrPhp.html - where we find statements like;

Feature: Polymorphism
PHP: Not supported. Methods cannot be overridden.
Java: Supported.
Winner: Java.

That simply isn't true. My article was about corrective therapy.

Many pure Java developers examine PHP and ask "Is this Java?". When they discover that PHP doesn't have an "Abstract" keyword, for example, they write it off. In providing answers to those sort of questions, it frequently looks like PHP has to do everything by work around. Therefore, PHP is doomed... or so the theory goes.

Mysteriously though, it's common that PHP applications exhibit the strange behaviour of "actually working". Somehow, throughout this "kludge" PHP manages to defy the laws of code. Projects like eZ publish (http://developer.ez.no/doc/view/index) and extremePHP (http://www.extremephp.org/xpl/docs/) even dare to write complete class libraries in PHP! How is this possible? Because PHP is a language geared to build web based solutions. It's not for desktop apps. Not for immense back office systems. Just for the web. For reasons, some of which could be a PHD paper, on the web, PHP's programming experience is "king".

As an aside, one interesting was this comment to the launch of www.phppatterns.com (http://radio.weblogs.com/0103807/2002/11/27.html#a969)

'I ran this by a Java programmer I know that I have drawn into the PHP world and her comment was "I'd have never even thought to try patterns in PHP" '

Anyway, if you still think I'm apologisng, try this one: http://www.phppatterns.com/index.php/article/articleview/9

Nice gallery you have, by the way. Do I sense an "abstract" PHP dB class in there somewhere?

Challenge by David Hansson on December 04, 16:05

Educating Java programmers and others in the possibilities of PHP is a worthwhile exercise. Claiming it's the holy hammer that'll conquer any web-related nail is not. I felt your article had at least equal parts of the above.

"Actually working" is a very broad definition. Sure, I could build a cathedral out of materials from Home Depot, and claim it was "working", but it wouldn't really be an interesting claim. An application has many important features besides "running". Like maintainability, scalability, and reliability.

Look, I'm not out to slam PHP. I'm currently implementing a variety of patterns, abstractions, and libraries in it. It's surely not as bad as many Java programmers would let you believe. But neither is it an all purpose "king" of web development.

Actually, I'd rather compare it to a springer. It can move across the board fast, but not always in a pattern you can use.

Specifically, PHP is sorely lacking in mature and widely applied MVC frameworks, persistence abstractions, IDEs, testing suites, and enterprise solutions.

Java offers an incredible array of choices in all of those areas. Struts, WebWorks, and Turbine for MVC. Castor, Hibernate, and JDO for persistence. IDEA, Eclipse, and JBuilder for IDEs. Cactus, jUnit, and MockObjects for testing. EJBs and application servers for enterprise.

All of those things are "possible" in PHP. I'm personally working on light-weight alternatives in MVC, persistence, and testing. But I doubt that PHP is the best choice for the job (if you have one, often you don't).

Challenge by Jack Herrington on December 11, 20:12

What I find more ridiculous in the http://www.tek271.com/articles/JavaOrPhp.html article is this section:

Feature - Variable declaration

PHP - The variable is declared when it is created. Its type is implied from the assigned value. A variable can change its type if it is assigned a new value.

Java - Variables must be declared  with a specific data type before usage.

Winner - Java. It is convenient for a small program not to require variable declarations, but for large software, this is harmful. Variables changing their types based on their value are very dangerous in large programs.

This is a common misconception that I'm beginning to think is simply bad education. The notion is that strongly typed systems are somehow 'safer' in the large. It's silly. Strongly typed languages mainly save you from themselves.

As anyone who has worked with PHP (or Perl, Ruby, or Python) for any length of time knows, common sense programming techniques that work for _all_ languages can keep your application reliable and maintainable. Plus, writing in a scripting language faster, and the total code size is smaller. Smaller is better, less bugs and less to maintain.

I've asked some 'strong typing' folks why the think it's a important and at the end of the day the best they can come up with is "it is better because my teacher told me so." I developed for fourteen years in C and C++ and I can't give any reasonable answer for the advantages of strong typing either.

Were I to ask for strong checking in a computer language it would be semantic checking. Something that type checking in no way does.

BTW, the author of the 'comparison' article claimed no experience outside of the strongly typed trinity (C, C++ and Java). Along the lines of the "actually working" comment, the comparison aritcle 'author' never mentioned that any of his Java apps actually "shipped".

Challenge by Manuel Lemos on December 12, 8:00

Regarding persistence abstractions for PHP, you may want to check Metastorage.

Metastorage is a persistence API generator. This means that it generates classes that map objects so they can be stored and retrieved from persistence containers like relational databases.

Since the code is completely generated by a compiler, it is all optimized to avoid the overhead of computing static data at runtime like SQL queries that are indeed constant.

Metastorage uses a XML format named CPML (Component Persistence Markup Language) to define the classes to be generated with developer defined variables, collections, functions, validation rules.

Metastorage uses MetaL compiler engine to generate optimized PHP code. Since it is based on MetaL, it could also generate Java but ironically Java lacks of standard database API that provides key features like database independent primary key generation (auto-incremented sequences) that in the case of the generated PHP code are provide by Metabase. When Metabase API gets ported to Java, there will be a Metastorage version capable of generating Java code too. Same for other languages besides PHP.

As a nice bonus, Metastorage generates automatically UML class diagrams from the XML component definition.

Check it all out at: http://www.meta-language.net/

http://www.meta-language.net/news-2002-12-09-metastorage.html

http://www.meta-language.net/news-2002-12-05-metastorage.html

Challenge by Rod K on March 29, 23:58

A lazy sheep thinks its wool heavy.

Challenge by alex gardo on July 22, 12:42

Metastorage is a persistence API generator. This means that it generates classes that map objects so they can be stored and retrieved from persistence containers like relational databases.

Challenge by sirena on July 22, 12:43

Metastorage uses MetaL compiler engine to generate optimized PHP code.

Challenge by Mark Lewis on October 29, 22:15

This is in response to the comments by Jack Herrington on strong typing. First, we should be clear of the difference between strong typing and static typing. Strong typing implies that the type system is never violated in a run and attempts to do so crash the code. Static checking is when the compiler returns syntax errors for improper typing. C and C++ and not strongly typed, but what typing they do is statically checked. The fact that you can cast anything to a void * and back to any other type in these languages is evidence of that. Java is strongly typed and does significant static type checking.

Jack states that type checking is not semantics, but it obviously is. The types of expressions imply something about their use. To view this a different way, types are not part of BNF language syntax descriptions. They are part of the static semantics.

As for why both strong typing and static typing are good, they allow you to have a proof of the correctness of at least some part of the semantics of your code. It's not a full proof, but at the very least, static type checking provides proof that some fraction of the intent is correct. Without it you lack proof that any part of the program is correct. Strong dynamic type checking doesn't give you proof, but it does turn logic errors into runtime errors. Similarly, static checking turns runtime or logic errors into syntax errors. We all know what types of errors are easiest to find and fix.

For a good comparison of the extremes in this look at Scheme and SML. Scheme is completely dynamic in it's typing. There is no static type checking so a "compile" phase reports almost no errors unless you have unbalanced parentheses. SML on the other hand is one of the few languages that statically checks the type of everything. It is also functional and allows you to do all the things Scheme can. However, the strong and static typing turns a large number of errors into syntax errors. Jack might even like SML (or its relative O'Caml) because the user rarely declares the types of variables or functions. Instead the language infers it.

Challenge by alan on June 04, 12:11

Hi. This is my links.
mature nudists photos mature spunker lyrics to older country songs south indian mature women mature living mature gallerys mature nud3 pics south indian mature women mature anal mature bitches south indian mature women mature nudists photos older s3xy women mature video mature nudists photos mature nudists photos mature spunker mature spunker mature spunker mature women stories mature video mature ladies in lingerie mature bitches mature ladies in lingerie mature gallerys mature nudists photos mature nud3 pics classic mature mature amature older s3xy women mature anal older moms free naked older women older s3xy women mature video mature amature older women and younger men free naked older women mature women stories older women and younger men

Challenge by nik on June 05, 9:34

Hello. I am new here. It is very interesting.
free creampie s3x free creampie s3x latina creampie creampie pic creampie movie interracial wives bareback creampies free creampie s3x creampie anal pictures creampie creampies xyx creampies free latina creampie interracial wives bareback creampies latina creampie creampie p0Rn creampie pussies pictures creampie creampie pic free creampie pics free amature creampies free anal creampie pics creampie anal creampie pussies creampie internal, cumshots creampie cum and amature creampie anal asian creampies pictures creampie creampie pic creampie cum and amature gangbang creampies videos creampie pussies creampie internal, cumshots asian creampies free creampie pics and stories free anal creampie pics creampie internal, cumshots creampie anal free creampie clips free creampie clips

Challenge by nelly on June 05, 21:24

Hi. This is my links.
pictures of men wearing pantyhose pantyhose links.com mature pantyhose pics men caught wearing pantyhose free panty movies young teens in bra panties pictures of women in crotchless pantyhose men caught wearing pantyhose free panty movies pictures of men in pantyhose free pantyhose thumb galleries free pantyhose thumb galleries visible panty lines pics pictures of women in crotchless pantyhose leggs pantyhose young girls in panties mature pantyhose pics nonnud3 teens in pantyhose pantyhose links.com cheerleader panty pics panty fetish free panty movies satin panty galleries leggs pantyhose used pantyhose free pantyhose thumb galleries nonnud3 teens in pantyhose young girls in panties leggs pantyhose pictures of women in crotchless pantyhose young teens in bra panties leggs pantyhose teens in panties free links cheerleader panty pics men's pantyhose free pantyhose thumb galleries pictures of men wearing pantyhose panty fetish mature pantyhose pics pantyhose links.com

Challenge by alex on June 06, 1:11

Hi. This is my links.
1ncest free pictures stories 1ncest 101ita young 1ncest pictures true 1ncest stories teen 1ncest er0t1c stories 1ncest 101itas 1ncest free pictures stories 1ncest sites free family 1ncest stories free family 1ncest stories 1ncest xyx teen 1ncest er0t1c stories 1ncest xyx 1ncest sites free 1ncest story 1ncest 101ita free 1ncest mpegs 1ncest gallery 1ncest 101itas free 1ncest story 1ncest 101ita 1ncest daughter granny 1ncest 1ncest daughter 1ncests free 1ncest mpegs mother son 1ncest pics 1ncest 101ita granny 1ncest 1ncests 1ncest daughter teen 1ncest er0t1c stories 1ncest 101itas teen 1ncest er0t1c stories 1ncest mother son 1ncest gallery 1ncest sites granny 1ncest 1ncest 101itas 1ncest thumbnails

Challenge by mary on June 06, 11:32

Hello. I am new here. It is very interesting.
older 1esbians mature big tits mature nudists free older women galleries mature pic gallery older holland older 1esbians mature nudists older holland thumbs gallery older women older women stories older women stories older holland older women stories free older women galleries how to meet older women mature pantyhose pictures mature pantyhose pictures older 1esbians older black women mature women over 40 older holland mature women over 40 mature hardcore links older 1esbians mature women over 40 young girls older men older black women mature women over 40 mature pic gallery mature big tits how to meet older women mature asian women mature big tits black older ladies mature big tits free older women galleries mature glamour naked old women thumbs free older women galleries

Challenge by atmor on June 08, 0:29

Hello. I am new here. It is very interesting.
satin panty galleries panty fetish satin panty galleries satin panty galleries celebrities in pantyhose satin panty galleries panty fetish white pantyhose pantyhose images panty thumbnails panty fetish mature women in pantyhose men's pantyhose mature pantyhose pics panty thumbnails office girls in nylons mature women in pantyhose panty fetish mature pantyhose pics winnie-cooper pantyhose panty thumbnails pantyhose images men's pantyhose celebrities in pantyhose girls in nylons white pantyhose hooters girls in pantyhose men caught wearing pantyhose panty fetish cheerleader panty pics office girls in nylons pantyhose images free wet panty white pantyhose free wet panty men's pantyhose satin panty galleries free wet panty wet pantyhose men caught wearing pantyhose

Challenge by nik on June 08, 4:33

Hello. I am new here. It is very interesting.
men in panty pics teen panty pictures wolford pantyhose shiny pantyhose wolford pantyhose mature women in nylons pantyhose pic gallery pantyhose pic gallery pantyhose men silkies pantyhose wolford pantyhose free panties free panties panty line pics pantyhose foot gallery pantyhose men panty line pics panty girls free pantyhose pics teen panty pictures teen panty pictures teen panty pictures pantyhose fetish bra and panty pics shiny pantyhose crotchless pantyhose men in panty pics men in panty pics men in panty pics wolford pantyhose panty girls free panty galleries shiny pantyhose mature women in nylons pantyhose pic gallery panty line pics free panty galleries shiny pantyhose wolford pantyhose free pantyhose sites