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.

Add comment July 30, 2008

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

Add comment April 19, 2008

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.

(more…)

Add comment March 1, 2008


Meta

Facets

Add new tag AOP apt aspect oriented programming assumes knowledge autiobiographical bash scripts bell books clarity code samples configuration console emacs for the benefit of google functional programming graphical design hacks higher-order functions howtos intention revealing programming keyboard links linux note to self opinions parsing patterns philosophising philosophizing programming python random ideas refactoring removing packages stories succinct svn systems stuff theoretical philosophizing typing vim viper work ethic you probably don't want to read this

Archives

Pages

 

November 2009
M T W T F S S
« Aug    
 1
2345678
9101112131415
16171819202122
23242526272829
30