Posts tagged ‘philosophising’

Hardcoding parameters into function names

Code seems to sometimes be slightly easier to read if information is pushed out of the arguments and into the function name.

I.e: Set(‘Color’, red) —> SetColor(red)

This has the nasty effects of making one’s APIs rather large, but if used sparingly it:

  1. Makes APIs more discoverable – the naming of function now contains information which would otherwise be in the usage of functions
  2. Makes code slightly easier to parse – Mostly just because we have removed an argument from the argument list
  3. Make code using the API slightly easier to write

Bear in mind that this statement is heuristic and general… so is probably wrong most of the time. Also I kind of suspect that all of this may immediately become false when two arguments rather than on are pulled out of the argument list and into the functional name.

This statement is, however, particularly true when your different operations take slightly different data as one of the other arguments vary.

July 30, 2008 at 10:47 pm Leave a comment

How configuration should work.

If you use emacs you might know about the “customize-apropos” command. This command will take a regular expression and search for all settings that match it. Scripts written in emacs lisp can register settings so that this command can find them. For any of the settings found it is possible to jump to a group of similar settings. This is a very nice way of doing configuration.

In fact some applications do do such things: in windows vista is is now possible to search the control panel for controls (though the granularity is quite a lot higher and one can’t use regular expressions).

I also quite like the idea of ‘faceted selection of options’, for want of a less pretentious name. Those interested in the ‘semantic web’ seem to quite like this concept. The idea here would be that each system setting would have a number of facets associated with it. For example a setting might have a ‘string facet’ indicating it is a string type, a ‘networking’ and ‘security’ facet, and perhaps an advanced facet. When searching for settings one could could specify a number facets to restrict results together with search strings. This might well make it a great deal easier to find settings, and would remove the ‘guess the taxonomy’ game that one normally needs to play when looking at configuration options. It also means you don’t

April 19, 2008 at 1:03 am Leave a comment

Principles of graphical design

I watched quite a good video on the principles of graphical design, by Steven Wittens, which can be found here.¬† To try to somehow take credit for someone else’s work, and to help me understand thetopic I thought I’d try to summarize some of the things he said, and develop some of his ideas. Be aware that what I say here is as much me thinking aloud as it is summarizing someone else’s. This means you aren’t allowed¬† to form negative assumptions about Steven Wittens based upon what I say.


March 1, 2008 at 8:36 pm Leave a comment

June 2017
« Nov