Is there any justification for this change? Change in variable pattern

Asked

Viewed 101 times

6

A coworker read on a forum that using shorts, int and long was the right and best way for the system’s performance, so it began to change on all screens and classes it worked on. I searched and saw no gain except the fact that there is some loss of bytes when working with double conversions, but the issue is not that, the issue is that is changing the pattern of the system that was done all using Int16 types,Int32 and Int64, and then we have a few classes and screens with another pattern.

The question is: Is there justification either by default for development, system gain, or be more beautiful to use like this? Any reason for this deregulation of development that this "improvement" is generating?

  • 2

    What language are you talking about ?

  • 1

    Yes, it’s from C# (.NET)?

  • @Nelsonteixeira C# . Net

3 answers

3

Generally, there is no justification to counter the established standard. If the project is using 100% int, long, and short, continues to use, even with Int16, Int32, and Int64.

Now, I think the worst thing I could do is leave the project with this mixture -- it’s hard to keep track of which pattern I should be following.

If your colleague started to change everything to int, I believe I would have changed all, leave nothing in the other way.

  • I agree, that’s what I argued. But this fellow said: "Each of us has a way of programming, we will never program the same way."

  • 1

    Yes, every programmer has a way - but in the area of development, the team establish a standard, as the team will have to keep the source code. There’s a saying here in the States that describes a programmer who wants to do everything differently simply because they can: Cowboy Coder

  • Faced with this comment: "Each of us has a way of programming, we will never program the same way." makes me think he wants to change because he WANTS to, without any other apparent justification and much less technical.

2


There is absolutely no difference between one and the other except the reading of the code by a human.

The alias figure as a keyword (keyword) of the language, but the use, function and operation is identical to using its type or equivalent class.

shorts, int, long, string... sane nicknames (alias) C# for your types in . Net Framework (System.Int16, System.Int32, System.Int64 and System.String, respectively) and during execution it will make no difference whether you used one or the other to declare the variable.

As for your colleague to do differently from what has been done and to claim that each one will encode in a way, it contradicts the common sense that the team should choose patterns, informally or formally if necessary, and everyone should adopt the standards.

When all the code follows the same pattern, after getting used to this pattern no one feels uncomfortable reading someone else’s code and we are excused from having to make the fateful read-mode "key" every time we read another code.

In addition to the style standards that avoid constant reader adaptations, there are also standards for safety, robustness, code quality. If a team does not even follow the style patterns, it will follow other even more important patterns?

One evidence of the importance of the team following an encoding pattern is the existence of specialized tools in it (for example: Stylecop, Fxcop and Resharper).

After all, there is justification for this amendment?

The only plausible justification is your colleague’s preference for this style he’s adopting.

Any other justification is lack of information or just a lie.

  • Today this colleague is no longer in the company, with his departure today after talking with the rest of the team I made a survey of the classes he modified so that we can open tasks to fit the standards of the project. In total we have to change 1229 lines of code. :) Something that will be queued because it is not a priority, and probably the system will never be entirely in the original pattern. Thank you to everyone who bothered to answer this question.

2

I believe that if he is programming ALONE in a project he could do the way he thinks best, but since there is a team, there must be rules and standards established and agreed with it at the beginning of the project.

Anything that is outside the standards should be justified by the reason that it does not follow what has been agreed, even if it is through a simple one-line comment.

I agree that each one has a different way of programming and neither one or the other will be wrong, but for a project the best form is defined (not to end up being "miscellaneous), standards must be established.

In order to change any pattern, it must be justified and then debated and accepted by all. Even if it is simple and takes about 10 minutes to happen, but it is the team, not one or the other, that decides. At least this one has the authority to go over the others but still I don’t think it would be the best alternative.

  • I agree, I even agreed that it was like this in new systems, but as already said before on every screen that it touches, whether new or old system it does this.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.