Cybernetic Programming

cybernetics

I’d like to make a proposal for a new kind of programming (at least new to me, LOL). When I was studying back in the nineties I became interested in something called ‘sociocratic organization‘. This is a form of organization based on Cybernetics. Cybernetics is the study of systems with feedback loops. When you think of a thermostat in the room, it has a feedback loop. When it gets too hot, it cools, when it gets too cool, it warms up, and that way it keeps the system in balance. In computer programming we don’t deploy such features normally. We pray that all goes well, and that we didn’t forget anything, and if it does go wrong, the whole system usually crumbles apart. In web programming that’s usually a minor glitch, since just one page of our whole system breaks. In desktop computing it’s much worse. And in embedded programming it’s disastrous. Now instead of writing numerous unit tests, or mathematically proving our program, perhaps it would be possible to use this idea of a feedback loop in many aspects of our programming.

Consider you have to write a program that is to determine the best results for a search, similar to Google (but not as vast, so let’s say a small web site). We need to display what’s relevant to the user, but we don’t know what is relevant. So you just do a simple text search to find a record within a table. Now you check which of the results is clicked for this particular search result, and then you log the search term, and with it the clicked result.

Then a new user shows up and does the same search, and clicks the same result. You increment the counter for this result on this search in the log. After a while we should see our statistics in the table represent what people were searching for, and which records were ‘successful’ to them (at least they clicked it). Depending on these results you can now decide to alter the order of the search results, where the highest scoring record is put on top of the search results page.

Pretty nifty. I Googled it and found that Microsoft Research has written a paper on something similar. So expect this to Bing us soon.

Advertisements

2 thoughts on “Cybernetic Programming

  1. I love to hear people talking about Cybernetic programming. I have been implementing cybernetic approaches to my code for a couple years now. Essentially, what cybernetic programming means to me is, something like an operation or method call creates a change which alters the environment (at least a specific scope’s environment). This change can either affect other environmental scopes or the global scope, and in addition, can affect the action just taken to produce a different outcome than that of a non-cybernetic scope action. This is one reason why I like Bidirectional-Data-Binding (such as in AngularJS) and Reactive Programming. One example is:

    Say you have a search controller for an input element. This ‘SearchCtrl’ has a few functions. It can do two different operations between two datasets: It can perform filters onKeyPress or return data when the user clicks “Search”; it can filter and return data for present data (already in scope) or go fetch data from an API when the user clicks Search. Basically, your SearchCtrl watches for changes to the input element a produces a filtered list of results containing the search term at its current length. The tough part is creating a Stack Data-Structure (LIFO – Last In First Out) so that as they type, a list with the current filtered results is displayed. When the user types in the next letter, a filter on the *last list is performed (mostly for efficiency, but is also cybernetic) and the *new results list is *pushed to the stack. As we chose a Stack structure we did so for specific reasons: When the user deletes a character in the search term, you want to show them the previous results list (*pop). To make this more cybernetic and autonomous, we can simply coordinate the SearchTerm length with the index of each results-set in our stack (mind the One-Off – you want to have Stack-index-zero to be the full, unfiltered results list) so that you never perform any actual Push/Pop calls except for clean up (pop) and you can simply use the search term’s length. Along with this, you can employ functionality like that of the Search in this article to get a better idea of what SearchTerm-prefixes led to what desired data.

    Like the article, want to see more 🙂

    1. hey, thanks for the lengthy reply! Interesting ideas you have. I once read about a user interface design where all menu items were simply placed on the website, and then by constantly monitoring statistics it would place items more in front or at the end of the menu ribbon. Right after the site goes live it’s a mess, but over time the system becomes more usable, and also adapts itself to changes in user preference. You could even make a hierarchical menu this way.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s