<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by willemodendaal on Medium]]></title>
        <description><![CDATA[Stories by willemodendaal on Medium]]></description>
        <link>https://medium.com/@willemodendaal?source=rss-fe5575303cd2------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/2*aEm0btOESkLZkEkcw97PVQ.png</url>
            <title>Stories by willemodendaal on Medium</title>
            <link>https://medium.com/@willemodendaal?source=rss-fe5575303cd2------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 14:50:05 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@willemodendaal/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[In Phoenix, how does the router, controller, template, and view code work together to render…]]></title>
            <link>https://medium.com/@willemodendaal/in-phoenix-how-does-the-router-controller-template-and-view-code-work-together-to-render-d16a42d02f22?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/d16a42d02f22</guid>
            <category><![CDATA[phoenix]]></category>
            <category><![CDATA[elixir]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Sun, 17 Apr 2022 08:40:27 GMT</pubDate>
            <atom:updated>2022-04-17T08:40:27.083Z</atom:updated>
            <content:encoded><![CDATA[<h3>In Phoenix, how does the router, controller, template, and view code work together to render something?</h3><p>A brief tour of how different parts of Phoenix work together to render a view in the browser.</p><p>Note that this is for plain-old Phoenix, not LiveView.</p><p>Let’s say the user is an administrator and wants to see a list of users in the system. She types “<a href="http://localhost:4000/users">http://localhost:4000/users</a>&quot; in the browser. What happens in Phoenix to render the “users” page?</p><p>Here are the parts of the pipeline that we’ll explore:</p><ul><li>Router</li><li>Controller</li><li>View</li><li>Template</li></ul><h3>The Router</h3><p>The request goes through the endpoint and some plugs and ends up at the router, where the router tries to match the “/users” url to a route.</p><p>router.ex:</p><pre>scope &quot;/&quot;, MytoolsWeb do<br>    pipe_through :browser</pre><pre>    get &quot;/users&quot;, UserController, :index<br>    get &quot;/users/:id&quot;, UserController, :show<br>    get &quot;/&quot;, HomeController, :index</pre><pre>    get &quot;/trade&quot;, TradeController, :index<br>  end</pre><p>The routes are evaluated, and a match is found on the “/users” route. The /users route configuration specifies that the <em>action</em> to call is the UserController’s :index action.</p><p>Note the pipe_through function call on line 2 above. That says that the request should go through a <em>pipeline</em> called :browser. The pipeline is also configured in the router file:</p><pre>pipeline :browser do<br>    plug :accepts, [&quot;html&quot;]<br>    plug :fetch_session<br>    plug :fetch_live_flash<br>    plug :put_root_layout, {MytoolsWeb.LayoutView, :root}<br>    plug :protect_from_forgery<br>    plug :put_secure_browser_headers<br>  end</pre><p>^ This is where you would configure logic that should apply to multiple routes. Like logging, authentication, etc.</p><h3>The Controller</h3><p>The index function in controllers/user_controller.ex receives the request. Phoenix passed along the path and querystring parameters in the params parameter:</p><pre>defmodule MytoolsWeb.UserController do<br>  use MytoolsWeb, :controller</pre><pre>  alias Mytools.Accounts</pre><pre>  def index(conn, _params) do<br>    users = Accounts.list_users()<br>    render(conn, &quot;index.html&quot;, users: users)<br>  end</pre><p>The render function accepts the &quot;connection&quot;, the name of the template, and the data passed to the view. In this case, all users are loaded from the Accounts module, and passed on as :users to the template and the view.</p><h3>The Template</h3><p>The controller action tells Phoenix that we want to render the “index.html” template. Phoenix looks for the template file in templates/user/index.html.heex . Note how it infers the templates/user path, based on the controller name (UserController).</p><p>The template, a “HEEX” template, looks as follows.</p><pre>&lt;h1&gt;Users&lt;/h1&gt;<br>&lt;table&gt;<br>    &lt;%= for user &lt;- @users do %&gt;<br>        &lt;tr&gt;<br>            &lt;td&gt;&lt;b&gt;&lt;%= first_name(user) %&gt;&lt;/b&gt; (&lt;%= user.id %&gt;)&lt;/td&gt;<br>            &lt;td&gt;&lt;%= link &quot;View&quot;, to: Routes.user_path(@conn, :show, user.id) %&gt;&lt;/td&gt;<br>        &lt;/tr&gt;<br>    &lt;% end %&gt;<br>&lt;/table&gt;</pre><p>^ The view uses the @users value that we passed from the controller. It also calls a function called first_name, which is exposed by the View, which we’ll cover next:</p><h3>The View</h3><p>The View is an Elixir module, made available to the template by Phoenix. This is where you can define custom functions to be used by the template. Phoenix finds the appropriate view module based on the controller name. The /controllers/user_controller.ex module uses the /views/user_view.ex view.</p><p>Our first_name function is defined in the view:</p><pre>defmodule MytoolsWeb.UserView do<br>  use MytoolsWeb, :view</pre><pre>  alias Mytools.Accounts</pre><pre>  def first_name(%Accounts.User{name: name}) do<br>    name<br>    |&gt; String.split(&quot; &quot;)<br>    |&gt; Enum.at(0)<br>  end<br>end</pre><p>And those are the moving parts that are needed to render a view in Phoenix!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d16a42d02f22" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exception handling and Exception throwing principles]]></title>
            <link>https://medium.com/the-curious-coder/exception-handling-and-exception-throwing-principles-91b66ac6fc51?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/91b66ac6fc51</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[dotnet]]></category>
            <category><![CDATA[csharp]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Tue, 23 Jun 2020 06:44:02 GMT</pubDate>
            <atom:updated>2020-06-23T06:44:02.115Z</atom:updated>
            <content:encoded><![CDATA[<p>Return exceptions for exceptional situations. Return result objects for other non-happy-path results.</p><p>How to identify when is something “exceptional”?</p><ul><li>Exceptional is usually technical in nature, not domain related. (eg. Null ref errors, array out of bounds, connectivity issues, etc.)</li><li>Domain errors should usually be returned as result objects. (eg. No money left in account, booking slot already reserved, etc.)</li></ul><p>The “keep your head down” principle:</p><ul><li>Beware of writing code that assumes things about the caller. A Manager, for example, should not assume how the UI layer behaves (eg. The UI will make sure the user can’t pass this-or-that-kind-of object to update).</li><li>However, It’s ok to make <em>some</em> assumptions about other code in the <strong>same layer</strong>, but even this couples your code to other code. Standalone is better.</li></ul><p>The “healthy boundaries” principle:</p><ul><li>“If someone uses me in the wrong way, I’m allowed to say ‘No!’”. (eg. throw an exception on invalid argument).</li><li>“But I should be clear about what my boundaries are.” (tests, comments, annotations, etc).</li></ul><p>The “savvy courier” principle:</p><ul><li>“When I call external resources (filesystem, network, api, etc), then I should expect transient errors and handle them, usually with a retry with back-off policy, culminating in a hard exception if all retries fail.”</li></ul><p>The “let it bubble up” principle:</p><ul><li>“If I call other code, I can expect it to behave in the expected way.”</li><li>No need to safeguard against unexpected exceptions. We expect the method we’re calling to throw an exception if something weird happens, when it can’t behave in the expected way. In most cases we just let this Exception bubble up to our root exception handling code.</li><li>We need to make sure our root code always catches and logs exceptions.</li><li>We need to make sure our user interfaces can always show that “something went wrong”.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=91b66ac6fc51" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/exception-handling-and-exception-throwing-principles-91b66ac6fc51">Exception handling and Exception throwing principles</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Debugging a tricky production issue]]></title>
            <link>https://medium.com/the-curious-coder/debugging-a-tricky-production-issue-76ef4b098f68?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/76ef4b098f68</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[debugging]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Wed, 06 May 2020 09:58:28 GMT</pubDate>
            <atom:updated>2020-05-06T09:58:28.732Z</atom:updated>
            <content:encoded><![CDATA[<p>Debugging a tricky production issue. Here is what I usually do, in order of preference:</p><ul><li>Replicate locally and step through code to figure out what is going on.</li><li>Add logs and replicate in production, then use logs to debug. This is only feasible if it is easy to do additional deployments that contain the logging code, and if the issue is in-fact reproducible.</li><li>Write similar code to what’s running in production (often starting with a copy/pasted variant of the production code), and try to replicate and isolate the issue that way.</li></ul><p><strong>Important</strong>: Once I’ve found the issue I usually write a unit test or that raises the same error, and then fix the logic.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=76ef4b098f68" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/debugging-a-tricky-production-issue-76ef4b098f68">Debugging a tricky production issue</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Building quality public-facing websites]]></title>
            <link>https://medium.com/the-curious-coder/building-quality-public-facing-websites-983c9956ecc0?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/983c9956ecc0</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[yagni]]></category>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[dry]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Wed, 22 Apr 2020 08:23:32 GMT</pubDate>
            <atom:updated>2020-04-22T08:23:32.935Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m busy adding two very simple screens to our website and feel anxious about how long the work is taking. That got me thinking about what kinds of things you need to consider when you’re building top quality public-facing websites.</p><p>All of these things need to be considered (which is why it feels like the development work is taking “too long”):</p><ul><li>Architecture — balancing YAGNI, DRY, flexibility, robustness and performance. All these these principles push against one another, and it takes time and experience to produce code that strikes the right balance.</li><li>Pages must be according to the designs, “pixel-perfect” ideally.</li><li>Subtle animations to be added to enhance the user experience.</li><li>Pages must be responsive and scale nicely on different browser sizes (and devices).</li><li>Cross browser compatibility must be considered. Which browsers to support officially? Which ones to not “officially” support, but still keep in mind?</li><li>Errors must be handled, especially around API calls.</li><li>Field validation must be done.</li><li>Security must be kept in mind (protect against XSS, XSRF, npm/nuget security vulnerabilities etc)</li><li>Logging must be done, especially server-side, to help debug issues when they arise in production.</li><li>Unit tests, integration tests and UI tests must be written (and stay “green”).</li><li>Code, HTML and CSS must be clean, maintainable and done according to standards.</li><li>Analytics must be added (eg. Google Analytics) so that the business knows how the pages are being used by users and if the feature really adds value.</li></ul><p>That’s a lot! And I probably forgot some things. But this is a good checklist of things to consider if you’re building a website and want it to be top-notch.</p><p>Also, be kind to your developers, they’ve got a lot on their plates (see above).</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=983c9956ecc0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/building-quality-public-facing-websites-983c9956ecc0">Building quality public-facing websites</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[When it’s not over-architecting]]></title>
            <link>https://medium.com/the-curious-coder/when-its-not-over-architecting-17375db4306b?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/17375db4306b</guid>
            <category><![CDATA[software-development]]></category>
            <category><![CDATA[dry]]></category>
            <category><![CDATA[yagni]]></category>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Mon, 20 Apr 2020 06:13:56 GMT</pubDate>
            <atom:updated>2020-04-20T06:13:56.958Z</atom:updated>
            <content:encoded><![CDATA[<p>There is a lot of push-back lately against over-architecting and too-early-abstraction. I think this is great, “DRY” often leads to bad architectures.</p><p>However, I feel it can be harmful if we don’t decide when exactly a thing is “over-architected” or “abstracted too early”. If we don’t take the time to decide, it just gives us an easy excuse to write sloppy code. “YAGNI” gets used as a cop-out.</p><p>Secondly, we have to acknowledge how difficult it is to actually go and change code that’s already out and running in production. It’s very hard! It’s easy to have good intentions to go and refactor things later when it’s necessary (eg. “<em>we’ll extract this component once it’s used three times</em>”), but I’ve seen old un-ideal code linger in production for months and years after it was decided that “yes, this code is a good candidate to be made more dry”. In that time people leave the company and the ideal code vision never sees the light of day. The only thing that remains indefinitely is the sloppy un-ideal solution.</p><p>So how does one identify “over-architecting”?</p><p>Here is what I believe. It’s over-architecting when adding complexity to code in order to…</p><ul><li>Cater for scenarios that will probably <strong>never</strong> happen. Eg. Switching to a different database.</li><li>Optimize for performance where performance is not really critical.</li><li>Make code super DRY, but as a result making code more difficult to follow/debug.</li><li>Decouple code to such a degree that you can’t figure out how code will execute without attaching a debugger to see.</li></ul><p>So, what are the exceptions? When is adding complexity to code NOT over engineering?</p><ul><li>When it makes code more flexible (some complexity <strong>within reason</strong> is ok).</li><li>When it makes code more testable.</li><li>When it sets you up for success (eg. Making it harder to do “bad” things)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=17375db4306b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/when-its-not-over-architecting-17375db4306b">When it’s not over-architecting</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to identify “over engineering”]]></title>
            <link>https://medium.com/the-curious-coder/how-to-identify-over-engineering-63354593f3b0?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/63354593f3b0</guid>
            <category><![CDATA[architecture]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Mon, 23 Mar 2020 07:15:08 GMT</pubDate>
            <atom:updated>2020-03-23T07:15:08.391Z</atom:updated>
            <content:encoded><![CDATA[<p>This is how I identify “over engineering”:</p><p>When adding complexity to code in order to…</p><ul><li>Cater for scenarios that will probably <strong>never</strong> happen. Eg. Switching to a different database.</li><li>Optimize for performance where performance is not really critical.</li><li>Make code super DRY, but as a result making code more difficult to follow/debug.</li><li>Decouple code to such a degree that you can’t figure out how code will execute without attaching a debugger to see.</li></ul><p>Secondly, what are the exceptions? When is adding complexity to code NOT over engineering?</p><ul><li>When it makes code more flexible (some complexity <strong>within reason</strong> is ok).</li><li>When it makes code more testable.</li><li>When it sets you up for success (eg. Making it harder to do “bad” things)</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=63354593f3b0" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/how-to-identify-over-engineering-63354593f3b0">How to identify “over engineering”</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Super short summary — how to live a good life]]></title>
            <link>https://medium.com/the-tinkering-explorer/super-short-summary-how-to-live-a-good-life-cd5a6790a5f?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/cd5a6790a5f</guid>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Wed, 18 Mar 2020 05:35:15 GMT</pubDate>
            <atom:updated>2020-03-18T05:35:15.900Z</atom:updated>
            <content:encoded><![CDATA[<h3>Super short summary — how to live a good life</h3><ul><li>See life as an adventure. Start adventure mode!</li><li>Do things because they delight, or they enrich, or bring some joy.</li><li>For you, then your family, then your community.</li><li>Adventure with your family. They are your club. Be in their space, share in their world.</li><li>With your family: hang out. Champion them. Then for your own well-being: Tinker. Learn. Create. Imagine. Craft. Explore.</li><li>Live according to Buddhist principles, staying detached and present. Meditate.</li><li>At work: add lots of real value. Deliver exceptional quality.</li><li>Be the gentleman. Give more than you take.</li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cd5a6790a5f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-tinkering-explorer/super-short-summary-how-to-live-a-good-life-cd5a6790a5f">Super short summary — how to live a good life</a> was originally published in <a href="https://medium.com/the-tinkering-explorer">The Tinkering Explorer</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Things that depend on things]]></title>
            <link>https://medium.com/the-curious-coder/things-that-depend-on-things-539dcb3f5dde?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/539dcb3f5dde</guid>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Fri, 29 Jul 2016 11:51:10 GMT</pubDate>
            <atom:updated>2016-07-29T11:53:18.553Z</atom:updated>
            <content:encoded><![CDATA[<p>It’s nice to see the IT industry moving in a positive direction, maturing, and building upon earlier good practices. I’ve been reading recently about microservices, and I notice how previous practices enable microservices (which I think is a good thing, by the way).</p><p>For example:</p><ol><li><strong>Microservices </strong>depends on fully automated deployment (eg. continuous deployment?). <a href="http://martinfowler.com/articles/microservices.html">http://martinfowler.com/articles/microservices.html</a></li><li><strong>Continuous deployment </strong>depends on Continuous Integration. <a href="https://www.infoq.com/presentations/death-continuous-integration">https://www.infoq.com/presentations/death-continuous-integration</a></li><li><strong>Continuous Integration </strong>depends on automated testing.</li><li><strong>Automated testing</strong> depends on…? I’m not sure, before my time!</li></ol><p>I’m sure this is grossly over-simplified, but its nice to see how good practices lead to better practices.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=539dcb3f5dde" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/things-that-depend-on-things-539dcb3f5dde">Things that depend on things</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Actually useful Visual Studio debugging features]]></title>
            <link>https://medium.com/the-curious-coder/actually-useful-visual-studio-debugging-features-4832ea9902e5?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/4832ea9902e5</guid>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[visual-studio]]></category>
            <category><![CDATA[programming]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Fri, 20 May 2016 14:33:56 GMT</pubDate>
            <atom:updated>2016-05-23T14:44:50.237Z</atom:updated>
            <content:encoded><![CDATA[<p>Visual Studio 2015 can be a big, slow, beast. But when you’ve got enough horsepower to run it properly it has some fantastic features.</p><p>I find these features particularly useful when debugging:</p><ol><li><a href="https://msdn.microsoft.com/en-us/library/bcew296c.aspx">Edit-and-continue</a>: this used to be very temperamental in older versions of VS, so I did not use. But recently I’ve found it works nicely and it makes my life easier. Pause application… make changes… Continue execution. No restart and recompilation required!</li><li><a href="https://blogs.msdn.microsoft.com/visualstudioalm/2014/10/06/new-breakpoint-configuration-experience-in-visual-studio-2015/">Breakpoint actions (tracepoints)</a>: Tracepoints allow you to add log messages to your code, without having to stop… add log… recompile… restart. It’s a big time saver.</li><li><a href="https://blogs.msdn.microsoft.com/visualstudioalm/2014/11/14/set-breakpoints-on-auto-implemented-properties-with-visual-studio-2015/">Breakpoints on auto-properties</a>: it used to be difficult to set breakpoints on auto properties, but VS 2015 makes it dead-simple. Just hit F9 on the auto property getter or setter.</li><li><a href="https://blogs.msdn.microsoft.com/habibh/2009/07/30/debugging-101-how-to-skip-over-code-in-the-visual-studio-debugger/">Changing the next line of code to execute</a>: this feature has been available for a long time. You can skip code while debugging, or re-execute previous lines of code by simply dragging the yellow current-statement arrow to a new location while debugging.</li><li><a href="https://blogs.msdn.microsoft.com/visualstudioalm/2013/06/27/seeing-function-return-values-in-the-visual-studio-2013-debugger/">Getting the return value of a function</a>: sometimes a function ends with a return statement, but does not give you an opportunity to inspect the value (for example, if “return” calls other functions). You can check the value that the function will return by evaluating $ReturnValue1 in the Immediate window or in the Watches window.</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4832ea9902e5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/actually-useful-visual-studio-debugging-features-4832ea9902e5">Actually useful Visual Studio debugging features</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to understand an existing code-base]]></title>
            <link>https://medium.com/the-curious-coder/how-to-understand-an-existing-code-base-65989642baae?source=rss-fe5575303cd2------2</link>
            <guid isPermaLink="false">https://medium.com/p/65989642baae</guid>
            <category><![CDATA[refactoring]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[willemodendaal]]></dc:creator>
            <pubDate>Mon, 16 May 2016 07:54:19 GMT</pubDate>
            <atom:updated>2016-05-16T07:54:19.582Z</atom:updated>
            <content:encoded><![CDATA[<p>Developers usually love working on a “green fields” project: building something brand new. Green fields projects are fun because you have a lot of creative freedom, you can use the latest technologies and because it’s fast and easy when you don’t have to worry about understanding or breaking existing code.</p><p>Unfortunately, unless you live in startup-land, developers spend most of their time maintaining existing code. It’s boring, but true. And that’s why I put such an emphasis on writing maintainable code.</p><p>Sometimes it’s very difficult to make changes to an existing code-base. Here are four things that I tend to do when I need to understand existing code before changing it:</p><ol><li><strong>Read the unit tests: </strong>if you are lucky enough to have running, passing unit tests, this is a great place to start. It explains the <strong>intent </strong>of the code, and it helps ensure you don’t break it.</li><li><strong>Refactor the code: </strong>Rename variables and rename methods as you explore the code and start understanding it. Usually I can think of ways to make the code-clearer, or rename confusing variables. Rename-refactoring and extract-method refactorings are relatively low risk and make future maintainers’ lives easier too! Note: I only do this when working with a strongly-typed language and a good refactoring tool.</li><li><strong>Introduce unit tests: </strong>this can be time consuming if there aren’t tests already, but very worth it. I often move a method I’m interested in into it’s own class so that I can introduce Mocks and test the hell out of it. First write tests for existing logic, then for your new logic.</li><li><strong>Break the code: </strong>I enjoy creating a new branch, and then deliberately making big changes to the code to understand how it works. When I’m done… I revert my changes and delete the branch. It’s a experimentation-playground that is very useful when exploring unfamiliar code.</li></ol><p>Are there other useful techniques I have not covered here?</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65989642baae" width="1" height="1" alt=""><hr><p><a href="https://medium.com/the-curious-coder/how-to-understand-an-existing-code-base-65989642baae">How to understand an existing code-base</a> was originally published in <a href="https://medium.com/the-curious-coder">The Curious Coder</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>