in reply to How to think.
That said, I like to either draw diagrams or write things down, or both. Programming is much more reality-based than a lot of people realize (because ultimately anything you code turns into either 0's and 1's or "bytecode" which is, like, weird). One question that I'm always asking when thinking about designing an object is:
From that the methods and attributes become clear. For example, in the app I'm working on, I created a "table service" object (Powerbuilder calls them objects, but you might refer to them as classes as well).
What does the table service know? It knows:
- How to add a new table (by giving it a name ie. "table_serv.add_table('#TEMP_TABLE')".
- How to add columns to the table (ie. a prototype for that function might be "table_serv.add_column(string name, string coltype, bool allow_null)"
- How to create the table in the database.
- How to drop said table.
- How to make a modification to the table's definition.
- How to insert rows of data into itself.
As it turns out, I did write a table service, but it wasn't quite as ambitious as the list above (ie. I hardcoded the INSERT's in my code, it's not yet a capability of the table service). And this list simplifies it somewhat, because the table service is really a wrapper around an array of table objects, each of which has its own array of column objects. But hopefully you get the idea.
In fact I use this question all the time. I use it for debugging apps, configuring apps, understanding my environment and more.
For example, I had a problem with a web site host (for a site I'm developing for a client) where I would go to www.thedomainiregistered.com and it wouldn't go to the /home/username/public_html/ dir that it should have (instead, it went to a system-wide DocumentRoot, because obviously the admin hadn't yet put my homedir's public_html dir as the DocumentRoot). I thought to myself "Apache should know that when I say www.thedomainiregistered.com it should go to my /home/username/public_html/ directory". In other words, the concept of "who knows what" made me realize that it wasn't a programming problem, but an incompetent Apache admin. As it turns out, I'm in the process of dealing with this being fixed right now. :)