Code analysis
-
CodeWraith wrote:
I hope I sucessfully fooled you into coming over and expecting a beer.
I'm at your door, why won't you open!? :laugh:
CodeWraith wrote:
you must see that your one and only style may be just as problematic or misleading for the next guy
Never in the current team because they all know and recognize the style. And I hope the next guy (or girl) needs a few minutes to get used to it and then says, "alright this code seems tidy which makes it easier for me to read it and understand it".
CodeWraith wrote:
when someone writes something upper-, lower, camel- or even briefcase?
When I see a variable in PascalCase I assume it's either a constant, a method or a property. Likewise, when something is camelCased I assume it's a private variable, scoped to the current method or class. When I see an underscore prefix I assume something's a field (and that the programmer is a little older). I'm fine with a different styles, it's not my way or the highway, but this is something a lot of (.NET) programmers can relate to and sticking to that style will make things easier to read for many programmers after me. Of course, when I'm doing JavaScript I never use PascalCase and use camelCase instead. Again, I've seen PascalCase JavaScript and I'm fine with that, as long as it's consistent (although the first sight of PascalCase in JavaScript does trigger me a bit because it's unexpected). In the end, however you write your code, I will be able to understand it and to change it, but your code style (or lack thereof) may be the difference between a "that wasn't so bad" and a "wtf was that idiot thinking!?" :) Style will never make up for lack of skills and if I had to pick between a skilled and sloppy developer or an unskilled and tidy developer, I'd go for the skilled one. But why not skilled and tidy? ;)
Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Sander Rossel wrote:
But why not skilled and tidy?
As long as you don't make a religion of it, including conducting code reviews like the inquisition and hobby advocates who constantly add new rules to the 'style guide', plus previous decisions of the inquisition and lists of exceptions to the rules. I prefer not to degrade the entre team to code monkeys or better secretaries. Remote controlling everyone and dictating exactly what they have to write and where they have to put it is much too stressy. Then it's easier to just write it myself. A more tolerant approach does not descend into anarchy. Your team will automatically find a style that everyone can live with, simply because they start to feel responsible when they are not constantly discouraged by some control freak. I learned that lesson very early, at a place where most people would not expect it.
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
Not General Order 24, just to be sure?
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
You lost me there... :O But I might not be the only one here, even Google seems to think Order 24 is a hoax?! :O [star trek - Does General Order 24 really exist? - Science Fiction & Fantasy Stack Exchange](https://scifi.stackexchange.com/questions/175830/does-general-order-24-really-exist)
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
-
Super Lloyd wrote:
Avoid excessive inheritance
Quote:
A type is more than four levels deep in its inheritance hierarchy.
Wow. I have seen samples to teach about inheritance which already are 'excessive' by this definition.
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
Static code analysis gives you an indication where your code might not be optimal. It is not like they are carved in stone. It's like going to a doctor; checking helps to prevent larger issues and doesn't cost much, but you are still allowed to ignore the warnings about your smoking-habits.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
-
Static code analysis gives you an indication where your code might not be optimal. It is not like they are carved in stone. It's like going to a doctor; checking helps to prevent larger issues and doesn't cost much, but you are still allowed to ignore the warnings about your smoking-habits.
Bastard Programmer from Hell :suss: If you can't read my code, try converting it here[^] "If you just follow the bacon Eddy, wherever it leads you, then you won't have to think about politics." -- Some Bell.
This particular doctor costs more than it's worth by mindlessly applying rules which are so restrictive that even code samples are already 'excessive'. What would you say about a doctor who at the same time lectures you about eating too much and doing too much physical work? An apple and some bird seeds may be enough for a supermodel, an athlete would not come very far if he tried that. As we know, computers do not really shine when it comes to good judgement and intelligently combining separate results. That's also why I see the current AI hysteria with horror. I would sooner let a trained monkey drive my car than a computer. This thing here is not quite as dangerous. It just wastes my time with countless irrelevant warnings and drowning out the relatively few ones that might be relevant.
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
You lost me there... :O But I might not be the only one here, even Google seems to think Order 24 is a hoax?! :O [star trek - Does General Order 24 really exist? - Science Fiction & Fantasy Stack Exchange](https://scifi.stackexchange.com/questions/175830/does-general-order-24-really-exist)
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
Order 66 is from Star Wars, General Order 24 from Star Trek. It may be unusual for the 'good guys', but in some situations you must show your muscles when someone does not want to listen to anything else. They would probably not have had to go all the way to the bitter end, but anything less would end any hope of avoiding it altogether. War is a messy business.
I have lived with several Zen masters - all of them were cats. His last invention was an evil Lasagna. It didn't kill anyone, and it actually tasted pretty good.
-
the problem when people go into fight over style, not only it is an endless pointless waste of time, but also people have extremely simplistic style guideline. like the eternal recurring waste of time "always use brace after an if" sorry, but I have like 5 bracing style depending on context and length of enclosing statement.... and your over simplification is as irking to me as I am to you.... But go ahead, restyle my code, I don't mind.... Further.. I found many case where this obsession over style and patterns over functionality was getting in the way of fixing bug and was in fat creating new ones... :( In a way, I am NOT an Apple person.
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
-
Super Lloyd wrote:
But go ahead, restyle my code, I don't mind....
This is what Ctrl-K Ctrl-D is for. It allows me to restyle your code for me to read easier.
Yeah my boss here has a unique style settings and he restyle all files he gaze upon. That's funny! :D
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
-
Style is important because you're writing code for developers to read, not for computers. When style is consistent, code will look familiar at first sight and it will save any other developer, or you next year, the trouble of first deciphering the syntax before actually trying to understand what it does. When I see code that's not properly formatted or otherwise inconsistent I immediately assume the developer is lacking in skill and/or professionality and I'm usually right. It's really easy to keep code consistent, especially with today's tools, and it saves a lot of effort when reading it so why not just do it?
Best, Sander sanderrossel.com Continuous Integration, Delivery, and Deployment arrgh.js - Bringing LINQ to JavaScript Object-Oriented Programming in C# Succinctly
Style should be only a matter of choice, point of view of the reader or writer. Saving the code should be style independent and be given by the grammar of the language. I have experienced "git" fundamentalists who have banned the use of high level XML editors (= even for web.config, etc.) because saving in a different style evokes file changes. So you must not use advanced XML tools, etc. In a word, you must be a stupid programmer. As long as IT focuses only on technology and business logic is a minor matter, we will still have to deal with 90 to 95 percent of the time with uselessness and not with useful programming. So we will come up with new languages and practices (like DevOps) and increase Babylon. After all, guessing what the program is doing (for all hell) is amazing fun, isn't it?
-
I just turned my message analysis on... And in the see of 400 warning for library I am look at right now. I think I spotted 2 useful comment.... They really need to improved this feature... :/ (i.e. I can't spot the 0.5% useful comments most time) like style | possible error | pattern recommendation EditorConf seems all about style as far as I can see... :( [EditorConfig settings - Visual Studio | Microsoft Docs](https://docs.microsoft.com/en-au/visualstudio/ide/create-portable-custom-editor-options?view=vs-2019#add-an-editorconfig-file-to-a-project) I certainly don't care about style consistency in my home project. Better yet, I like to change style over time! Ha! Take that stupid style enforcer! [EDIT] Found a solution.. instead of simply ignoring code analysis.. I create a ruleset, disable everything and the cherry pick a few promising looking rules... what I really would like to know is, how easy to make new one? I'd like to create a warning when people to await Task object (which throw no warning in non async method by default)... Would caught some bug in our project... :/ [EDIT2] I checked those 3 rules - Avoid excessive inheritance - Avoid excessive complexity - Avoid unmaintainable code Now I am curious to see where it will apply ^^ [EDIT3] The fracking ruleset doesn't work! (in Visual Studio 2019 Community) I told it to ignore rule 2208, restarted Visual Studio, it still warns me about it... That's it, stuff it, I can't be bothered to use it anymore... there might be 0.5% useful warning, but they are just too hard to use...
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!
I like your comments about wanting the freedom to change styles over time. In general we are getting sick of 'Nannyware' that keeps telling us what to do or not to do.
-
I like your comments about wanting the freedom to change styles over time. In general we are getting sick of 'Nannyware' that keeps telling us what to do or not to do.
Thanks man, glad the feeling is shared! :) And indeed I have heard less complaint about consistent style those last few years...:O :)
A new .NET Serializer All in one Menu-Ribbon Bar Taking over the world since 1371!