Number of lines of code

I was curious about this.

In jsfiddle on the left side it tells you how many lines you’ve used, is there a limit number you want to stay under as much as possible? Is there a minimum at all you should try to keep it to? Or is the sky the limit, meaning, it doesn’t really matter how long the code is in its entirety. or maybe it depends on different factors, i.e., how much bandwidth you have, so on and so forth.

For example:

html: 366 lines
CSS: about 959 lines
Javascript: 854 lines

Would that be a lot?
or is that very little?

Hi there asasass,

as you seem to be a genuine jsdfiddle aficionado,
why don’t you test it to destruction yourself and
then report back here with your observations. :winky:

coothead

2 Likes

I’m not sure what to make of that response.
Well, I do prefer jsfiddle to codepen.

I wouldn’t want to add as much code to it as possible,
and then go, well, I guess that’s the limit.

Well, do you want someone like yours truly to be the fall guy? :wonky:

coothead

No, I wasn’t asking you to do it.
I was just asking a general question.

I think you were advocating me to load up my code
with as much code as possible then report back with
my findings.

yes, that was what I was suggesting, as I assumed that, unlike
me, you would be totally aware of jsfiddle’s actual capabilities. :winky:

coothead

I don’t know about codepen or jsfiddle, but I’m guessing they have some way of enforcing sane limits whatever they might be.

It isn’t so much about lines of code, but rather bytes of code.

Technically, AFAIK, there are no limits. But you wouldn’t want to have files that brought processing or transfer to a crawl.

I prefer to keep “dev” code readable, and if desirable have minified “production” code.

As far as parsing, these would result in the same rendered output.

<span>
s
o
m
e
w
o
r
d
</span>
<span>
someword
</span>
<span>someword</span>

My general rule of thumb is if it gets hard to read, use new lines and indentation to help make it more readable.

1 Like

I guess when I hit the end of jsfiddle, you’ll be the first to know.

1 Like

I was referring to these numbered lines.

But you said it should be about bytes, not number of lines.

I wouldn’t mind to much, if I was even second or third. :biggrin:

coothead

To make dev code readable, wouldn’t formatting the code do that too?

I would keep it that way, at least for working on it. After everything is “final” you can minify it to remove new lines and indentation so everything would be on one long line.

Without the indentation you end up with something like
</div></div></div></div></div>

Imagine that if things aren’t working because there is an extra </div> how hard it would be to know which one to remove. (OK, not the best example, but you get the idea)

For an example of JavaScript, download copies of jquery and jquery.min and open each in your text editor.

1 Like

Thank you.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.