Your Digital Media Has Never Looked So Good

 
User avatar
Komag
Topic Author
Posts: 746
Joined: Fri Aug 22, 2014 3:42 am

How long is your code?

Fri Jun 12, 2015 8:34 am

I know the same program written crapily can take double the code length, but assuming we're all being at least somewhat efficient and reasonable, how long is your code?

Currently my game is about 7600 lines long, and weighs 440k of code, about HALF of which is comments! So probably about 200k+ of real code.

I "think" I'm about half done, but it's really hard to say.

So I'm curious how that compares to what's out there. I assume regular channels would usually be smaller than a game, but I guess I don't really know. This is my first real programming, so it still might be pretty bloated, though I've tried to kill off any repeated code if possible with good use of loops or functions.
 
sjb64
Posts: 108
Joined: Thu Apr 16, 2015 1:13 pm
Location: Memphis, TN

Re: How long is your code?

Fri Jun 12, 2015 8:52 am

Our FlixRaider channel is right about 3,000 lines, with various text file contents (about us, announcements, etc.) stored externally, so the 3,000 lines is pretty much just code. But a third of that is probably deserialization routines in the data access layer, so maybe 2,000 lines of actual operations code.
FlixRaider channel
 
Romans_I_XVI
Posts: 252
Joined: Wed Nov 19, 2014 10:25 pm
Contact:

Re: How long is your code?

Tue Jun 16, 2015 9:50 am

If you're wanting to compare you can view Retaliate here. https://github.com/Romans-I-XVI/Roku-Retaliate-Channel-Open-Source

Although I haven't updated that since all the recent changes.
 
User avatar
Komag
Topic Author
Posts: 746
Joined: Fri Aug 22, 2014 3:42 am

Re: How long is your code?

Tue Jun 16, 2015 11:29 am

That's got about 2000 lines all together, and it's nice to see the code, thanks! :)
 
destruk
Posts: 2590
Joined: Sat Dec 18, 2010 4:58 pm

Re: How long is your code?

Tue Jun 16, 2015 11:41 am

For a complete roku channel which loads a single live stream for playback, 50 lines.
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: How long is your code?

Tue Jun 16, 2015 2:32 pm

destruk wrote:
For a complete roku channel which loads a single live stream for playback, 50 lines.

Can you make it a 1-liner? #CodeGolf FTW!
 
User avatar
RokuMarkn
Roku Engineering
Posts: 1582
Joined: Mon Jun 09, 2008 9:20 am

Re: How long is your code?

Tue Jun 16, 2015 3:00 pm

u=CreateObject("roUrlTransfer") : u.SetUrl("http://where/my/code/is") : Eval(u.GetToString())


--Mark
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: How long is your code?

Tue Jun 16, 2015 3:30 pm

RokuMarkn wrote:
u=CreateObject("roUrlTransfer") : u.SetUrl("http://where/my/code/is") : Eval(u.GetToString())

LOL #NoFair
That's like saying "10 LIST" is a legal quine (self-printing program).
A legit one-liner can be done though, right? Just have to avoid loops and IFs.
 
User avatar
TheEndless
** Valued Community Member **
Posts: 9232
Joined: Mon Oct 04, 2004 10:15 am
Location: US
Contact:

Re: How long is your code?

Tue Jun 16, 2015 9:38 pm

EnTerr wrote:
A legit one-liner can be done though, right? Just have to avoid loops and IFs.

Does this count?
Sub Main():screen=CreateObject("roVideoScreen"):screen.SetContent({StreamFormat:"hls", Stream:{Url:"http://media.heywatch.com.s3.amazonaws.com/hls/big_buck_bunny/big_buck_bunny.m3u8"}}):screen.Show():While True:End While:End Sub
My Channels: http://roku.permanence.com - Twitter: @TheEndlessDev
Instant Watch Browser (NetflixIWB), Aquarium Screensaver (AQUARIUM), Clever Clocks Screensaver (CLEVERCLOCKS), iTunes Podcasts (ITPC), My Channels (MYCHANNELS)
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: How long is your code?

Tue Jun 16, 2015 10:41 pm

TheEndless wrote:
EnTerr wrote:
A legit one-liner can be done though, right? Just have to avoid loops and IFs.

