Log in

View Full Version : How many lines of code do you have total?


2733Programming
24-02-2011, 20:39
Just curious what other teams using Java are at. We have about ~1800 at the moment.

Garten Haeska
24-02-2011, 20:41
Wow!!!!
we have about 140! Why is your code so complex?:confused:

Garten Haeska
24-02-2011, 20:44
Wow!!!!
we have about 140! Why is your code so complex?:confused:

oh btw we havent included our autonomy and deployment yet!::ouch::

2733Programming
24-02-2011, 20:56
Wow!!!!
we have about 140! Why is your code so complex?:confused:

We made wrapper classes for most of our sensors and control devices so we can get the most use out of the information they provide, we have field oriented swerve drive with several driving modes, many automated processes to make the driver's job more straightforward and less concerned with details, and quite a few extra features that we are very excited about, but are not to be named until our first regional. ;)

Robby Unruh
24-02-2011, 21:00
All our code put together is ~700 lines. But the main robot class is only ~120.

Drive programming is about 500 of those lines. :P

davidthefat
24-02-2011, 21:13
Now the question here is: what are you more proud of? A ton of complex code, or a very streamline one? Now I am not saying a project that consists of thousands of lines are not efficient, but chances are at this level, it is not efficient...

We currently have about 1500. I probably have to go back and streamline everything.


Edit: I would compare that to being big and slow or being a petite sprinter. Which one will you really be proud of?

MattD
24-02-2011, 21:15
Our 2010 robot had about ~3500 lines of code spread across ~20 Java source files. It's interesting to note that the files SwerveModule.java and Config.java each had a total of 228 lines, the same as our team number.

This season is still a work in progress, but when it's all done I'd expect only around half of that.

2733Programming
24-02-2011, 21:37
Now the question here is: what are you more proud of? A ton of complex code, or a very streamline one? Now I am not saying a project that consists of thousands of lines are not efficient, but chances are at this level, it is not efficient...

We currently have about 1500. I probably have to go back and streamline everything.


Edit: I would compare that to being big and slow or being a petite sprinter. Which one will you really be proud of?

I'm proud of elegant code, that successfully, consistently, and effectively completes the job it was made to do. I'm not encouraging over-complex, or bloated code, but I strongly believe in code that gets the job done, regardless of how many lines it takes.

So to answer your question, I'd be proud of whoever wins the race :cool:

davidthefat
24-02-2011, 21:40
I'm proud of elegant code, that successfully, consistently, and effectively completes the job it was made to do. I'm not encouraging over-complex, or bloated code, but I strongly believe in code that gets the job done, regardless of how many lines it takes.

So to answer your question, I'd be proud of whoever wins the race :cool:

Well you and I have totally different mentalities then. I am going to use inline assembly next year to squeeze out more juice and performance from the cRio. :eek: I know I sound crazy, but I love the low level. I kind of regret using Java. I had to because no one knew C++. I'll go with my wishes before I graduate.

spartango
24-02-2011, 22:30
2010 season we had 11,358 lines. 3,036 of those were comments. EDIT: 96 Framework source files, 7 Robot specific files.
2011 season uses the same core codebase of 9,571 lines, 2,749 of which are comments.

Sounds like a lot of bloat, but its not. All together it makes for a really elegant system with abstraction and events and so on--
http://code.google.com/p/grtframework/

:)

Robototes2412
24-02-2011, 23:12
I have only 600 lines of code including my various wrappers.

The Reason why is that i use this formatting for eveything
type some_function(type var) {
do_funky_crap();
}

davidthefat
24-02-2011, 23:32
2010 season we had 11,358 lines. 3,036 of those were comments.
2011 season uses the same core codebase of 9,571 lines, 2,749 of which are comments.

Sounds like a lot of bloat, but its not. All together it makes for a really elegant system with abstraction and events and so on--
http://code.google.com/p/grtframework/

:)

Woah, how did you manage to find the time to code that? Pretty impressed.

yclee31
25-02-2011, 08:07
are any of you guys using CAN? :)

spartango
25-02-2011, 11:57
heh, time... well actually it didn't take that long in that you can generate some of the code, and then also it carries over year to year so once you have the framework you only add a few hundred/thousand onto it specific for each year.

btw, grtframework has/uses CAN, complete with the neat jag closed loop mode.

Jeremy Germita
01-03-2011, 07:05
Some interesting stats about our code.
Java.

