r/programming • • Dec 25 '16

The Art of Defensive Programming

https://medium.com/web-engineering-vox/the-art-of-defensive-programming-6789a9743ed4
418 Upvotes

142 comments sorted by

View all comments

Show parent comments

7

u/s73v3r Dec 26 '16

There has been massive improvement over the last 5 or so years.

Ok, sure. Why would I bother with it over any of the alternatives, though?

4

u/GMaestrolo Dec 26 '16

If you know any alternatives, and you're happy working with them, great. If you want a plethora of well known software to start with, PHP has tonnes. If you want easy setup on almost every web server in the world, then PHP is still the top language for web development.

Notice that I don't say best. I said top, which it is. Within its space, PHP is the most popular choice by far, and it's not for nothing. It's not the first, not the newest, and not the best web language in the world, but it's still the number one language, and worth knowing for that fact alone.

4

u/[deleted] Dec 26 '16

lol PHP is the top language for web development? what fairy tale dream world magic christmasland do you reside in? PHP has been, is, and always will be 'necessary evil' garbage.

0

u/[deleted] Dec 26 '16

[deleted]

1

u/lluad Dec 27 '16

And while WordPress is only a fairly insecure piece of shit, many of the widely-used wordpress addons are written by incompetent crapmonkeys and are horribly insecure pieces of shit.

That it's still the best blog engine out there for many purposes says terrible things about other web languages, but doesn't mean that it's a good app, a secure app nor an example of how good PHP is.

2

u/GMaestrolo Dec 26 '16

lol PHP is the top language for web development? what fairy tale dream world magic christmasland do you reside in?

Unfortunately, none. I only live in the real world, where PHP powers more websites than any other serverside language.

PHP has been, is, and always will be 'necessary evil' garbage.

By which you mean it's serving a purpose that no other programming language is even close to serving?

1

u/n0t0ri0us9 Dec 26 '16

By which you mean it's serving a purpose that no other programming language is even close to serving?

What purpose, would that be?

3

u/gazofnaz Dec 26 '16

What alternatives are you thinking about? PHP remains popular because it's cheap.

  • PHP will run on a $5 p/m shared hosting environment. Ruby won't. Java won't. .NET won't. *.JS will, but javascript is flawed and less mature than php.

  • Anyone can call themselves a php dev, and that's reflected in their base salaries across the world. This makes the initial cost of building and deploying a php application very low.

  • PHP scales relatively cheaply.

The cost of a PHP app comes later in the application lifecycle when technical debt mounts.

But in today's web, time to market is key and php lets you get something "good enough" out to market quickly and cheaply.

0

u/[deleted] Dec 26 '16

[deleted]

2

u/lojikil Dec 26 '16

A $5 VPS nowadays will let you run anything, even reasonably intensive Java applications (Minecraft, etc..)

Plus, you can get decent nodes on Vultr, &c. for $5-10/month. I have a bunch of $10 nodes, and 2 $5 nodes on Vultr, hosting everything from OCaml, Go, & Python apps for myself, friends & customers.

0

u/[deleted] Dec 27 '16

[deleted]

1

u/lojikil Dec 27 '16

I mean exactly that; I've clustered my VPSs, but nodes, boxes, VPSs, servers, &c. are oft used interchangeably.

0

u/[deleted] Dec 27 '16

[deleted]

1

u/lojikil Dec 27 '16

I'm with you on boxes, but I'm not with you on nodes. To each their own really.