0

code analysis could give some statistic numbers, which are not determinant, but good to start with, if you are looking at some design defect or bad coding practice. such KPIs could be how many methods in a class, or how may levels of if/else used...

is there some code metrics for MVVM program?

for example, one thing i noticed in one of our last project is, each class sounds not big, but there's a tree that make the possible workflow very complex: ViewModel Command => Business Method => ViewModel Properties => ViewModel "Navigation Properties" (hidden/shown/collapse/expand) Note: I call it "Navigation Properties" as the whole MVVM project's navigation is based on MVVM binding, but setting some VM properties as hidden/shown/collapse/expand, the GUI is navigated.

is there some special design "trap" that MVVM might fall into, and KPI's to watch that?

athos
  • 6,120
  • 5
  • 51
  • 95

1 Answers1

0

As a general habit, I like to run "Calculate Code Metrics". (right click on the project and select Calculate Code Metrics in visual studio 2010) The maintainability index and clyclomatic complexity scores give you some indication of KPI.

With MVVM, even if your "tree workflow" is longer, it will be simpler than through other mechanisms if done right. I would suggest that most of the time, the tree will be shorter in MVVM as well.

Having said that, generating a lot of events can cause your app to slowdown, so it is good practice to only use raise the "property changed event" when the property has a change of value ( explicitly check it is different in your property setter )

Anton
  • 7,709
  • 5
  • 31
  • 33