Opinions required on 'code tidying'



  • @blakeyrat said:

    @DaveK said:

    @Enterprise Architect said:

    C-C-C-COMBO BREAKER!

    I think you're too late there, we pretty much wrapped that one up already!


    Number Two does laugh. I guess I could have posted a laughing image.

    Shh!  I was hoping he wouldn't think of that!

    Anyway, I reckon that "User was boinked for this post" was the punchline.  So I'm calling it a narrow win on points :-)



  • @MarkJ said:

    @miner49er said:

    @Rick said:

    They both seem readable to me. If your manager actually asked you to change your style to his, then you have a perfect right to be annoyed. But if you want your manager to switch to your style, then you are definitely making a mountain out of a molehill. (Has anyone actually seen a molehill? Pictures anyone?)

    He goes through my code and 'tidies' it up, this is just one example (I think he uses an automated tool to do changes like this). I understand that he is the boss and ultimatly it's up to him how the code looks - I don't have  to agree with it though. Or be happy about it.

    I'm curious as far as what tool would automatically convert you original code to ternary expressions?  I used an automated tool to adjust indentation and align braces, but it wouldn't generate ternary expressions.  I think your original code is more readable.

    VS 2010 loves to change small if/elses to ternary operators.



  •  I prefer your version. I find the boss' version harder to read. In general I don't use the ternairy operator if the statement doesn't fit on one line.

     The automated code changes don't sound to great either.



  • @Sutherlands said:

    VS 2010 loves to change small if/elses to ternary operators.

    Really? I've never had Visual Studio 2010, or any version of Visual Studio, do that to my code, so I'd like to see this in action.



  • @PsychoCoder said:

    @Sutherlands said:

    VS 2010 loves to change small if/elses to ternary operators.

    Really? I've never had Visual Studio 2010, or any version of Visual Studio, do that to my code, so I'd like to see this in action.

    I've seen ReSharper do that (as in, suggest you change them to ternaries, and give you a menu with an option to do so automatically). I don't think it was a VS feature, but it's possible that it got rolled into 2010 (I haven't played with 2010 very much).



  • @toth said:

    I've seen ReSharper do that (as in, suggest you change them to ternaries, and give you a menu with an option to do so automatically). I don't think it was a VS feature, but it's possible that it got rolled into 2010 (I haven't played with 2010 very much).

    So far I haven't see it on vs2010, resharper, well that is another history, it also push for changing standard object declaration and replacing it with var



  • @serguey123 said:

    @toth said:

    I've seen ReSharper do that (as in, suggest you change them to ternaries, and give you a menu with an option to do so automatically). I don't think it was a VS feature, but it's possible that it got rolled into 2010 (I haven't played with 2010 very much).

    So far I haven't see it on vs2010, resharper, well that is another history, it also push for changing standard object declaration and replacing it with var

    Yeah, that pisses the hell out of me. Luckily, you can disable it pretty easily.



  •  Yes, it's resharper that is used.



  • @toth said:

    @serguey123 said:

    @toth said:

    I've seen ReSharper do that (as in, suggest you change them to ternaries, and give you a menu with an option to do so automatically). I don't think it was a VS feature, but it's possible that it got rolled into 2010 (I haven't played with 2010 very much).

    So far I haven't see it on vs2010, resharper, well that is another history, it also push for changing standard object declaration and replacing it with var

    Yeah, that pisses the hell out of me. Luckily, you can disable it pretty easily.

    I have a buddy who keeps nagging me to try ReSharper. Knowing it does these things? I don't want to... I'll just with VS's auto-format, which is WTF-free.



  • @blakeyrat said:

     I have a buddy who keeps nagging me to try ReSharper. Knowing it does these things? I don't want to... I'll just with VS's auto-format, which is WTF-free.

    Besides that behavior, that can be easily disabled and is a suggestion only, is a good tool and used wisely it can be a great asset.  Most of the time is the people that do moronic stuff with the software as in this case.  You can tell resharper that certain code pattern are better than others and it will nag you to change them for code correctness (by nagging I mean a colored squiggly line below the offending line of code and a small colored bar in the right side of the IDE).  Some of the stuff it does is beyond what Visual Studio does, as naming convention, nesting reduction, etc.

    You should test it to see if you like it and never give it to your boss.



  • @blakeyrat said:

    @toth said:
    @serguey123 said:

    @toth said:

    I've seen ReSharper do that (as in, suggest you change them to ternaries, and give you a menu with an option to do so automatically). I don't think it was a VS feature, but it's possible that it got rolled into 2010 (I haven't played with 2010 very much).

    So far I haven't see it on vs2010, resharper, well that is another history, it also push for changing standard object declaration and replacing it with var

    Yeah, that pisses the hell out of me. Luckily, you can disable it pretty easily.

    I have a buddy who keeps nagging me to try ReSharper. Knowing it does these things? I don't want to... I'll just with VS's auto-format, which is WTF-free.

    I actually love ReSharper. I've been lobbying my company to pay for current licenses so we can use it with VS2010. It's really quite easy to customize its nagging. There's a large number of rules, for which you can set level from "Ignore" to "Show as error". It's just one or two of its defaults that annoy me. Until I take the 10 seconds required to hide them.


Log in to reply