|
|
It is currently Sat May 25, 2013 9:44 pm
|
| Author |
Message |
|
WiredEarp
Certif-Eyable!
Joined: Fri Jul 08, 2011 11:47 pm Posts: 1182
|
I disagree actually, at least with your first example. IMHO, there is no way it is made more readable by removing the comment. Quote: Code: //List all VIP customers var customers = customerRepository.ListAllCustomersBy(CustomerTypes.VIP);
One improvement you can do though to the above code to make it more readable without comment is Code: var vipCustomers = customerRepository.ListAllCustomersBy(CustomerTypes.VIP);
I believe in long, descriptive method and variable names, but comments are a good thing. I can look down a screen of code, and just read the comment sections until I get to the code I wish to work on. Otherwise, I have to read every line and understand what is is doing. Now, while you can make this better by putting it into descriptive methods/functions etc, I'd still want comments in those functions. Comments are there so you don't HAVE to read all the code, and can thus save you significant time, especially when reading something written by someone else (who, while they may have used long function names etc, may not have chosen the names you would have logically used). Re the TrackIR code, i'll let you know if I get something useable out of it. Unfortunately, i've broken my Hydra (stupid flex cables!!!) so until I've repaired it I can't work on the Hydra side of things. Do you have any TrackIR testing programs or know of a good quick loading app to test things with? I'll probably start by building FaceTrackNOIR, and confirming it actually works, before I bother doing anything more...
|
| Thu Mar 01, 2012 9:06 pm |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
WiredEarp wrote: I disagree actually, at least with your first example.
I believe in long, descriptive method and variable names, but comments are a good thing. I can look down a screen of code, and just read the comment sections until I get to the code I wish to work on. Otherwise, I have to read every line and understand what is is doing. Now, while you can make this better by putting it into descriptive methods/functions etc, I'd still want comments in those functions. Comments are there so you don't HAVE to read all the code, and can thus save you significant time, especially when reading something written by someone else (who, while they may have used long function names etc, may not have chosen the names you would have logically used). Well if you have that amount of comments you're talking about it will be as much (Probably more) text as the code, which means you have to read the same amount of text to find the place you want, the difference is that well structured code is faster to read and understand than comments, so its actually faster just to read the code (If its well structured). Oh, and Visual studio comes with very good refactor tools, so its not a problem to rename a method, even if its used on 200 places. So if someone has selected a bad name thats not descriptive enough, you can easily change it. If your interested to know more about these concepts google the term "clean code", its a very good topic to read up on for any developer. WiredEarp wrote: Re the TrackIR code, i'll let you know if I get something useable out of it. Unfortunately, i've broken my Hydra (stupid flex cables!!!) so until I've repaired it I can't work on the Hydra side of things. Do you have any TrackIR testing programs or know of a good quick loading app to test things with? I'll probably start by building FaceTrackNOIR, and confirming it actually works, before I bother doing anything more... I use Freetrack to test reading with, once we have reading working you can use GlovePIE or a game to test writing... (THe game has to be using the older trackir dll's that are uncrypted) edit: By the way, this i a better name for the returned list to make it more readable then the comment, also keep in mind that the comment needs to be duplicated everywhere the list is used (If it does not have a good name explaining whats in it) Quote: var allVipCustomers = customerRepository.ListAllCustomersBy(CustomerTypes.VIP);
|
| Fri Mar 02, 2012 2:09 am |
|
 |
|
WiredEarp
Certif-Eyable!
Joined: Fri Jul 08, 2011 11:47 pm Posts: 1182
|
Quote: well structured code is faster to read and understand than comments An English summary of a function (for example), is always going to be quicker to read than the more voluminous code in the function, even if that code has been simplified into logical and obvious routines. The same applies to code blocks. All I could agree on, would be that I hate those who comment everything. It should be kept to summarize a segment, to save you having to look at the individual elements unless you have to. Visual Studio's built in refactoring support actually does not exist in VB.Net (among maybe others). edit: yeah im not interested in the reading side of TrackIR, just the writing. Using GlovePIE could be a plan. I just want something quick that will show me its working for real. I think you can hack many of the encrypted interface games to support the unencrypted interface (people with older TrackIR's need to do this I believe).
|
| Fri Mar 02, 2012 7:08 am |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
WiredEarp wrote: Quote: well structured code is faster to read and understand than comments An English summary of a function (for example), is always going to be quicker to read than the more voluminous code in the function, even if that code has been simplified into logical and obvious routines. The same applies to code blocks. All I could agree on, would be that I hate those who comment everything. It should be kept to summarize a segment, to save you having to look at the individual elements unless you have to. Visual Studio's built in refactoring support actually does not exist in VB.Net (among maybe others). edit: yeah im not interested in the reading side of TrackIR, just the writing. Using GlovePIE could be a plan. I just want something quick that will show me its working for real. I think you can hack many of the encrypted interface games to support the unencrypted interface (people with older TrackIR's need to do this I believe). Google TackIr Fixer, its a program that has to be running along side the game and your TrackIR emulator, it intercepts the messages and encrypts them.. Downside is that TrackIR fixer has to be updated for each new game :/ Its clearly that we have different views here, but if you were correct that would mean languages like basic would be easier to read because its more close to reading actual text, but C# is a much easier language to read, so.... You're wrong!  Its offcurse a matter of taste..
|
| Fri Mar 02, 2012 7:41 am |
|
 |
