# Helpful tips and hints by and for Melancholies

**URL:** <https://boards.straightdope.com/t/helpful-tips-and-hints-by-and-for-melancholies/89508>\
**Category:** Miscellaneous and Personal Stuff I Must Share\
**Created:** [October 25, 2001, 9:56am UTC](https://boards.straightdope.com/t/helpful-tips-and-hints-by-and-for-melancholies/89508 "2001-10-25T09:56:22Z")\
**Posts on this page:** 3\
**Page:** 3

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [November 1, 2001, 2:29pm UTC](https://boards.straightdope.com/t/helpful-tips-and-hints-by-and-for-melancholies/89508/41 "2001-11-01T14:29:09Z")

</div>

Brilliant deduction, Nostradamus. I hesitate to advise divorce, however, for the sake of the children. Surely, the only recourse here is Daily Self-sacrifice Recognition Rituals. Stuck forever with a Choleric. Egad. Let us bow our heads in empathy with our unfortunate Brother in Balance.

---

<div class="post-metadata">

**Author:** ![Liberal](https://avatars.discourse-cdn.com/v4/letter/l/848f3c/32.png) [@Liberal](https://boards.straightdope.com/u/Liberal)\
**Post date:** [November 2, 2001, 11:05am UTC](https://boards.straightdope.com/t/helpful-tips-and-hints-by-and-for-melancholies/89508/42 "2001-11-02T11:05:01Z")

</div>

Today’s tip deals with JavaScript coding.

Do not write your functions this way:

```auto

var x;function foo{
if (x==5||x==8){
this.caption='Hello World'; return true;} else {
return false;}
}

```

Instead, write them this way:

```auto

var x;

function foo
    {
        if ( x==5 || x==8 )
            {
                this.caption='Hello World';
                return true;
            }
        else
            {
                return false;
            }
    }

```

Much better balance. Easier to read and maintain. Note that, for a complex function, you easily can match up your various delimiter pairs and code phrases.

---

<div class="post-metadata">

**Author:** ![Maeglin](https://avatars.discourse-cdn.com/v4/letter/m/8baadc/32.png) [@Maeglin](https://boards.straightdope.com/u/Maeglin)\
**Post date:** [November 3, 2001, 8:00pm UTC](https://boards.straightdope.com/t/helpful-tips-and-hints-by-and-for-melancholies/89508/43 "2001-11-03T20:00:30Z")

</div>

\<sigh\>

Yes. The coding aesthetic is every bit as important to pogramming as proper style is to English. It would be long and painful to relate my experience coding a long project with eight of my friends back in high school. As brilliant as many of them were, they were phlegmatics to a man. There are few things quite so maddening as trying to combine the various functions and procedures written by seven or eight other people into a master module when the code is inefficiently displayed on the page and inappropriately documented.

No, documentation like:

> [@](#):
>
> //hehe, this is cool

is not what I would consider appropriate.

When the project was complete, I had no choice but to wade through several thousand lines of code and reformat _everything_.

It was a labor of love, suffice to say.

[Previous page](https://boards.straightdope.com/t/helpful-tips-and-hints-by-and-for-melancholies/89508.md?page=2)
