Home
Do you look for large strings in code?
  v3.0 Posted at 26/06/2012 8:50 AM by Tiago Araujo

Long hard-coded strings in a codebase can be a sign of poor architecture.

​To make hard-coded strings easier to find, consider highlighting them in your IDE.

longstringbadexample.png
Figure: Bad Example - The connection string is hard-coded and isn't easy to see in the IDE. longstringbadexample2.png Figure: Better Example - The connection string is still hard-coded, but at least it's very visible to the developers. longstringgood.png Figure: Good Example - The connection string is now stored in configuration and we don't have a long hard-coded string in the code.

Related rules

    Do you feel this rule needs an update?

    If you want to be notified when this rule is updated, please enter your email address:

    Comments: