|
|
It is currently Sat May 18, 2013 4:54 am
|
| Author |
Message |
|
CyberVillain
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 Location: Stockholm, Sweden
|
WiredEarp wrote: Let us know how he gets on. Personally nowadays I like to start with a solution, then iterate it for efficiency if required. The perfect is the enemy of the good... I agree, BUT that code is below any standard that you can accept.
|
| Thu Mar 01, 2012 6:17 am |
|
 |
|
WiredEarp
Certif-Eyable!
Joined: Fri Jul 08, 2011 11:47 pm Posts: 1165
|
Are you intending to rewrite it completely? Because, if not, my question still is, what is the legality of using it at all? You should probably suss that stuff out...
What you have said your brother was doing was exactly what I am talking about, taking out the gui stuff and that other crud and massaging it into useful code. Thats what I'll be doing for my own purposes anyway. Doing any more than cutting and pasting things into your own new routines and cleaning up some variable names (such as rewriting everything) is probably just a waste of time, unless you need to do so for a particular purpose (such as legal reaons), or you have spare time to waste on stuff like that.
I'm surprised theres no properly written library to use fake TrackIR easily already. All that code should be able to be simplified into a few base routines that would take care of everything else.
|
| Thu Mar 01, 2012 6:59 am |
|
 |
|
CyberVillain
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 Location: Stockholm, Sweden
|
He's just using the code to reverse engineer it to something we can use for our TIR plugin. Let me know if you can use it to get something working, then my brother (Or you) can use that for FreePIE aswell
edit: Btw, you can still be nitty picky about code quality and coding standards, that does not mean you're overdoing it, or as you stated "The perfect is the enemy of the good".. Those two are not the same.. Clean code is always the right way togo, especially in big projects with many projectmembers...
edit2: Thats why I seldom use comments in my code, it tend to add noise that takes away focus from the behavior. Names of methods and members should be so good that you can understand what the codes does without adding alot of noise in form of comments...
|
| Thu Mar 01, 2012 7:42 am |
|
 |
|
brantlew
Petrif-Eyed
Joined: Sat Sep 17, 2011 9:23 pm Posts: 2035 Location: Irvine, CA
|
Have to disagree there. Nothing is more important to code readability than commented code. Not necessarily every input parameter and variable, but having 2 or 3 descriptive sentences before logical sections of code is enormously helpful for code comprehension. Verbose function names and meta-programming constructs can be helpful, but for even moderately complex code they offer almost no help when trying to unravel someone else's logic (or even your own code that you haven't looked at in years) - especially if there are obscure side-effects or intentionally non-obvious code flow. Those things have to be documented.
|
| Thu Mar 01, 2012 9:30 am |
|
 |
|
CyberVillain
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 Location: Stockholm, Sweden
|
Yeah, Im talking about standard business code like this 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);
The code is perfectly understandable without that comment  I also dont like it when people uses comments to group code blocks, put the blocks in own methods or even own classes instead Anyway, i agree with you somewhat, but not completely, code with lots of comments are usually an attempt to make bad code more readable. edit: this is a topic that is very close to my heart so I'll throw in more examples.. This is a live example from our FreePIE code Code: var usedPlugins = scriptParser.InvokeAndConfigureAllScriptDependantPlugins(script);
Do not be afraid of long method names, this is alot nicer then Code: //Lists all plugins that are referenced from the script var plugins = scriptParser.ListPlugins(script);
|
| Thu Mar 01, 2012 9:40 am |
|
 |
|
WiredEarp
Certif-Eyable!
Joined: Fri Jul 08, 2011 11:47 pm Posts: 1165
|
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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 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: 1165
|
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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 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: 1165
|
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: 10021
|
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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 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: 1165
|
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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 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: 2035 Location: Irvine, CA
|
|
| Sat Oct 27, 2012 7:23 am |
|
 |
|
cybereality
3D Angel Eyes (Moderator)
Joined: Sat Apr 12, 2008 8:18 pm Posts: 10021
|
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
Terrif-eying the Ladies!
Joined: Mon Jun 22, 2009 8:36 am Posts: 933 Location: Stockholm, Sweden
|
What did I miss? 
|
| Mon Nov 12, 2012 12:11 pm |
|
 |
|
Who is online |
Users browsing this forum: No registered users and 5 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
|
|