# codeswap: an experiment idea to compare coding style efficiencies

i am really curious how effective my "avoid creating types" approach would be compared to the object oriented approach. i am thinking of creating an experiment for it. not that i would ever conduct such an experiment but thinking about it is fun. i am not even sure where would i get people for this experiment but suppose that problem is solved. now imagine i have a room full workstations next to each other like in a typical open plan office. the experiment would involve having the participants solve a series of related programming challenges on these machines under a time constraint. then they would need to swap their solutions and continue working on other people's code. the swap also changes the problem the participants are supposed to solve. there are two problems, the swap is done a way that it changes the problem for everyone. to make sure there is no language barrier, i would ask each participant to use the same language. something simple, e.g. c, go or python. i would ask the participants to brush up their language skills before coming to my test. i would also make the environment equally bad for each participant so that the environment has very little effect on the results. to be specific: all i would give them is just a terminal that is split into two windows: left side runs the nano text editor, right side runs a terminal app that shows how correct their solution is. every time they hit save in nano, it updates the right hand side with the results. i would split the experiment itself into the following phases:

i am not sure how to implement the swapping phase yet: i can either ask the participants to swap desks, or i can make the computers shuffle the code around. either one works. if the latter, i need to be careful to prevent participants from saving utility functions somewhere for reuse. they should completely lose everything they have written so far.

the two problems would be very similar when reduced to the core but they would be phrased differently and put into different context so that it is not obvious that it is the same thing. but at the same time the two problems must be different enough so that the participant cannot just simply delete everything and rewrite stuff from memory.

the motivational text would have 2 dimensions, totaling in 4 different texts:

after the experiment is done, i would ask them to fill a survey. for each phase it would ask the following binary questions:

my hunch is that in the design/impl phase the nocomments+abstraction group will feel the most fun, ease and productivity but the comments+noabstraction group will get more stuff done. in the continuation phase:

in other words: the continuation phase is not fun since people do not really like to work on other people's code. working on non-abstract code will be much easier and people will feel more productive afterwards. the "comment+noabstraction continues on comments+noabstractions" group will have an advantage though: if they followed the recommendation, they should have come up with roughly the same structure so they should be more familiar with the new codebase.

and if it turns out that is the case then i will be vindicated. most software is just a different configuration of the same underlying concepts. there is no need to abstract away all this but rather what is needed is learning to recognize patterns. the professional chess example is very apt: pro chess players can instantly recognize very complex state in the middle of a pro match. even though they might even give some states a name (an abstraction), it is not the name that helps them recognize the state but rather the fact that they worked with so many different chess states so long. it is the experience that matters rather than ensuring every little concept has its own name. in fact, take two random pro chess players: if they talk different languages they will not be able to talk with each other much. but show both of them the same chess board and it is very likely that both of them will make the same next step. this next step is obvious from the abstraction-free chessboard. yet if they cannot see the chessboard, they will pretty much not be able to agree what should be the next step solely because they do not know what the other person is talking about.

when working with code, all we can do is to project the code's concepts into concepts we already know. for instance as part of my sysadmin work i often project the software into the realm of linux system calls. i am very familiar with those and as long as i can understand the code in terms of syscalls, i can pretty much have a rough idea what it is trying to achieve and how. a code feels complex when i cannot do this projection. so my recommendation is to stay on this level, avoid creating concepts that have unclear projections onto the well known concepts. and i am not saying to completely avoid creating new concepts. rather only create a new concept if you have a handful of usecases (at least three): then i can see the concept from various angles and i can learn why is it an useful concept. otherwise it is just a like a useless signpost saying "this is a signpost".

anyways.

as for the problem: i am not sure about this yet. it needs a theme and a bunch of small and easy problems related to that theme so the participants can solve some of them. maybe something like this: you are managing a garden. your task is to read the garden description and help the farmers answer a few questions:

obviously i need to think more about this part but that is the rough idea. the other problem could be very similar but it would be zoo themed. you would have animals and zookeepers instead. or maybe school themed where you would have teachers, students and grades. dunno, this is just an implementation detail.

thinking about this even gives me an idea on how to approach learning the ways of software development if you have access to a buddy: both should start a project each but nearing the end have the other person finish it. iterate this (while occassionally changing buddies) until you feel confident in coding. every time you do a swap, there is a lot of context that needs exchanging. but if you do this often enough, over time it will be clear what sort of documentation or coding styles you need to write or use to make your code easy to pick up. i wish more people would be better experienced in this area of software development. oh well. might be a silly idea but still interesting to me.

maybe if i were a university professor with lots of time on his hand, i could conduct such experiments on my students. hmm.

published on 2019-03-03


posting a comment requires javascript.

to the frontpage