Go to Post I know it's hard to believe, but there actually IS life after FIRST. - jleibs [more]
Home
Go Back   Chief Delphi > Technical > Programming
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
View Poll Results: How many files does your code consist of?
1 4 11.76%
2-5 8 23.53%
5-10 8 23.53%
10-15 6 17.65%
15+ 8 23.53%
Voters: 34. You may not vote on this poll

Closed Thread
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 22-02-2011, 20:48
davidthefat davidthefat is offline
Alumni
AKA: David Yoon
FRC #0589 (Falkons)
Team Role: Alumni
 
Join Date: Jan 2011
Rookie Year: 2010
Location: California
Posts: 792
davidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud ofdavidthefat has much to be proud of
Organized, multiple source code vs everything in one code.

What I have noticed is that many teams have just one file source code. Now, I did that last year and I felt very guilty about that. I felt guilty because I usually have multiple source code projects, and those projects are the ones that I really did not care for. I have been taught to use multiple files. What does that tell you about my attitude about the code last year? Now this year we have over 15 files; had we programmed in C++, that would be double that (header and cpp file duos). The code repository is not updated, but you can get the feeling for the mentality here.

Now how many of you guys do what I refer to as "all in one" sources?
__________________
Do not say what can or cannot be done, but, instead, say what must be done for the task at hand must be accomplished.
  #2   Spotlight this post!  
Unread 28-02-2011, 13:48
Christopher149 Christopher149 is offline
Registered User
FRC #0857 (Superior Roboworks) FTC 10723 (SnowBots)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2007
Location: Houghton, MI
Posts: 1,104
Christopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond reputeChristopher149 has a reputation beyond repute
Re: Organized, multiple source code vs everything in one code.

We currently have a relatively large (~600 lines) main source file, plus another for tracking the scoring peg targets. We may do more breaking up of files, but step one is to make working code, then worry about pretty code.

While we have only two source files, we have at least broken several functions off into their own methods, which provides very useful organization. All-in-one methods (or functions) are far worse than all-in-one source files IMO.
  #3   Spotlight this post!  
Unread 28-02-2011, 15:01
BigJ BigJ is offline
Registered User
AKA: Josh P.
FRC #1675 (Ultimate Protection Squad)
Team Role: Engineer
 
Join Date: Jan 2007
Rookie Year: 2007
Location: Milwaukee, WI
Posts: 947
BigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond reputeBigJ has a reputation beyond repute
Re: Organized, multiple source code vs everything in one code.

1675 practices object-oriented design.

I don't think it's about how many files you have, but rather your paradigm. We have 9 source files right now I think.
  #4   Spotlight this post!  
Unread 28-02-2011, 15:07
basicxman basicxman is offline
Emily Horsman
FRC #2200 (MMRambotics)
Team Role: Programmer
 
Join Date: Oct 2007
Rookie Year: 2007
Location: Burlington, Ontario
Posts: 971
basicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant futurebasicxman has a brilliant future
Send a message via AIM to basicxman Send a message via MSN to basicxman Send a message via Yahoo to basicxman
Re: Organized, multiple source code vs everything in one code.

Quote:
Originally Posted by BigJ View Post
1675 practices object-oriented design.

I don't think it's about how many files you have, but rather your paradigm. We have 9 source files right now I think.
* basicxman approves this message

So long as everything is readable, organized and easy to maintain - you are doing something right.
  #5   Spotlight this post!  
Unread 28-02-2011, 15:31
demosthenes2k8's Avatar
demosthenes2k8 demosthenes2k8 is offline
Graduated but not gone
AKA: Matt Soucy
FRC #0166 (Chop Shop 166)
Team Role: Mentor
 
Join Date: Jan 2009
Rookie Year: 2007
Location: Merrimack, NH
Posts: 589
demosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to beholddemosthenes2k8 is a splendid one to behold
Send a message via AIM to demosthenes2k8 Send a message via Yahoo to demosthenes2k8
Re: Organized, multiple source code vs everything in one code.

We do things COMPLETELY object-oriented. Each task runs as an object, and thus can be enabled or disabled by commenting out their instantiation, and if one crashes, the rest won't.
We have 48 source/header files...
__________________


GSR Dean's List Finalist 2011
  #6   Spotlight this post!  
Unread 28-02-2011, 15:43
apalrd's Avatar
apalrd apalrd is offline
More Torque!
AKA: Andrew Palardy (Most people call me Palardy)
VRC #3333
Team Role: College Student
 
Join Date: Mar 2009
Rookie Year: 2009
Location: Auburn Hills, MI
Posts: 1,347
apalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond reputeapalrd has a reputation beyond repute
Re: Organized, multiple source code vs everything in one code.

