The computer should be working harder

 Computers are cheap, well compared to developers anyway.



The developers time is expensive, this is why although computational power has expanded exponentially, the user experience of simple programs like the word processor has stayed relatively the same.

What windows xp managed to do on a 300mHz chip was quite astounding. Nowadays you will not get away without using a 1GHz chip and if you don’t have multiple cores and giggs of ram forget about being able to run a word processor.

I’m editing this post in google docs, and this helps make my point.

When you used ms word on windows 95 or xp the word processor was written in C. The elements were optimised to run on x86 32bit processor.

That took a lot of effort, the memory had to be managed by the developers as is the case in C. You had to malloc some memory into existence for only the time you needed it and you needed to make sure you unallocated it as soon as it was no longer needed.

128mb of ram is not much to work with after all, not to mention how slow reading from hard disk was.


Now we have languages like python, which abstract away memory management and lots of other things. That makes the program much quicker to write but way less efficient. For tasks which do still tax modern CPUs the code is still written in C and then accessed from python using wrapper.

All of this is because spending a little more on a better pc is so much cheaper than spending 10x as much or more on developers.


To that end I would like the computer to be working harder for me when I am writing code.

Modern IDEs do already work much harder than they used to, we have live code checks, so that syntax errors and even some other rules such as use-before-assignment are highlighted like spelling errors as you type.

I even have this functionality in VIM, albeit only run on saving the file.


I want more.


I like to follow TDD, creating small specifications of the functions before I write them. I find for most development it helps focus my mind on the next failure. Almost making each change stateless in my head. All I have to do is run the test and fix the error, repeat.

It helps me get into a state of flow, the zone. With my setup my hands stay in position with only my fingers moving from the home row.


There are plugins for VIM and modern IDEs that allow for the results of tests to appear alongside any syntax/parsing warning and exceptions. I havn’t set this up yet for a couple of reasons.

Running the tests continuously, or even on each save will tax the computer I am working on and cause it to appear slow.

The systems I have seen struggle to know what tests to rerun and which to leave.


This second point, to an extent causes the first. The syntax parser reparses the whole file to generate the errors. That’s fine for something like a parser, running a whole test suit isn’t going to work. Even running a single test file which exists to test the file I’m working on is too much.

It would be nice if given the coverage report, only the tests which had coverage over the new changes were run. That could perhaps get the computational cost down to a reasonable level to be run on save. It would still cause the machine to hang slightly on save as even the parse causes on some larger files. So the other thing I would like is to be able to run these tests on a co-processing machine connected to the network. Perhaps just a second machine sitting under the desk.


While it isn’t running the priority job of testing the most recent changes it should be running mutation tests on the file to check the code coverage and generating those sorts of reports.

The real application I desire though, is that given a partially written function and a failing test over that function, the co-processor should be trying to find simple changes to the failing function that would stop it from failing.


I’m not talking about a full genetic algorithm trying every possible combination and creating it’s own variables. I don’t trust this program to create new functions or name any new variables.

I’m simply talking about changes to perhaps the symbols maybe try x-y instead of x+y. Maybe if the exception is Obj has no attribute getThing but does have the attributes get_thing and get_things, then it could try the test changing that over.


That would mean that while I get a coffee, or even while I take a sip from my coffee while reading some messages from my colleagues the state of progress is progressing.


I’m not asking for the computer to do the work for me, simply as I don’t have to run the tests to see that I’ve mistyped or misspelt (Dyslexia much) a variable name,


I already use autocomplete so only to have to remember the first few characters of any variable name. That helps with getting the right calculator, calculater, calculatar.

The read before write checks help with calendar vs calandar. (calender, calander, calandor)

I prefer the VIM ctrl+n to IDE based autocomplete that tries to be more helpful, for one because it works inside string quotes. That helps me no end when trying to access elements from a dictionary (hash map).

The other is that the word-based autocomplete works better when writing new functions where the variables don’t yet exist. I write a lot of small functions and so this is more often the case than not for me. I haven’t found a better autocomplete which when inside quotes uses word-based complete, likewise with as of yet undeclared functions, but that uses the more intelligent autocomplete of the likes of Kite when trying to access an attribute of an object.


Comments

Popular posts from this blog

An exploration in number systems

Structural engineering with cardboard