Regions in Javascript files (for Visual Studio)

Started by Mr. Analog, May 07, 2012, 11:19:51 AM

Previous topic - Next topic

Mr. Analog

By Grabthar's Hammer

Thorin

Outlining is cool, it lets you collapse a huge wall of code into more-easily-understood sections.

Some people think that it's better to separate all that code into multiple source files.

I'm not sure which side of that fence I'm on yet, but I know that I don't like huge walls of code.
Prayin' for a 20!

gcc thorin.c -pedantic -o Thorin
compile successful

Mr. Analog

I kinda like grouping functional areas, like there's not point in adding a region that says "methods" 'cause who gives a crap, but if I have a class that does CRUD stuff it's kind of cool to see the different operations organized.

Most of the time if I'm looking at a class that's not mine it's because I'm looking for something that's broken or needs to change so, having that kind of grouping helps. In compiled code there are lots of options for finding things (heck, even shortcuts [F12] that can bring you to definitions) in script though finding a particular event is sometimes like trying to find a chunk of corn in diarrhea...

And much like that metaphor once you find it you don't want it anyway

HAH :dance:
By Grabthar's Hammer

Tom

Quote from: Thorin on May 07, 2012, 01:38:31 PM
Outlining is cool, it lets you collapse a huge wall of code into more-easily-understood sections.

Some people think that it's better to separate all that code into multiple source files.

I'm not sure which side of that fence I'm on yet, but I know that I don't like huge walls of code.
I'd say do both. I really like the idea of specifying custom folding sections. But its not a substitute for separating logically/functionally separate chunks of code into different files (in most cases anyhow).
<Zapata Prime> I smell Stanley... And he smells good!!!

Mr. Analog

That drives me nuts when people separate functionality into different code files (or even worse libraries / sites)
By Grabthar's Hammer

Tom

Quote from: Mr. Analog on May 07, 2012, 02:28:15 PM
That drives me nuts when people separate functionality into different code files (or even worse libraries / sites)
If its part of the same "function", it should probably be together. Splitting up the code from a single logical object would be a bit silly. Though if your file reaches several thousand lines of code, maybe your design is a bit off to begin with.

What drives me nuts is when completely separate functionality is all bodged into the same multi thousand line file.
<Zapata Prime> I smell Stanley... And he smells good!!!

Mr. Analog

Quote from: Tom on May 07, 2012, 05:32:35 PM
Quote from: Mr. Analog on May 07, 2012, 02:28:15 PM
That drives me nuts when people separate functionality into different code files (or even worse libraries / sites)
If its part of the same "function", it should probably be together. Splitting up the code from a single logical object would be a bit silly. Though if your file reaches several thousand lines of code, maybe your design is a bit off to begin with.

What drives me nuts is when completely separate functionality is all bodged into the same multi thousand line file.

That bugs me too, code is like Yin/Yang, there's a balance.
By Grabthar's Hammer