Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is your attitude towards hard coding? [closed]

Mine is this:

Hard coding is the way! All my problems go away. Just code it one by one. And problems come back kill your day.

I absolutely hated it but the fact is "business people" tend to like it because it takes less time to get what they wanted. And as a software developer especially working in a corporate environment, most people will say: "yeah, why bother, just hard code it". What is your attitude toward hard coding?

like image 949
Jeff Avatar asked May 06 '09 05:05

Jeff


2 Answers

Hardcoding is something that should be avoided as much as possible.

If you hardcode something on your code it will completely "destroy" the portability of your code in a great extent. Even with a platform independant languages you will not able to say "Compile once, Run anywhere". Since it is not a good software engineering practice, I think avoiding hardcodes is better.

But I know in some cases we need that, specially in debugging the codes. The way I suggest is: First develop the code with hard codes, make it stable and eliminate the hardcodes then...

And there might be some cases that we need hardcoding, due to security concerns etc :). you might not be allowed to use registry, configuration files, any thing because they can increase the attack surface. But I think it is a rare case.

like image 83
Chathuranga Chandrasekara Avatar answered Sep 18 '22 18:09

Chathuranga Chandrasekara


Silver bullets do not exist in IT.

  • Do it if is smart.
  • Don't do it if it dumb.

If someone tell you to do the dumb thing, save the email thread and save your J.O.B.

like image 40
user102015 Avatar answered Sep 21 '22 18:09

user102015