# Software design: comprehensive reasons not to hardcode Christmas as Dec 25th

**URL:** <https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060>\
**Category:** In My Humble Opinion\
**Created:** [February 21, 2011, 12:00am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060 "2011-02-21T00:00:27Z")\
**Posts on this page:** 10\
**Page:** 2

<div class="post-metadata">

**Author:** ![Rigamarole](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@Rigamarole](https://boards.straightdope.com/u/Rigamarole)\
**Post date:** [February 23, 2011, 12:35am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/21 "2011-02-23T00:35:40Z")

</div>

> [@Askance](#):
>
> Why do programmers celebrate Christmas on the 31st of October?
> 
> Because 31 OCT = 25 DEC .

OK, I give up. You can revoke my nerd card if you wish. What’s the joke?

---

<div class="post-metadata">

**Author:** ![Sunspace](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/sunspace/32/1250_2.png) [@Sunspace](https://boards.straightdope.com/u/Sunspace)\
**Post date:** [February 23, 2011, 12:40am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/22 "2011-02-23T00:40:49Z")

</div>

> [@Rigamarole](#):
>
> OK, I give up. You can revoke my nerd card if you wish. What’s the joke?

31 in base eight (OCTal) = 25 in base ten (DECimal). 🙂

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [February 23, 2011, 1:08am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/23 "2011-02-23T01:08:25Z")

</div>

The reasons have already been mentioned. Christmas is not the same day for everyone. It’s more work to account for a mix of fixed and computed dates. There are only rarely good reasons for hard-coding anything at the source code level. Even when hard-coded, something like a date should be defined as a named constant or macro.

The laziness of people who make a living sitting on their ass never ceases to amaze me.

---

<div class="post-metadata">

**Author:** ![Rigamarole](https://avatars.discourse-cdn.com/v4/letter/r/77aa72/32.png) [@Rigamarole](https://boards.straightdope.com/u/Rigamarole)\
**Post date:** [February 23, 2011, 1:57am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/24 "2011-02-23T01:57:03Z")

</div>

> [@Sunspace](#):
>
> 31 in base eight (OCTal) = 25 in base ten (DECimal). 🙂

:smack: I actually figured this out while driving home from work today. My first instinct was that it had to do with number bases, but I didn’t immediately get it because I hadn’t seen them expressed with that notation before. But it’s obvious/intuitive enough when you think about it.

---

<div class="post-metadata">

**Author:** ![Nava](https://avatars.discourse-cdn.com/v4/letter/n/da6949/32.png) [@Nava](https://boards.straightdope.com/u/Nava)\
**Post date:** [February 23, 2011, 8:21am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/25 "2011-02-23T08:21:56Z")

</div>

> [@The\_Tao\_s\_Revenge](#):
>
> Holy crap, I’m actually doing something right. I always avoid hard coding things. I thought I was just being lazy and writing code that didn’t need to be messed with much once it was working. Plus mixing data and code seemed icky.

You’re lazy like I am lazy… anybody who’s been with me for a while knows that when I use “oh, I’m lazy” during a conversation about design, what follows is “I’d rather work a little more now and a lot less later”.

The correct term is “efficient”, but if I called myself that, people would be able to accuse me of “putting on airs”… by saying “I’m lazy”, I can call my coworkers lazy inefficient bums in total impunity 😃

My current client is a multinational group, more than 100 companies. By using hardcoded forms instead of a single design with options, we’ve so far managed to have more than 20 forms just for Billing, and just in a single country - that’s 20 and counting. Plus the forms used in other countries, I don’t even know what the current total is. Just one more line to my list of “stories which show how hardcoding ends up causing extra work”.

---

<div class="post-metadata">

**Author:** ![don\_t\_ask](https://avatars.discourse-cdn.com/v4/letter/d/e68b1a/32.png) [@don\_t\_ask](https://boards.straightdope.com/u/don_t_ask)\
**Post date:** [February 23, 2011, 9:18am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/26 "2011-02-23T09:18:14Z")

</div>

I did a course in Business Analysis many years ago and and the lecturer cautioned against doing things “like this.” He then showed a piece of code where a working storage variable had been assigned as pi = 3.14159265 with a comment by the programmer that he had defined it here for “ease of updating if in future the value of pi changes.”

The lecturer thought the joke was terrible but I quite liked it, not least because I was the only one that laughed when he displayed the code.

---

<div class="post-metadata">

**Author:** ![Northern\_Piper](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/northern_piper/32/5304_2.png) [@Northern\_Piper](https://boards.straightdope.com/u/Northern_Piper)\
**Post date:** [March 9, 2011, 7:42pm UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/27 "2011-03-09T19:42:39Z")

</div>

> [@Sunspace](#):
>
> 31 in base eight (OCTal) = 25 in base ten (DECimal). 🙂

So, **Sunspace** , have you read “The Family Man” in _Casebook of the Black Widowers_ by Asimov?

---

<div class="post-metadata">

**Author:** ![buckgully](https://avatars.discourse-cdn.com/v4/letter/b/eb9ed0/32.png) [@buckgully](https://boards.straightdope.com/u/buckgully)\
**Post date:** [March 10, 2011, 12:38am UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/28 "2011-03-10T00:38:44Z")

</div>

History lesson from the Java 1.0-\>1.1-\>1.2 transition. You never know when the calendar API you’re using is going to replace something simple and broken with something complicated and broken.

---

<div class="post-metadata">

**Author:** ![LSLGuy](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/lslguy/32/5813_2.png) [@LSLGuy](https://boards.straightdope.com/u/LSLGuy)\
**Post date:** [March 10, 2011, 3:45pm UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/29 "2011-03-10T15:45:11Z")

</div>

> [@buckgully](#):
>
> History lesson from the Java 1.0-\>1.1-\>1.2 transition. You never know when the calendar API you’re using is going to replace something simple and broken with something complicated and broken.

I think you meant … something complicated and broken _differently_.

---

<div class="post-metadata">

**Author:** ![TriPolar](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tripolar/32/3008_2.png) [@TriPolar](https://boards.straightdope.com/u/TriPolar)\
**Post date:** [March 10, 2011, 4:49pm UTC](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060/30 "2011-03-10T16:49:26Z")

</div>

> [@LSLGuy](#):
>
> I think you meant … something complicated and broken _differently_.

He may have meant what he wrote. Certainly the average upgrade must live up to the expectation of introducing new problems, but the true measure of a useless upgrade is it’s failure to correct a previous problem while doing so. The very best systems will support legacy modes that allow it to not work at multiple levels.

[Previous page](https://boards.straightdope.com/t/software-design-comprehensive-reasons-not-to-hardcode-christmas-as-dec-25th/572060.md?page=1)