According to Windows, I have 192 files in my code folder (which includes the robot code and the dashboard, as well as project files and non-VI files).

However, LabVIEW lends itself to having lots of files and I tend to break lots of stuff into re-usable modules that are sometimes shared between multiple sub-systems. According to VI Metrics:

Robot Main has 124 user VI's under it.
Autonomous Thread has 10 user VI's under it
That does not include any of the auto VI's that are called by ref, there are about 15 of them, or the autonomous routines themselves (which are not VI's).
__________________
Kettering University - Computer Engineering
Kettering Motorsports
Williams International - Commercial Engines - Controls and Accessories
FRC 33 - The Killer Bees - 2009-2012 Student, 2013-2014 Advisor
VEX IQ 3333 - The Bumble Bees - 2014+ Mentor

"Sometimes, the elegant implementation is a function. Not a method. Not a class. Not a framework. Just a function." ~ John Carmack
  #7   Spotlight this post!  
Unread 28-02-2011, 19:50
MagiChau's Avatar
MagiChau MagiChau is offline
Registered User
AKA: Michael Chau
FRC #0085 (B.O.B. (Built on Brains))
Team Role: Alumni
 
Join Date: Jan 2010
Rookie Year: 2010
Location: Zeeland, Michigan
Posts: 875
MagiChau is just really niceMagiChau is just really niceMagiChau is just really niceMagiChau is just really nice
Re: Organized, multiple source code vs everything in one code.

My source code files aren't exactly organized the best way. I have a file for the addresses for devices that is called by the main class when constructing the objects. There is one for settings so I could do things like change sensitivity on the acclerometer or change the timeout period for the encoders in one list just for easier way to access than scrolling through the main class.

Regarding actually make stuff do things, as of now I have a class containing code for autonomous, a in-progress one for initiation(teleop, auto, and robot), one for the arm, one for driving, and another for the claw. I probably should have auto/teleop files that calls on code for each component that is then is called to the main file. Didn't really think myself through this season.
  #8   Spotlight this post!  
Unread 01-03-2011, 00:17
remulasce remulasce is offline
Registered User
no team
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Mtn View
Posts: 140
remulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to beholdremulasce is a splendid one to behold
Re: Organized, multiple source code vs everything in one code.

Every mechanism has its own object, from its own class in a separate file. For instance, DriveStation2011.py deals with getting which button from where on the driver station. Everything that needs button presses goes through GetTriangle() or similar, so if the triangle button changes port it's all in one place. For safety, every motor system has its own motor output class, and the system has access to its own sensors in addition to the regular code. That way, we can put limit stops in the actual motor output and so long as we drive motors through the output class, we never have to worry about it anywhere else. We also created DualSpeedControllers, which allow us to treat two motors as one when setting outputs. On top of all that, there is a LineFollowing class for driver aid which is used by both autonomous and teleop to keep track of what state it is in- the driver holds down a button and it follows a line. The LineFollower object keeps track of whether it is drifting off in which direction and also whether we have already found a fork and are refollowing it, etc, exactly the same as in auto, so if we make line following better in auto, it automatically is better in teleop.
__________________
Student 294: 2007-2011
Mentor 597: 2013-2015
Google SWE: 2015-

Last edited by remulasce : 01-03-2011 at 00:20.
  #9   Spotlight this post!  
Unread 01-03-2011, 01:38
Robototes2412's Avatar
Robototes2412 Robototes2412 is offline
1 * 4 != 14
FRC #2412 (Robototes)
Team Role: Programmer
 
Join Date: Jan 2010
Rookie Year: 2007
Location: Bellevue
Posts: 312
Robototes2412 is on a distinguished road
Re: Organized, multiple source code vs everything in one code.

can you post a copy of that on the python forum? I need a good excuse to get python on my team's school demo robot (it fires t-shirts, three injuries and no lawsuits yet, lol).
__________________
Code:
class team2412(GP):
    def __init__(self):
        GP.__init__(self)
        self.coopertition = True
        self.info = {"name": "Robototes", "school": "Sammamish High School, Bellevue, WA"}
        assert self.kind_people == True
  #10   Spotlight this post!  
Unread 01-03-2011, 20:55
BugByte's Avatar
BugByte BugByte is offline
Registered User
AKA: Blair Chisholm
FRC #2537 (Space RAIDers)
Team Role: Mentor
 
Join Date: Jan 2011
Rookie Year: 2010
Location: MD
Posts: 46
BugByte is an unknown quantity at this point
Re: Organized, multiple source code vs everything in one code.

We separate everything into tasks. When it comes up that something needs to be continually checked or set it becomes a task. These send information and commands to each other with message queues. Our software mentor comes from an old-school embedded programming background. I don't know off the top of my head how many files we have but I think around 10.
Closed Thread


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 23:36.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi