After I have written and DEMO'd the code...
I finally finished writing the several thousand lines of Python code, interspersed with HTML and CSS .. and provided my bosses with a very nice DEMO of what the app does... needless to say, the app was running on our intranet - off my machine, which was partially converted into a Server Node on out intranet...The bosses loved the app, they loved it so much, in fact, that they wanted it "out there" for the world to use!
Writing a web app in PHP is hard...
So, after writing all that awesome code in Python, it was time to start hunting for a new web provider which allowed Python 3 code ... none were forthcoming, and my bosses didn't like the idea of moving our website to a different provider ... so it was back to the drawing board ... to rewrite the entire thing in PHP ...Well, PHP is not that hard ... when you know it...
In the defense of PHP, it's not really a hard language to master ... sure, there are a lot of functions, but nothing that is too insane to handle .. mostly, it's quite easy to learn and master ... but to write several thousand lines of code is another thing entirely.
I started by learning the basics - how to get it running on my Apache installation, how to "secure" the feature set... how to write the actual code, then it was time to slice the workload into pieces...
Understanding the concept of PHP is not too bad...
It took me a while to get my head into the concept of PHP - calling functions right inside the HTML code, functions which return more HTML ... with Python, you formatted the code as you went ... with PHP you formatted your page, and plugged in the function calls you needed at the end ...
Once I got this distinction into my head, it was easy to implement the functionality needed to get my code running the way I wanted it to...
The most useful function in PHP
The most useful function I have come across in PHP is the "include" statement... not only does it give you the option of including HTML source, it allows you to use one "header", "footer" or source file all over your site ... this has by far saved me the most time. Of course, my Python was as modular as I could make it, but the idea of including a "header" file, or a "common html" file eluded me because it required me to write code to get it done ... in PHP this is already done for you so when you become aware of this feature, you start using it as second nature.
In conclusion...
In conclusion, I have to say that PHP is awesome, it simplifies several issues I have been having with Python, and it is blazingly fast ... Python is also pretty nifty when used right, but it costs you more complex code and several optimizations to make it as fast as possible ... in PHP one can write lazy code and still get away with a huge speed benefit. I must admit, that the learning curve is not as simple as I make it sound, but I can vouch for how much simpler it is to learn PHP than it is to learn Python ... probably because the syntax is so similar to Javascript and C++ ...
All in all, I have already ported 90% of the project in about a month ... and the original App took me three months to write. And, this time I'm not dedicating nearly as much "zone time" to it as I should.
Comments
Post a Comment