Wednesday, September 20, 2017

Lazy Programming

This is only a petty annoyance – like when I hear people say kil-LOM-muh-ter instead of KILL-uh-me-ter. Petty. Still, I have a platform that allows me to gripe about stuff, so I’m griping. And yes, I already griped about the kilometer thing, and you can read it here. Or, you could go out and get a life while there’s still time. It’s too late for me.

I was on a local government website and at one point it wanted me to enter a one to five digit number. The instructions stated that if the number had less than five digits, I had to enter leading zeros to make it a five digit number. So “12345” would be acceptable, but “123” would not and must therefore be entered as “00123”.

This is a minor example of a larger problem I call lazy programming. The web page designer is requiring everyone who uses that page to format the number to five digits, whereas he (she? they?) could easily have written code to automatically format the number. How hard would that be? In the C# language (pronounced C-sharp) the code for server-side formatting would look like this:

s == s.PadLeft(5, '0');

On the other hand, if the formatting is done by the web browser instead of by the server, then Javascript, the coding language of web pages and web browsers, would be used and the code would look like this:

s = ("00000" + s).slice(-5);

Anyone programming a server should know how to do something this simple. Anyone designing a web page should know how to format a number before sending it to the server. The only reason not to do it is an attitude of “why bother, let everyone who uses the page format the number.”

That’s my gripe, and it’s not about programming per se. It’s about apathetic workers in general who would rather burden others (co-workers, customers, users) instead of doing their best on the job. I hear this over and over from business owners: “You can’t find employees today who want to work.” There’s an increasingly prevalent attitude of “it’s good enough” or “somebody will do it if I don’t.” A person can be taught how to do a good job, but they can’t be taught to care about doing a good job. Wanting to do things the right way is part of a person’s character. You have it or you don’t, and it seems that more people these days don’t have it.

2 comments:

Anonymous said...

Amen!!!! Youth today HAS NO CHARACTER. Thank god my kids, ages 45 and 43, listened and learned how to develop character.

Anonymous said...

Yeah, "The best programmers that money can buy for what amount we've been able to beg the accountants to let us have". And that's how musicians become Security Directors.
Cheers!
CyberDave2.2