samedi 17 octobre 2015

large dynamic language spaghetti project refactoring ??

I forked a project on github. ~1000 lines of python, single file of course. I can't bear reading this kind of code, so I devised to refactor it.

I don't have a battle tested method. Of course I have some ideas, isolate functional dependencies, scopes. Gradually eliminating global variables. The issue is I did it on the fly, without a clear plan, a `framework`. Now 2 weeks in, 70% of the code base is cleanly modular now, the code run, but I saw some regressions, nothing major but still, I haven't the slightest idea of how many and how large the regressions are. That brings me back to the framework thing. Refactoring isn't an object, I understand it, it's a craft. The first idea is of course surrounding the code base with regression tests. The original project had none, no tests at all. And I only learned unit testing on OOP, not on black boxes / god module. What else can one do ? how to make the migration as logical, documented and predicatble as possible ?

smallest possible working commit

When coding I often have to fight my urges to change existing code too much. New way to write a function, decouple big into small ones, reorder them, rename variables, etc etc[1]. This is the artsy part of my brain trying to express ... but it's counter productive. I need another dogma, another fetish. Recently I landed on the idea of challenging myself to make the smallest possible set of changes to a piece of code in order to fix an issue. That includes not even fixing loose formatting. Anything that isn't directly and strictly necessary to resolve the problem shouldn't be done. yet.

Ergonomic and aesthetic modifications will be done in a following commit.

As mentioned in [2], Single responsibility principle applies here to.

[1] Or even working on many changes at once.
[2] http://programmers.stackexchange.com/questions/10793/when-is-a-version-control-commit-too-large

jeudi 8 octobre 2015

parallella headless ubuntu image default credentials

In case you're too impatient to search for them after downloading the OS image from here http://www.parallella.org/create-sdcard/

The credentials are: parallella/parallella (listed on step 5 tab https://www.parallella.org/quick-start/#tab-1416026896334-4-8)