Posts

Showing posts from March, 2021

Par for the course, Also refactoring showcase #1

Image
 Of course, as per usual i neglect to update this even slightly... i have a handful of drafts, but they never get published. At any rate, new goal for this blog: Showcasing neat ways in which refactoring has altered sections of code i'm actually working on. Too often, people will show "demo code" to highlight how certain techniques are useful, i intend to use this blog to show how i'm refactoring actual production code First off, two small examples: Example #1: This code comes from an algorithm to translate an artificial "genome" into a neural network layer, specifically the part where i decide which "flavor" of network layer to use Before refactoring: After:   GetActivation checks the available data, as well as validating that an activation function was correctly generated, throwing an exception upon failure instead of returning null. Example #2:   Same program, now coming from some genetic mutation-related code, specifically the "mutation...