Tag Archives: PHP

Yet Another Use for PHP

A recent project found us integrating an online SaaS with a MSSQL Order Entry system. The SaaS system used the hideous SOAP protocol, but PHP’s SoapClient class made quick work of that.

“Unless you have a definitive reason to use SOAP use REST.”

The order entry system followed Microsoft’s version of the development bible and operated by calling dozens of stored procedures, sometimes many times (reduntantly) over again, with each click. Yet a call out to xp_cmdshell allowed us to exit that limited platform. Finally, speed, was impressive! On modern machinery PHP’s optimized and ultra thin C++ engine is a rocket ship.

So despite the completely unorthodox strategy our client has again had their expectations exceeded. Once the code for their custom interface was moved to a PHP script all scope creep was easily conquered without any threat to the timeline nor any increase in cost. Win/Win/Win (The client/The developer/PHP).

An Expensive Downgrade.

What percentage of development shops are pigeonholing their clients by their loyal adherence to their prescribed stack? Far too many. At V-Tek, we’ve found that .NET often fits quite nicely into our mostly open-source toolbox. Especially when our client already has an MS oriented product.

Everything from raw library-less JavaScript, to RoR coding by convention, should be fair game for a development studio worth its salt. Otherwise the first thing they will want (and have to) do is uproot your existing modules. While uprooting modules may be exactly what you need, doing it only because your trusted developer doesn’t understand them is just stupid. What you already have could be ingenious, but if your developers don’t recognize genius when they see it you may well pay a lot of money only for them to downgrade your system.

One of the most powerful combinations we’ve leveraged somewhat regularly is PHP scripting routines against MSSQL systems on Windows servers. Combine the power of CLI PHP with Windows’ Task Scheduler, libraries like CURL and Sockets, and we accomplish things that other shops have flat out claimed impossible.

So unless you, as a customer, are narrow-minded, then it is best not to hire a narrow-minded development shop that will treat you like a child while they themselves waste your money.

Fancy Frameworks and Trendy Tech

I wonder if in a few years coding to spec will come back in style and I’ll have to start wearing skinny jeans and using a Mac. I kinda hope not. Coding to spec instead of trying to fit the spec into a subset of pre-existing modules is a nice niche. MVC and such are nice conventions, but public conventions can be a security risk in and of themselves. Sure you can call them “standards” but having predated social media driven “standards” doesn’t mean we didn’t have “standards” we just had to understand them much better than the fanfare of today’s pretentious “guru” atmosphere. We had to actually code to spec.

I really gave “test-driven” development a shot… but what a laugh! It’s like having to do everything twice. I imagine that’s important for beginners, but after 20 years of coding I’ll just do it right the first time thanks. The first time you spend an hour debugging someone else’s “test” you’ll have to question if there really is a baby in that nasty bath water.

It’s amazing how lean and mean code written for the spec can be compared to the bloat of piles of libraries just to get started with some packages. JavaScript is super easy and super powerful, yet how many people import JQuery just because they can’t code a 5 line function? Or for some reason believe they can’t maintain browser compatibility? Don’t they know that compatibility bugs in JQuery can last months? Any that show up in your function should take less time to fix than installing a new version of JQuery.

Alas, I’m afraid we’re bound to come full circle. After the last just-another-web-framework comes along and the déjà vu is undeniable, someone with skinny jeans, dark rimmed glasses, and a shirt that ensures that he cannot tie his shoes without mooning someone; that guy will profoundly declare to his bazillion Twitter zombies that coding to spec is the new bleeding edge. We just need to wait long enough for everyone to forget that option ever existed.

Are you a Monoglot?

Technology is like a religion for some. If it ain’t in their language it must “suck”. We may be able to thank headhunters and job descriptions for this unnecessary level of specialization. Jobs often come with a laundry list of specific required skills and those specific skills are either the result of a monoglot project leader or the preference of the previous developer. Either way requiring 15 years of .NET programming experience is a sure way to weed out some great prospective brain power. (as well as any honest candidates in this case since .NET hasn’t been around that long)

We often steer folks away from .NET implementations for the simple reason that compiled languages add an unnecessary layer of complexity to the production process & have caused a nightmare for maintainers. I personally love writing C# but can’t recommend it for a web site. Not when interpreted languages are so powerful and often perform better than the .NET VM.

