Answer the question
In order to leave comments, you need to log in
Code style in .NET applications. Have you seen hell in code?
I worked in one organization for a year and a half, I wrote several projects myself. the code in terms of design is just almost perfect. Without any nonsense like Hungarian notation, etc.
I explain. If there is a normal IDE, then the Hungarian notation is not needed, the code turns into ripples from a mixture of abbreviations that only annoy. Hovered the mouse, saw the data type, and in fact everything is clear when you look at the code. I clicked on the variable, it was highlighted everywhere in the code. Everything is simple and clear.
I have seen code where variables looks like this:
public void Method(string[] arlines)
{
int nIndex = 0; //далее эта переменная используется на 3 строках ниже
//и всё! Нафига писать, что она типа int в названии?
//Ну видно же, что это за переменная парой строк выше.
}
public static bool Serialize(CEventContainer ob, byte[] arDest, int nIndex) { }
Answer the question
In order to leave comments, you need to log in
Why write C at the beginning of the class name, if the whole dotnet is written in a normal, human style?Because those who wrote this have no experience and are new to C# development.
hmm
unit what i heard
I don't know how correct this is, but that's how I use it
It's obvious to me that this was written by former C/C++ developers. This is an ancient notation, many call it Hungarian, only here it is some kind of perverted version (I must say that the Hungarian notation itself was correctly used by units at one time, most did not fully understand its meaning). Now they don’t write like that on the pluses themselves, but for Sharp it’s bad manners. Gives the notation n in front of the index name (it means exactly "index", not int, although they usually write nUnit or nEmployee, not nIndex) and C in front of class names.
Completely agree with you.
Not so experienced guys wrote this code, and they are definitely not in trouble with code formatting in C#. They probably wrote a long time ago, when C# still appeared, and all C++ programmers started writing in it, retaining all their habits, many of which are unnecessary or even harmful.
The fact that different classes are decorated differently is not a big problem, not all projects manage to maintain the same style (although it's worth it of course).
This is also a plus - normal people, of course, use namespaces, but there they are not as ubiquitous as in C #, because assembly technology is fundamentally different.
And this, apart from your team led by a team leader, and even with the involvement of managers, no one can solve it. If you are ready to refactor half of the product, go ahead. Not ready - better not touch. Write new code in an appropriate style. If it were C++, I would even advise you to format the new code according to the rules of the project, but THESE rules within C# are completely inadequate.
I summarize: if there are no resources for code processing, be patient. Patience and the ability to work with legacy code that is not of the highest quality is probably the most important trait of a "team programmer". Old and not the prettiest code is a reality, it is just as real as dilapidated buildings that you just can’t rebuild without serious investments.
You were lucky in terms of code quality. Now not so lucky. As AtomKrieg said , it's good that it's not Cobol (at least then you would be paid even more).
Normal XML comments in C# code are generally a luxury. I see them only in serious libraries, and in any corporate trash only the most important classes in the program (10-15 pieces) are commented like that. Be glad there is documentation at all. If you have the desire and time - transfer it to the code, it will certainly be useful.
on my project, the team lead puts commas at the beginning of the line, like
Method(int a
, int b
, int c)
The main thing is that the code works and the architecture is reasonable. And how it is designed is the second question. There is also a point to hard-to-read code: it's harder to steal. I write this myself when I return from a shift and am tired. After all, Visual Studio has a lot of good code analysis tools.
Codestyle
Visual Studio Code analysis rule set reference
The rules must be agreed upon by the company and specific groups of developers in advance so that everyone follows them at once. You already know all this, but not everyone uses it.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question