c# - Disadvantages to using lots of if statements -


apart code readability, why bad use lots of if statements?

if have lot of if statements 1 after other, switch case statement more useful. @ least has fixed response time each possible inupt not need fall through if statements.

a lot of if (and else) statement indicates

a) violation of single responsibility principle

b) need refactor out strategy design pattern


Comments

Popular posts from this blog

Add email recipient to all new Trac tickets -

asp.net - repeatedly call AddImageUrl(url) to assemble pdf document -

java - Android recognize cell phone with keyboard or not? -