Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #32005 > unrolled thread

Naming conventions, functions

Started byjonas.thornvall@gmail.com
First post2016-12-27 20:12 -0800
Last post2016-12-28 07:37 -0800
Articles 4 — 3 participants

Back to article view | Back to comp.lang.javascript


Contents

  Naming conventions, functions jonas.thornvall@gmail.com - 2016-12-27 20:12 -0800
    Re: Naming conventions, functions jonas.thornvall@gmail.com - 2016-12-27 20:26 -0800
      Re: Naming conventions, functions $Bill <news@todbe.com> - 2016-12-27 22:23 -0800
    Re: Naming conventions, functions "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2016-12-28 07:37 -0800

#32005 — Naming conventions, functions

Fromjonas.thornvall@gmail.com
Date2016-12-27 20:12 -0800
SubjectNaming conventions, functions
Message-ID<82ce9366-59bc-4b10-81a7-fadb8d81e9cc@googlegroups.com>
I usually write my javascript directly into a single HTML file, but that is really not ideal for bigger programming projects.

Now i've started to break down the code into JS files, but i do not really get howto know in which JS file the actual function that is called reside?

I do not use any special software that create an oversight in which JS file each function reside?

I only use texteditors and Yaldex free javascript editor for some debugging.
I was thinking put digits upon the files and functions to see where they reside.
Because it is not easy if you have 20 files and reading a function call to remember in which file the actual function reside.

How do one deal with this, i see two solutions put digits/characters before file and function name, get an editor that list the functions in each file but is there such where it is easy to see where the function resides.

JT
 

[toc] | [next] | [standalone]


#32006

Fromjonas.thornvall@gmail.com
Date2016-12-27 20:26 -0800
Message-ID<6f7d993e-1dbf-4720-bc7d-5834468f063d@googlegroups.com>
In reply to#32005
Den onsdag 28 december 2016 kl. 05:12:25 UTC+1 skrev jonas.t...@gmail.com:
> I usually write my javascript directly into a single HTML file, but that is really not ideal for bigger programming projects.
> 
> Now i've started to break down the code into JS files, but i do not really get howto know in which JS file the actual function that is called reside?
> 
> I do not use any special software that create an oversight in which JS file each function reside?
> 
> I only use texteditors and Yaldex free javascript editor for some debugging.
> I was thinking put digits upon the files and functions to see where they reside.
> Because it is not easy if you have 20 files and reading a function call to remember in which file the actual function reside.
> 
> How do one deal with this, i see two solutions put digits/characters before file and function name, get an editor that list the functions in each file but is there such where it is easy to see where the function resides.
> 
> JT

How about this?

Files 1xxxxx.js
Functions xxxxxx_1()

[toc] | [prev] | [next] | [standalone]


#32008

From$Bill <news@todbe.com>
Date2016-12-27 22:23 -0800
Message-ID<o3vlme$tnq$2@dont-email.me>
In reply to#32006
On 12-27-16 20:26, jonas.thornvall@gmail.com wrote:
> Den onsdag 28 december 2016 kl. 05:12:25 UTC+1 skrev jonas.t...@gmail.com:
>> I usually write my javascript directly into a single HTML file, but that is really not ideal for bigger programming projects.
>>
>> Now i've started to break down the code into JS files, but i do not really get howto know in which JS file the actual function that is called reside?
>>
>> I do not use any special software that create an oversight in which JS file each function reside?
>>
>> I only use texteditors and Yaldex free javascript editor for some debugging.
>> I was thinking put digits upon the files and functions to see where they reside.
>> Because it is not easy if you have 20 files and reading a function call to remember in which file the actual function reside.
>>
>> How do one deal with this, i see two solutions put digits/characters before file and function name, get an editor that list the functions in each file but is there such where it is easy to see where the function resides.
>>
>> JT
>
> How about this?
>
> Files 1xxxxx.js
> Functions xxxxxx_1()

How about grouping them into similar code and coming up with 2 letters
to name the code grouping and start each function with those 2 letters.
eg: RE.js  contains all reg exp functions and each starts with RE or RE_

[toc] | [prev] | [next] | [standalone]


#32011

From"Michael Haufe (TNO)" <tno@thenewobjective.com>
Date2016-12-28 07:37 -0800
Message-ID<a84f8e80-13dd-4b64-b561-aa9931c621a5@googlegroups.com>
In reply to#32005
On Tuesday, December 27, 2016 at 10:12:25 PM UTC-6, jonas.t...@gmail.com wrote:
> I usually write my javascript directly into a single HTML file, but that is really not ideal for bigger programming projects.
> 
> Now i've started to break down the code into JS files, but i do not really get howto know in which JS file the actual function that is called reside?
> 
> I do not use any special software that create an oversight in which JS file each function reside?
> 
> I only use texteditors and Yaldex free javascript editor for some debugging.
> I was thinking put digits upon the files and functions to see where they reside.
> Because it is not easy if you have 20 files and reading a function call to remember in which file the actual function reside.
> 
> How do one deal with this, i see two solutions put digits/characters before file and function name, get an editor that list the functions in each file but is there such where it is easy to see where the function resides.

Your problem is bigger than just file names. You need to understand how to architect your code. Since there are a variety to choose from, I suggest just picking one until you learn enough to criticize it and grow away from it. 

A "Good-Enough" choice would be an MVC style approach. Peter Michaux has a competent, vanilla approach you might be interested in:

<http://peter.michaux.ca/articles/mvc-architecture-for-javascript-applications>

With related suggestion:

<http://peter.michaux.ca/articles/organizing-browser-application-files>

More ambitious projects have even more involved systems. 

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.javascript


csiph-web