Changes between Version 15 and Version 16 of HowtoGoodProgrammingTechniques


Ignore:
Timestamp:
Feb 19, 2013, 4:00:35 PM (11 years ago)
Author:
Thanatermesis
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • HowtoGoodProgrammingTechniques

    v15 v16  
    2020
    2121When you programming, you will see that your code needs to be intelligent, he needs to know ''what to do now'' and how to deal with specific situations, this is a lot more easy to reach with states, in short, '''put boolean states everywhere''' they are cheap!, on that way we can always know how to deal in specific situations, but by other side we don't want to have a flooded code or confused states, so we need to think in a good way to organize them in our code, for example, the prefix '''is_''' is one of the best ones to use, just think about the possibilites to have states marked like ''is_sources_get'', ''is_sources_compiled'', ''is_interactive''... So everytime your application does a specific thing, you can set or unset the affected variables to define the state/progress of the application to know what to do next. Your application can also have different ways of work, so you can prefix those states with '''mode_''', see for example ''mode_interactive'' or ''mode_editing'', another useful one is also the '''ignore_''' prefix in order to ignore steps on our application.
     22
     23It's important to think about the possible ''expected'' situations, since we are humans this is hard to reach but we need to keep in mind (by using any tip if needed) every different situation, like ''if the file is deleted when...'' or ''if at the same time the user...''
    2224
    2325== Special Situations ==