However the title of “sucks” is reserved for a handful of technologies whose developers knew exactly what they were doing. Making products purposely limited to control the user base does suck in the tyrannical, Godwin’s law, way. That’s all I’ll say about that for now.

However, if you are a polyglot you may be a dying breed. Unless you’re careful that work you’re doing now will be the only work you ever learn to do. The more specific your experiences are the less adaptable your solutions will be. Then one day you’ll say, without any embarrassment: “I don’t know how to do that.” … If you are a real technologist that sentence had better be followed by: “ … but I’ll figure out how.” … if it is not, you are probably a monoglot, and you may well find yourself cursed with the ungraceful miasma of obsolete skills. Perhaps your employer will “keep” you because of your obsolete skills, but you’ll be stuck, and it will suck. You’ll rot in your office chair anxious for the day you can retire.

Polyglots like us have the gigantic benefit of never becoming obsolete, we are edge cutters, we aren’t afraid of new stuff, we assimilate new technologies like Cheerios. Polyglots are cool, and we may make a hobby of antagonizing the Monoglots (or “fanboys”) but our license is our knowledge. We can rip on the things we know, it’s what the “fanboys” don’t know that make them entertaining.

If you are a monoglot, stop it. Stop it now! Then you’ll get the joke.

What’s so good about PHP?

I’m biased, PHP is fantastic. It has evolved into a super-power among programming languages. I liked Java, I deplored VB, C# is OK (copy of Java), Ruby-on-Rails is really more 4G, but PHP is just a flat out a git-r-done scripting language. Here are some of my reasons:

1. Super fast! Considering it is an interpreted language PHP flies. Even with gigantic script libraries included.

2. No DLL hell. So many people think that DLL hell was only a problem with Microsoft products but anyone being honest will have found DEPENDENCY hell to be exactly the same thing. Watch a whole building full of developers try to get their Rails versions synced with their libraries just to get one widget to work and launch the initial skeleton app. That’s just as bad as DLL hell. .NET versions, same problem. Even JAVA app dependencies can get wonky but PHP’s extensions folder is cake to manage (and they use DLLs!). In fact, for one client we have faithfully upgraded their PHP build with every point release manually and the code almost always works, and when it doesn’t it’s graceful and minor.

3. Loosely typed. This can be a train wreck for junior programmers but seasoned veterans who have delved beyond the 4th generation to make their own products and not just assemble a bunch of other people’s work will know when type matters and when it doesn’t. As it turns out, it VERY OFTEN doesn’t. Making strongly typed languages a real PITA.

4. The Frankenstein factor. All platforms have tempted developers to package bits of functionality into modules for reuse all over the place, even PHP. However, the PHP community began with nuts-and-bolts coders and the modules that come from that community are very large and specific. The small modules of functionality are incredibly mature and compiled into extensions. In other environments, especially the 4GLish of them, the “brilliant” idea was to make tiny modules for this or that. Mix that with some starry eyed kids and you don’t get apps, you get Frankenstein. And more dependencies to create the #2 mess mentioned above. The claim is that these modules speed up the development process, but I have yet to see that happen.

5. Environment. PHP sites by nature have everything necessary for a programmer to step in and modify. No project files, expensive IDEs, gigantic downloads, compilations, or gems to get just right. Even your environment variables can probably be left alone. Simpler is better.

6. Philosophy. The modern MVC philosophy of convention over configuration is an attempt to protect the world from bad programmers, but good programmers do this naturally. MVC is a good idea, and a decent pseudo-standard to code to, but it’s just that, a pseudo-standard. I’ve dug through other people’s models, views, and controllers in different languages and one thing that is certain. Everyone does their own version. In PHP we can implement MVC, and get it just as right (or wrong depending on who you’re talking to) as any other language.

7. The community. The PHP community is cool. Sure, being arguably (Java still holds the top spot, but it is not as web targeted) the the most popular web language out there means all kinds are posting their thoughts but there is a core group of geniuses on the main groups. Helpful folks, and there are code snippets posted to do just about anything. Easily modifiable for our own needs without any of the “hell” from #2 above.

I could keep going but that being said my bias is clear. Perhaps next week I should post an article like “What’s so good about Rails?” I could do it, just don’t know if I could make it to 7 points.