Skip to main content

So, after writing my several thousand lines of Python....

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

Popular posts from this blog

A few thoughts on Game Development

For those of you who follow my blog, you'll notice that I talk about building games, but I never really release anything useful or fully playable. I'm more interested in studying the individual parts of game development, without really caring about building a game as a whole. Well, for the most part this is perfectly acceptable, as I'm not a game developer by trade, and my bread and butter comes from being a utility developer. I've defined utility developer as someone who codes a variety of things without specializing in any specific discipline. As a self-taught developer, it's been hard for me to pivot into a role where I'm classed as a game developer by trade. This is all good and well, but I still want to talk about game development as a whole - specifically how to get a game off the ground. If you've been following any blog about game development, or any programming course which walks you through the process, you've most likely heard of all the jar...

Typescript is Hard

So, for a work-project, the language choice handed down by the Overlords-Of-Jobbing has been TypeScript. You see - where I work, we build websites, and we build the infrastructure to support those websites. We also build platforms to support the website-supporting-infrastructure . . . so we like to iterate quickly and be as agile as possible in our workflow. For the current clientele we're servicing it has been decided that TypeScript on the Babel toolchain would be the most productivity-boosting language we could use, and as a result I've had to learn this new-fangled language with all its idiosyncrasies. Now, TypeScript is awesome, it supports both static and dynamic typing, lambdas, the entirety of JavaScript and all the associated libraries and frameworks which come with JS. TypeScript is awesome. TypeScript: - will mend fences - paint your garage - spay your cat - neuter your dog - rent Clerks II on DVD - run you a nice hot bath after a long day But, the m...

Python Game Development is hard....

I've recently been able to wrestle time away from frantically busy days to pick up Game Development again - it's not the Console game development that's been ongoing for a few years now, no - it's just a simple prototype using PyGame. PyGame is quite a feature rich and mature library, allowing Pythonistas to enter into the world of graphical game development using SDL and OpenGL if they so choose. Using PyGame is incredibly easy, and it takes only a few minutes to get a basic prototype up and running. Performance suffers if one does not read the docs and cache whatever is needed, as memory allocation remains fairly slow on most computers - especially if it's something we end up doing once per frame. I see a need for better instrumentation that could be filled so that we don't have to resort to palour tricks in order to get frame-rate information from the game, as the very act of displaying that information uses up processing power. In my mind, there would be som...