6 Coders.
1,721 Lines of code total.
Average of 286.8333333 lines per coder
8 Packages
Average of 2.625 files per package
Average of 215.125 lines per package
21 files total
Average of 3.5 files per coder
Average of 81.95238095 lines per file

Interesting facts:
Our neatest code to date
Our first year with our code online
Our Highest number of programmers this year(up 3 from last year)
Our Highest number of source files and packages


Our code: (Will be revised up until our last match!)
http://code.google.com/p/frc399-2011-code-james-bot/

flameout
01-03-2011, 08:51
Wow, I'm surprised at how many lines of code you all have. I suspect that there is some amount of bias here (i.e. the teams with the most code are the most likely to be hanging out on CD after ship...)

We decided to use Java as all our development computers are on Linux (personal computers) (next year, we might use the new universal C++ development system).

I knew from a previous development experience that with Java, if you aren't extremely careful, you'll end up with so-called "spaghetti and meatball" code (i.e. an object-oriented mess). Therefore, I took the time to carefully lay out our classes, which probably added a few lines to the code.

In comparison to those with swerve drives, however, we do have a very simple bot (but a swerve drive doesn't use up that much code relative to a tank drive -- my lego swerve drive has 238 lines total).

We have 513 lines total this year (at the moment). One coder contributed 11 lines of code, the other (me) contributed the other 502 (I'm the only experienced coder on my team, and the other coder rarely came to build meetings).

Good luck to everyone at regionals.

AmoryG
02-03-2011, 01:31
I contributed a line of code when I visited my team a week or so ago, but deleted it after because it didn't do anything.

I knew from a previous development experience that with Java, if you aren't extremely careful, you'll end up with so-called "spaghetti and meatball" code (i.e. an object-oriented mess).

Actually, "spaghetti code" usually refers to unstructured code that uses things like gotos, which doesn't exist in Java. It's harder to write spaghetti code in java than in languages such as C++ (at least for some people, I guess).

Robby Unruh
02-03-2011, 17:38
After a quick number crunch, we're up to 757 lines of code. :D
This is the first time I've been in our workshop since the robot shipped. It seems empty...

flameout
02-03-2011, 22:38
Actually, "spaghetti code" usually refers to unstructured code that uses things like gotos, which doesn't exist in Java. It's harder to write spaghetti code in java than in languages such as C++ (at least for some people, I guess).
Yeah, I had trouble understanding the various phrases. My understanding is that "spaghetti and meatball" code is messy object-oriented code.

Maybe "ravioli code" is the term I was looking for.

RoBoTiCxLiNk
13-03-2011, 23:39
our team has around 1000 with approximately >75% of that commented out.
thats an average of around 1000 per programmer
and about 15% of the comments are actually useful code while the rest is mainly failed experiments and debugs

JosephC
19-03-2011, 13:09
We have around 1300 lines of code now that we finally got an autonomous. say 400-500 lines of that are commented out. We're working on streamlining it right now, hopefully to what it was last year. Which was 800.

Since we only have 2 programmers right now (me - a freshman, and the lead programmer - a senior) we both typed like 900 lines a piece, then pieced it together, and greatly reducing what we like to call "Jimmy's mess"

youxinche95
29-03-2011, 00:00
Our team is up to about 600 lines; however, it should not be a competition to see who has the most lines of code. It usually promotes bad habits with object oriented programming, which was made to minimize the amount of copy and pasting. Sorry if I sound any less than trying to be nice. ;)

Sotha
29-03-2011, 15:37
Including comments I have about 200 lines total, this includes autonomous, minibot deployment, pneumatics, arm, and holometric drive system. I used the simple template since I am the only programmer and I have other responsibilities such as work. Can't wait to test it out on Thursday :)

Aaron V
29-03-2011, 17:06
Wow, I'm impressed - I would consider myself at least an average coder, but I only have roughly 200 - 250 lines of code. What kind of features are writing for your robot? Personally, I can't imagine many driving assisted features that would fill up thousands of lines of code - though maybe if I actually tried to write a driver assisting system I'd start getting code pretty quick.

carrillo694
29-03-2011, 23:21
We've got a respectable 1878 lines or so. Our largest file, the autonomous class, has around 400 lines. Our smallest file, interface ThreeLaws.java, holds its ground with a whopping 20 lines. Of course, its implementations in other classes inflate the line count somewhat :D

Tom Bottiglieri
30-03-2011, 00:16
As of this check in: 4,486 spread over 74 source files. Might hit 5,000 by next weekend. :p

alexhenning
30-03-2011, 20:11
799 Lines of code. counting blanks, comments, closing brackets and so forth.

For those of you commenting out code, you should use version control (such as git) so your code is cleaner and you don't have to wade through a sea of commented code.


~/workspace/BlackJag/src $ wc -l org/usfirst/frc348/*.java
120 org/usfirst/frc348/Arm.java
38 org/usfirst/frc348/BreakoutBox.java
106 org/usfirst/frc348/DriveTrain.java
136 org/usfirst/frc348/JagBot.java
22 org/usfirst/frc348/Utils.java
422 total
~/workspace/BlackJag/src $ wc -l org/usfirst/frc348/auton/*.java
93 org/usfirst/frc348/auton/Autonomous.java
63 org/usfirst/frc348/auton/DriveBackward.java
65 org/usfirst/frc348/auton/DriveForward.java
51 org/usfirst/frc348/auton/MoveArm.java
49 org/usfirst/frc348/auton/PlacePiece.java
10 org/usfirst/frc348/auton/Stage.java
46 org/usfirst/frc348/auton/ZeroArm.java
377 total

Dacilndak
30-03-2011, 22:45
you should use version control (such as git) so your code is cleaner and you don't have to wade through a sea of commented code.

I absolutely agree with this. Even though I'm the only serious programmer on my team, having a BitBucker Mercurial repository allows me to code on my personal laptop while the drive team is practicing, and also from home if someone else has the workbook. Plus, it saves me from having to type on the workbook's horribly tiny keyboard.

Similar output from "wc" for our project:


bash-3.2$ wc ./*.cpp ./*.h
247 1009 7549 ./Autonomous.cpp
180 567 5936 ./BuiltinDefaultCode.cpp
163 792 5581 ./Controller.cpp
98 472 3292 ./Drive.cpp
112 391 3584 ./Manipulator.cpp
124 371 3521 ./Teleoperated.cpp
82 326 2494 ./Autonomous.h
42 164 1273 ./Controller.h
37 150 1105 ./Drive.h
50 201 1740 ./Manipulator.h
64 255 1996 ./Teleoperated.h
103 558 3793 ./macros.h
1302 5256 41864 total


And yes, we kept the name BuiltinDefaultCode because we are lazy :p .

JesseK
31-03-2011, 11:01
1.7 million lines of SLOC, which only includes logical statements. With comments/whitespace it's more like 5.4 million.

OH!

You mean robot code. I'd have to ask the programming team.

Just thought I'd put our robots into a perspective versus an industrial system.

aaronweiss74
03-04-2011, 20:51
Our code is 1,202 lines of Java. A good portion of which is a result of the other programmer's insistence on using a non-standard, difficult-to-read coding style, which we won't be using following this year.

bdbayes
06-04-2011, 14:33
Our robot runs on approximately 250 lines of code. That does not include an autonomous program.

PatJameson
20-04-2011, 03:39
I am going to use inline assembly next year to squeeze out more juice and performance from the cRio.

What are you going to try to do to have the need to squeeze out more juice, if I may ask?

Also, our's is 1353 lines long at the moment.

virtuald
21-04-2011, 15:53
We're using python:


584 arm.py
297 auto.py
309 robot.py
40 util.py
-----------
222 test.py
253 fake_wpilib.py
-----------
1705 total


So... around 1/3 of the code is unit test / related code, and at least 10% of the rest is comments.

davidthefat
21-04-2011, 19:03
What are you going to try to do to have the need to squeeze out more juice, if I may ask?

Also, our's is 1353 lines long at the moment.

Image processing. We aren't sending any feed to the classmate. All the image processing will probably be done on an off board processor. That is where I will utilize the assembly, especially with object recognition.

PatJameson
21-04-2011, 21:47
Image processing. We aren't sending any feed to the classmate. All the image processing will probably be done on an off board processor. That is where I will utilize the assembly, especially with object recognition.

Interesting. I created a bit of recognition using only java run on a netbook which could send information to the cRIO (http://www.youtube.com/watch?v=PkSawnH8z5I). We didn't use it this year as there were much less complex ways to complete autonomous, though. The netbook had plenty of processing power for what I did with it.

davidthefat
22-04-2011, 21:04
Interesting. I created a bit of recognition using only java run on a netbook which could send information to the cRIO (http://www.youtube.com/watch?v=PkSawnH8z5I). We didn't use it this year as there were much less complex ways to complete autonomous, though. The netbook had plenty of processing power for what I did with it.

Eh, not a fan of Java. But thanks for sharing. I have more ambitious goals I guess.