I dont really like Java, not the languague per se, only her "WEB" stuff, as a PHP developer, PHP has tought me the easy way to create web application. Dont get me wrong, I started programming in Assembler ( i kinda like it, it just make sense!), C, and then C++ with my structures and pointers and memallocs. I started developing enterprice code in JAVA, back then like 8 years ago, i used to do my interfaces in SWT and Swing, yes Desktop Applications. Then one day i decided to learn PHP, like a hobby, I learn it in 8 hours all the necesary stuff including configuring a basic WAMP server. It is so easy!.
¿What about now?
Eight years ahead, my company decided to make a Web application in Java. Damm its so complex, and not in a good way. I mean, all that complexity is just innecesary, but its like fellow Java Developers cant see that complexitiy because they have been brain washed, yes ORM, yes XML for configuring this or that, centralize those files? ha you must be kidding say one of my coworkers, they think its natural to work that hard to spit a checkbox and a commandButton together, something that even when not using a framework its a piece of cake, what a echo can do in a second, i need like 4 classes, one compiler and 3 minutes restarting my server.
The promised futured aeons
And believe me, that complexity, it just keep growing and growing. I heard the reason for this maddness its it just to keep the promise that the maintenance phase of the application in his lifecycle will be easy. How can it be possible?, It just dont make sense!, how putting more complexity in a system is going to make it easier to maintain? What Java Developers needs to comprehend is that LESS IS MORE!, why cant they comprehend this. Maybe its isn't all their fault, after all, Oracle make a lot of investment so you can believe that their products are the best of the best, your boss eat all that cheesse without asking for a different flavor, you must then pay the consequences of a social design pattern, that i call affecionately, the oracle oriented lobbyming.
So PHP is being Javanized, you say
What Drupal taught me is that you dont really need to be crazy about objects , its not the only way to be!.
But after googling identity maps for PHP on google, i just know that we as PHP developers, are being invaded by the Java Way of Live. All the examples for doing identity maps, are just a biased copy of Java. Separating identity maps from data mappers, and creating a ton of more classes just so it can be like the way its implemented normaly in Java. Why cant it be all in just a single class, after all im using the two of them together all the time.
But you can create a Facade Object and unite the two of them, a Java Saviour will say. Nooo hell no, I protest, just mix it all in the same class, make private functions, if you need, and create functions that call those functions that are called togetehr. After all you make a ton of futil getters and setter function, why not put some really useful functions inside it. STOP copying concepts at litteram, and make use of some creativity. Creativity will kill abstraction some day.
Singleton are Evil and other WTF
For example read this article, singletons are evil, they really are making a storm in a glass of water, they can't test a database access singleton, so they want me to use dependancy injection to "solve that problem"? Yes lets put more maneur on the problem, never mind all the instantiation I made before in my code, i will just refactor the hell out of it so i can put a new parameter on the constructor, for real.
They are so blind with their dogmas, they cant see the real problem lays in another realm. Singletons are useful and not using it just because it cant past an unit test, its insanely crazy, we are not programming to pass the unit test, unit test are not out master but our tools.
Maybe its time to change the way I test my singleton i already gave an alternative on the comments), or dont test it at all, its a singleton for god sake!. We tend to forgot that the goal is creating interesting and maintenable software, not appliyng every concept that they sell us, so our software have that "enterprise quality" that will make our brainwashed souls fell safe.
And so it is
And this is only the tip the iceberg, i know PHP is not the best, I am learning Python,just to know his wonders, but i will never freely choose program in Java again for a Web Project.
Just believe my words, in five years "enterprise" will be a pun for complex, boring and , spaguetti like programming, we just started with Struts, now.. Java?