Jay Baz [MS] weblog: parting words for dear friends
Before leaving, I would like to express some suggestions for M $ software development.
ClearCodeValue Chain
M $'s many developers have not yet understood how much value it brings to writing clear and easy-to-read code. I once saw a guy check in another 600 lines of code in the middle of a 200-line function. I think that function has already had over 597 lines! Completely usableExtract MethodSplit the code segment into small particles, and then useExtract classTo solve the problem of too many small functions. With persistent efforts, reconstruction optimization can continue.
Oo is not eye-catching
In the past five years, M $ has made it very complicated to make the software safer. Security Assurance is complex, but there is no reason to make the software more complex. For example, in C ++ code, if the transfer buffer does not carry its length, it will cause numerous buffer overflow problems. Then, we have written a tool to help you detect where the buffer is passed in the code, and ensure that the length of the buffer is passed in each place at the same time.
However, when you find that you pass more than two parameters everywhere, why don't you put them in a class? Starting from here, polymorphism, inheritance, and encapsulation can be discussed later.
(HI, windows, I am talking about you !)
It's good to use other people's code.
It is said that the Visual Studio Code contains more than a dozen C ++ string class implementations, most of which are just cutting down the MFC code. Well, there are indeed some improvements over passing the buffer zone, ...... The authors of these "library functions" can all work with a full-time salary! Why cannot I use existing STL and ATL ??
This not only exists in C ++ ...... In the early implementation of. NET Framework, the implementation of hash table is countless. Alas, can't you use a ready-made database directly?
Solve Problems with Design
Every time a problem occurs, we have to trace back and ask ourselves, "How can we ensure that this error will never happen in the future ?"
Buffer overflow? Use a buffer class to ensure its normal operation. Is there a problem with the reference count? Try ccomprt. Is the cache damaged? Delete the external processing and encapsulate it.
In the last C ++ project, we did this. Finally, we found that our c ++ code looks like C #. One of the reasons is that C # is far away from the redundant design of C ++.
The most important thing: we can do better.
Some specific details can be individually located. At that time, this blog became obsolete. However, developers of M $ can often do one thing to make their work better. Ask yourself every day like this:
"How can we ensure this problem will never happen again ?"
"How to Reduce bugs ?"
"Is there a simpler way to fix bugs ?"
"Is there a simpler way to quickly respond to changes ?"
"Is there a simpler way to make myProgramFaster running ?"
I once managed a team and it worked quite well. Most of the team members are new students and have just left college. But a year later, they were all great. They develop faster features, fewer bugs, faster bug fixing, and successfully complete schedule each time. Their performance far exceeded those groups consisting of more experienced Members who frequently encounter incomprehensible issues by writing code in a familiar way. This surprised me.
PS:When I am still at M $, I hope I can try to solve these problems, but this is too difficult and my attempt fails. This blog may be my last chance to do something for it. Now, it's up to you.