Best way to get rid of hungarian notation?

前端 未结 20 1173
萌比男神i
萌比男神i 2021-01-18 20:52

Let\'s say you\'ve inherited a C# codebase that uses one class with 200 static methods to provide core functionality (such as database lookups). Of the many nightmares in th

20条回答
  •  北恋
    北恋 (楼主)
    2021-01-18 21:33

    I'd say a bigger problem is that you have a single class with 200(!) methods!

    If this is a much depended on / much changed class then it might be worth refactoring to make it more usable.

    In this, Resharper is an absolute must (you could use the built in refactoring stuff, but Resharper is way better).

    Start finding a group of related methods, and then refactor these out into a nice small cohesive class. Update to conform to your latest code standards.

    Compile & run your test suite.

    Have energy for more? Extract another class.
    Worn out - no trouble; come back and do some more tomorrow. In just a few days you'll have conquered the beast.

提交回复
热议问题