Saturday, May 24, 2014

Mind switch

Switching from PHP to Java is awesome and painful at the same time. Awesome, because I can see the cleaner code, painful, because a lot of things, that PHP (and C#) allows and I got used to it, is now harder to do and process in my head.

But it also works the other way around. Now I can see some practices in PHP are not as great (or safe) as I thought. I already learned to keep warn level up to E_NOTICE and kill'em all. That means initialize variables. It's more code, but it's also more predictable.

This time I turned back to PHP and I can see why the object model used to be so exaggerated - because in compiled langs doesn't matter how many includes there are. In PHP each include takes time (I/O) and therefore you should use merged/joined/minified version in production. If you try to keep the project the same accross different platforms, you always should stick with the rule of Java, where each public class has it's own source code file.

No comments:

Post a Comment