Does this count?
Sub Main():screen=CreateObject("roVideoScreen"):screen.SetContent({StreamFormat:"hls", Stream:{Url:"http://media.heywatch.com.s3.amazonaws.com/hls/big_buck_bunny/big_buck_bunny.m3u8"}}):screen.Show():While True:End While:End Sub

Abso-censored-lutely, provided it runs. My bad, i thought the loops have the IF statement problem.
Can lose the Sub Main(): ... :End Sub brackets btw (courtesy of SquirrelTown and RokuMarkn)
 
User avatar
Komag
Topic Author
Posts: 746
Joined: Fri Aug 22, 2014 3:42 am

Re: How long is your code?

Tue Oct 25, 2016 9:58 am

joetesta's project of 30,000 lines of code (https://forums.roku.com/viewtopic.php?f=34&t=89748) is still the biggest reported.

My game is up to over 16,000 lines now (about 900k of code, still roughly half comments), so when it was 7600 lines and I thought I might be about halfway done, I was wrong wrong wrong! But I'd say I'm definitely more than halfway done now :-D
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: How long is your code?

Tue Oct 25, 2016 11:38 am

Komag wrote:
joetesta's project of 30,000 lines of code (https://forums.roku.com/viewtopic.php?f=34&t=89748) is still the biggest reported.

My game is up to over 16,000 lines now (about 900k of code, still roughly half comments)

Hmm, to give you a perspective, a current version of a Lua interpreter (a scripting language more powerful/faster than B/S) weighs at only 24k lines (1100kb) of C. C is less expressive (i.e. verbose) than higher level scripting languages, so one is left to wonder what is it that you guys are doing to reach such high numbers?
 
User avatar
Komag
Topic Author
Posts: 746
Joined: Fri Aug 22, 2014 3:42 am

Re: How long is your code?

Tue Oct 25, 2016 8:31 pm

Probably lots of inefficient newbie spaghetti code! But I do try hard to avoid repetition if possible.
 
adrianc1982
Posts: 89
Joined: Thu Jun 05, 2014 6:02 pm

Re: How long is your code?

Wed Oct 26, 2016 1:38 pm

you should avoids comments as much as posible. rename your variables in a more descriptive way even if you have to use long variable names. coments are evil, your code should read like a big coment if you are doing it properly.

functions should have descriptive names long ones if posible and you should write 3 lines per function or less when posible.

my code is 6000 lines of code no coments. going to push it to 8000 or 9000 lines of code.
 
EnTerr
** Valued Community Member **
Posts: 3834
Joined: Sun Jan 02, 2011 2:41 am

Re: How long is your code?

Wed Oct 26, 2016 2:21 pm

adrianc1982 wrote:
functions should have descriptive names long ones if posible and you should write 3 lines per function or less when posible.

Goodness gracious, NO!
Whoever came with such idiotic idea must been someone from the Marketing Department of the Sirius Cybernetics Corporation ("A bunch of mindless jerks who'll be the first against the wall when the revolution comes"). Prophetizing this should be outlawed.

A function should be as long, as it makes sense; as much as you - or a developer after you - can hold in their head and work with. It also depends on what is being done - there are cases in which hundreds of lines are okay, i won't preclude thousands if it was something linear and thinking free. Just like you cannot say "all roArrays should be <= 10 elements - or you are doing it wrong".

It's like arguing what's the perfect size of a coffee grind or meal pieces - it depends. But "2-3 lines" is like putting it in a blender and liquifying all to a smoothie! It's on the "too small" side, just like thousand lines is on the "too large" side, the golden mean is in the middle.

The problem with chopping to too small pieces is that you have not got rid of complexity. Complexity hitting the fan did not make it disappear per se - it gets it smeared all around. Even if you can hold in your head all the million pieces you shattered it into, the coder after you can't - or they'll need a week charting your function calls.

See discussions e.g. http://softwareengineering.stackexchang ... od-for-you

PS. and yes, comments should not restate what was said - or could be said - in code, for reasons of brevity and not running out-of-sync. But they could document why something is happening he way it is, external factors beyond the code. Say you have been told not to do that, because it doesn't work. Your code becomes more ornate and you have to note why it can't done simpler.

Who is online

Users browsing this forum: No registered users and 3 guests