|
WiredEarp
Certif-Eyable!
Joined: Fri Jul 08, 2011 11:47 pm Posts: 1182
|
Yeah, thats the app. I believe it supports most important TrackIR applications (which are mostly sims) so as long as you don't require multiplayer, its probably a good way to use fake TrackIR. I notice that Carl Kenner claims hes using a new method with the latest glovePIE to do the TrackIR stuff. Does anyone know what he is referring to? I'm wondering if his new method works without TrackIRFixer. Looks like glovepie.org has been hacked currently, so I can't quote what he said. Not sure what you were saying about basic... i was talking about comments, not the language? I really don't find either of those two easier to read, you can have crap code in both. C# does have more structure to it however, which is useful with undisciplined coders (makes it harder to use lots of global variables and such). IMHO, whatever works for you and your colleagues, is properly laid out, and easily maintainable and extensible, is the important thing. The world wont end with or without the comments. However, you could always script a VS addon to hide all comments, letting those of us who like them continue to use them 
|
| Fri Mar 02, 2012 8:08 pm |
|
 |
|
cybereality
3D Angel Eyes (Moderator)
Joined: Sat Apr 12, 2008 8:18 pm Posts: 10049
|
I used to place a comment above every single line of code, which was helpful in a sense but over-kill. Now I rarely comment, but I find that is even worse. If you read Code Complete 2, the author makes a fair point that the better way to code is to write the comments, and *only* the comments first (as in english psuedo code). This helps you to better understand the problem and think it through before you commit to a certain structure or algorithm. Then you write the code. Seems like a solid method, but I haven't tried it yet.
I think the key thing is that it is *much* quicker to skim though english comments and quickly find the line of code you need. Otherwise you have to basically read and understand whole blocks of code, made harder when the original coder does unorthodox things, or you have a bunch of cryptic variable names. Comments help a whole lot in those cases.
_________________
|
| Fri Mar 02, 2012 10:16 pm |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
wired: I just meant that Basic is closer to English then C# but still Basic code is harder to read just for that it IS close to a real language (They even made a Swedish version of the language, horrible  ) cyber: Well, blocks of code are never good, refactor them into classes or methods  If you need comments put them in the method or class header using 3 /// Then it will be readable from code completion... In well structured code its never hard to find the right place because he only looks on the flow of the code (calls for method and objects) and when he do find the place of interest he only needs to look at the code for that part, nice and easy, without the use of too much comments  By the way, you guys do not need to feel afraid to commit Plugins to FreePIE i wont bash you for not coding like I want 
|
| Sat Mar 03, 2012 4:51 am |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
Neither FreePIE or GlovePIE seems able to send TrackIR commands to Grid Race Driver, but Freetrack can. For Future pinball all 3 works.. Any ideas?
|
| Thu Mar 22, 2012 11:30 am |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
CyberVillain wrote: Neither FreePIE or GlovePIE seems able to send TrackIR commands to Grid Race Driver, but Freetrack can. For Future pinball all 3 works.. Any ideas? Anyone good at Delphi wanna give a crack at porting Freetrack TrackIR emulator to C#? http://dl.dropbox.com/u/33026505/FreeTrack.rar
|
| Thu Mar 22, 2012 11:55 am |
|
 |
|
WiredEarp
Certif-Eyable!
Joined: Fri Jul 08, 2011 11:47 pm Posts: 1182
|
Quote: Neither FreePIE or GlovePIE seems able to send TrackIR commands to Grid Race Driver, but Freetrack can. For Future pinball all 3 works.. Any ideas? Does FaceTrackNOIR work for sending commands to Grid Race Driver?
|
| Thu Mar 22, 2012 5:59 pm |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
WiredEarp wrote: Quote: Neither FreePIE or GlovePIE seems able to send TrackIR commands to Grid Race Driver, but Freetrack can. For Future pinball all 3 works.. Any ideas? Does FaceTrackNOIR work for sending commands to Grid Race Driver? Nope, if it did it would mean I had missed something in my port 
|
| Fri Mar 23, 2012 2:09 am |
|
 |
|
brantlew
Petrif-Eyed
Joined: Sat Sep 17, 2011 9:23 pm Posts: 2042 Location: Irvine, CA
|
|
| Sat Oct 27, 2012 7:23 am |
|
 |
|
cybereality
3D Angel Eyes (Moderator)
Joined: Sat Apr 12, 2008 8:18 pm Posts: 10049
|
The spammer is now gone. 
_________________
|
| Sat Oct 27, 2012 2:19 pm |
|
 |
|
Bartolomeudias
One Eyed Hopeful
Joined: Mon Nov 12, 2012 12:45 am Posts: 1
|
FreePie is good choice i vote for FreePIE dapfor. com
|
| Mon Nov 12, 2012 1:00 am |
|
 |
|
CyberVillain
Certif-Eyable!
Joined: Mon Jun 22, 2009 8:36 am Posts: 959 Location: Stockholm, Sweden
|
What did I miss? 
|
| Mon Nov 12, 2012 12:11 pm |
|
 |
|
Who is online |
Users browsing this forum: Bing [Bot] and 2 guests |
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot post attachments in this forum
|
|