<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Austin French</title>
    <description>The latest articles on DEV Community by Austin French (@athomsfere).</description>
    <link>https://dev.to/athomsfere</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F291231%2F80ce920c-8d17-4538-b017-be82be3590bd.jpg</url>
      <title>DEV Community: Austin French</title>
      <link>https://dev.to/athomsfere</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/athomsfere"/>
    <language>en</language>
    <item>
      <title>Ideal Code, I can't today</title>
      <dc:creator>Austin French</dc:creator>
      <pubDate>Wed, 01 Sep 2021 15:42:44 +0000</pubDate>
      <link>https://dev.to/athomsfere/ideal-code-i-can-t-today-17ok</link>
      <guid>https://dev.to/athomsfere/ideal-code-i-can-t-today-17ok</guid>
      <description>&lt;h2&gt;
  
  
  The real world, is rarely ideal
&lt;/h2&gt;

&lt;p&gt;Today, I had to hack it. And I don't mean hammer on the keyboard to get a feature done. Nor do I mean "debug it until I make it", I mean, work against everything I think good, ideal code is. I mean, make something that I feel like it shouldn't be in a code base, part of a library until legacy code is updated.&lt;/p&gt;

&lt;h3&gt;
  
  
  Backstory
&lt;/h3&gt;

&lt;p&gt;We have an angularJS application, running with jQuery, MVC, and various libraries written for that stack. I've been architecting for months now a path to Angular using ngUpgrade. Most of it has been going great:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Make a thing&lt;/li&gt;
&lt;li&gt;Set up the components, services, and classes to make an Angular native and well designed pattern.&lt;/li&gt;
&lt;li&gt;Do a little hackery with window variables from the MVC views.&lt;/li&gt;
&lt;li&gt;Looks good, functions well, and doesn't break anything the Angular creators would warn against in a style guide.&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Hacking it
&lt;/h3&gt;

&lt;p&gt;This though, isn't something I ever thought would be a thing.&lt;br&gt;
Todays goal: &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Create a parent Angular component&lt;/li&gt;
&lt;li&gt;Define some meta data to pass to a directive component&lt;/li&gt;
&lt;li&gt;Have the directive convert the parent components meta data to HTML&lt;/li&gt;
&lt;li&gt;Insert the HTML into a rendered element from a library&lt;/li&gt;
&lt;li&gt;Have the child component attach the parent component's functions to the window as a function for the onclick attribute of the library rendered angularJs / HTML to call. &lt;/li&gt;
&lt;/ol&gt;
&lt;h3&gt;
  
  
  It worked!
&lt;/h3&gt;

&lt;p&gt;And it works!&lt;/p&gt;

&lt;p&gt;I can create an instance of a class, and assign it something like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="nx"&gt;myFunction&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;myArgument&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kd"&gt;type&lt;/span&gt;&lt;span class="p"&gt;){&lt;/span&gt;
  &lt;span class="c1"&gt;// the stuff we need to do in the parent component&lt;/span&gt;
  &lt;span class="c1"&gt;// from the 3rd party angularJs/ Jquery library inserted to the &lt;/span&gt;
  &lt;span class="c1"&gt;// DOM in a child component rendered HTML&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nx"&gt;element&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;Function&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;myCallbackFunction&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;I am both stoked that I was able to get the basic functionality, but also heartbroken that I had to write something this janky.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The real world is rarely as ideal as the code standard we push. I don't know how long I will have to support this code, but until the called library is fixed / modernized we are stuck. I pity all of our developers just learning Angular, and who might have to grok this concept. And I especially fear for those supporting it years or a decade down the road if the library isn't ever modernized properly.&lt;/p&gt;

</description>
      <category>angular</category>
      <category>therealworld</category>
      <category>bestpractices</category>
    </item>
    <item>
      <title>Always Swagger Your API</title>
      <dc:creator>Austin French</dc:creator>
      <pubDate>Wed, 23 Dec 2020 18:36:33 +0000</pubDate>
      <link>https://dev.to/athomsfere/always-swagger-your-api-fjn</link>
      <guid>https://dev.to/athomsfere/always-swagger-your-api-fjn</guid>
      <description>&lt;p&gt;This is a short and sweet post. And the title summarizes it well enough. &lt;strong&gt;Always Swagger Your API&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;I can almost hear it now&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;I never use Swagger because (...)&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;And let me say, right now. I'll likely address that.&lt;/p&gt;

&lt;p&gt;Whenever you are starting a new API, use swagger. I can't recall the documentation, design, and development challenges I've faced because a parameter was slightly mistyped, a class was mis-defined, a class was a slightly different shape, or I had a API call as a &lt;em&gt;GET&lt;/em&gt; when I needed and expected it to be a POST. &lt;/p&gt;

&lt;p&gt;Swagger solves this. When you need to create an API, being able to rapidly test it, develop against it, and document it saves hours for every minute it takes to implement it. &lt;/p&gt;

&lt;p&gt;Reasons you might not want to use it:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;It can get very large, and slow&lt;/li&gt;
&lt;li&gt;It can expose endpoints (generally touted as a security risk)&lt;/li&gt;
&lt;li&gt;Something else to maintain&lt;/li&gt;
&lt;/ol&gt;

&lt;h3&gt;
  
  
  Too Large
&lt;/h3&gt;

&lt;p&gt;For it becoming large: This is true. And I have two solutions.&lt;br&gt;
 a. It can be split, although it creates additional maintenance.&lt;br&gt;
 b. Get rid of Swagger after the rough, cowboy days of getting the API up and functional. I think every new API should have swagger through early development. Not necessarily forever.&lt;/p&gt;

&lt;h3&gt;
  
  
  Security - Exposed endpoints
&lt;/h3&gt;

&lt;p&gt;First, this is a terrible argument from a security standpoint. The bad guys that you should worry about will have better tools to do what they do, including finding your endpoints. &lt;/p&gt;

&lt;p&gt;There are real reasons to not want to expose the endpoints however. Perhaps you don't want a user a accident discover the page and create confusion. Or perhaps some calls are not documented on purpose (v2 over v1 endpoints).&lt;/p&gt;

&lt;h3&gt;
  
  
  Maintenance
&lt;/h3&gt;

&lt;p&gt;You might just not want to deal with maintenance forever. If the swagger gets too large, or your targeting framework changes. &lt;/p&gt;

&lt;h3&gt;
  
  
  Remove Swagger
&lt;/h3&gt;

&lt;p&gt;I'll say it one last time: &lt;em&gt;Every new API should use Swagger, but when the API is mature enough feel free to remove it&lt;/em&gt;&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>webdev</category>
      <category>api</category>
      <category>swagger</category>
    </item>
    <item>
      <title>Take Advice, Especially Solicited Advice</title>
      <dc:creator>Austin French</dc:creator>
      <pubDate>Fri, 11 Dec 2020 15:45:18 +0000</pubDate>
      <link>https://dev.to/athomsfere/take-advice-especially-solicited-advice-1jpg</link>
      <guid>https://dev.to/athomsfere/take-advice-especially-solicited-advice-1jpg</guid>
      <description>&lt;h2&gt;
  
  
  Overview
&lt;/h2&gt;

&lt;p&gt;I have had an unconventional career path. Some of the randomness includes:&lt;/p&gt;

&lt;p&gt;General Manager of a fine dining restaurant.&lt;br&gt;
Former Microsoft MVP.&lt;br&gt;
IT, everything from clearing cookies to driving around the nation setting up equipment, and writing scripts to install software over thousands of machines.&lt;br&gt;
Software Developer, combing backlogs to leading multinational architecture / development.&lt;/p&gt;

&lt;p&gt;It's not a bad resume, if I am objective. &lt;/p&gt;

&lt;p&gt;Recently, on Reddit I was messaged by someone wanting to know how to get into IT. I fully believe in helping everyone, in anyway I can. So I offered some insight into how I got there, and some advice in general.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sidebar
&lt;/h2&gt;

&lt;p&gt;Joseph Strauss, a talented and ambitious, yet relatively unaccomplished engineer took on the enormous challenge of the Golden Gate Bridge. &lt;/p&gt;

&lt;p&gt;Ultimately,  Leon Moisseiff did much of the final design and engineering. We still celebrate Strauss, far more than Moisseiff. But the fact that Strauss solicited the project, and the input required to be successful is how the USA built the iconic structure.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lesson Learned
&lt;/h2&gt;

&lt;p&gt;We often can't do things on our own. We should ask for advice, and help.&lt;/p&gt;

&lt;p&gt;What has me perplexed however was this persons response.&lt;/p&gt;

&lt;p&gt;My final piece of advice was something along the lines of &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;If you find yourself lacking people skills, work on that.&lt;br&gt;
Even if it means picking up a part time job bartending. &lt;br&gt;
Tech has tons of smart, passionate people who aren't articulate&lt;br&gt;
We need more people able to speak with cross functional teams&lt;br&gt;
and negotiate solutions to problems in realistic timeframes&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;What I got back was something akin to:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;F@(k you, you are stupid and racist. No wonder your career has &lt;br&gt;
been involved so much grunt work.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I am paraphrasing here. &lt;/p&gt;

&lt;h2&gt;
  
  
  Summary
&lt;/h2&gt;

&lt;p&gt;I truly wanted, and would still like for this person to have a fulfilling career. &lt;/p&gt;

&lt;p&gt;The thing is, if he solicits for advice, and then throws it away and returns the favor with insults, he won't.&lt;/p&gt;

&lt;p&gt;For everyone who solicits advice. Take it. Write it down, sleep on it. Read it again in a year, or five. I have received advice that I took to heart. I have received advice that was too far forward for where I was at the time. And I have received advice that hasn't worked for me (yet?). &lt;/p&gt;

&lt;p&gt;And here I am, with a career many people would love to have had. I have a career I have loved. And I hope, for everyone who solicits advice: &lt;strong&gt;I hope you have the career and life you seek.&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>career</category>
    </item>
    <item>
      <title>Don't store null bits</title>
      <dc:creator>Austin French</dc:creator>
      <pubDate>Tue, 29 Sep 2020 13:56:59 +0000</pubDate>
      <link>https://dev.to/athomsfere/don-t-store-null-bits-3ped</link>
      <guid>https://dev.to/athomsfere/don-t-store-null-bits-3ped</guid>
      <description>&lt;p&gt;I have often seen nullable bit columns used in ways that make them a pain to, well use.&lt;/p&gt;

&lt;p&gt;I remember when I first started down the path of professional development, and would encounter these patterns and it all seemed to make sense.&lt;/p&gt;

&lt;p&gt;"Let's create a column, that represents some choice. The user can choose yes, or no, but also not choose"&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="n"&gt;TABLENAME&lt;/span&gt;
   &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="n"&gt;ColumnName&lt;/span&gt; &lt;span class="nb"&gt;bit&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As much as this made sense at the time, and the more I have worked with them; the more I have decided that most of the time, this is terrible in practice. &lt;/p&gt;

&lt;p&gt;Let's assume a common use case:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;An order form for a custom face mask&lt;/li&gt;
&lt;li&gt;A User option for "Extra Comfortable Cotton"&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;In our UI we define it with a TypeScript object similar to:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;CustomShirt&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="c1"&gt;// other properties&lt;/span&gt;
   &lt;span class="nx"&gt;IsExtraComfortable&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nx"&gt;boolean&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and in the API we also identify this as&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;CustomShirtOrder&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="p"&gt;...&lt;/span&gt; &lt;span class="c1"&gt;//other properties&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt;&lt;span class="p"&gt;?&lt;/span&gt; &lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;get&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="k"&gt;set&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Every looks good here, at a glance. But there are two minor issues for developers further down the road.&lt;/p&gt;

&lt;p&gt;The UI/ front end has to care a little too much about the state of boolean.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="o"&gt;!=&lt;/span&gt; &lt;span class="kc"&gt;null&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="nx"&gt;IsExtraComfortable&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Which isn't a huge deal, but it is a chance to introduce bugs everywhere the boolean is used. We have to keep in mind that:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We could implement an interface to say this is a nullable field&lt;/li&gt;
&lt;li&gt;Misusing it could give us compile time errors&lt;/li&gt;
&lt;li&gt;But we can't guarantee it's honored (TypeSafety) because TypeScript is ultimately compiled to JavaScript.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Also the premise of the reasonably named variable 'IsExtraComfortable' is that either the shirt is extra comfortable, or it isn't. If the UI expects a third state, the architecture should also allow one. And I think this is a very important concept: The architecture should reflect the business logic. &lt;/p&gt;

&lt;p&gt;Suppose the &lt;em&gt;Order Fulfillment Department&lt;/em&gt; also has a department for the extra comfortable shirts. So when selecting a next order they do a search which calls a function:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="n"&gt;Order&lt;/span&gt; &lt;span class="nf"&gt;GetNextShirtOrder&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;Filter&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;comfortChoice&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;!=&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt; &lt;span class="p"&gt;?&lt;/span&gt;
&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="k"&gt;false&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="kt"&gt;var&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="k"&gt;new&lt;/span&gt; &lt;span class="n"&gt;IQueryable&lt;/span&gt;&lt;span class="p"&gt;&amp;lt;&lt;/span&gt;&lt;span class="n"&gt;Order&lt;/span&gt;&lt;span class="p"&gt;&amp;gt;();&lt;/span&gt;

    &lt;span class="c1"&gt;// when xtra comfort is requested:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HasValue&lt;/span&gt; &lt;span class="p"&gt;&amp;amp;&amp;amp;&lt;/span&gt; &lt;span class="n"&gt;comfortChoice&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; 
         &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="k"&gt;true&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// when regular or undecided:&lt;/span&gt;
    &lt;span class="k"&gt;if&lt;/span&gt; &lt;span class="p"&gt;(!&lt;/span&gt;&lt;span class="n"&gt;filter&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;HasValue&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt; &lt;span class="p"&gt;!&lt;/span&gt;&lt;span class="n"&gt;comfortChoice&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
    &lt;span class="p"&gt;{&lt;/span&gt;
       &lt;span class="c1"&gt;// could get true and null, or false and null as required&lt;/span&gt;
       &lt;span class="n"&gt;orders&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="n"&gt;db&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;Orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;Where&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;w&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; 
         &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="n"&gt;comfortChoice&lt;/span&gt; &lt;span class="p"&gt;||&lt;/span&gt;
         &lt;span class="n"&gt;w&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;

    &lt;span class="c1"&gt;// Other filters&lt;/span&gt;

    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;orders&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nf"&gt;OrderBy&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;o&lt;/span&gt; &lt;span class="p"&gt;=&amp;gt;&lt;/span&gt; &lt;span class="n"&gt;o&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="n"&gt;OrderTime&lt;/span&gt;&lt;span class="p"&gt;).&lt;/span&gt;&lt;span class="nf"&gt;FirstOrDefault&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We are creating a lot of extra code, that is harder to maintain and test for quasi-state of comfortable-ness. It's a mess and should not generally be allowed.&lt;/p&gt;

&lt;p&gt;Now, the business requirement is possibly something where "IsExtraComfortable" can be opted-in, opted-out, or not selected. &lt;/p&gt;

&lt;p&gt;which we could use instead:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight sql"&gt;&lt;code&gt;&lt;span class="k"&gt;ALTER&lt;/span&gt; &lt;span class="n"&gt;TABLENAME&lt;/span&gt;
   &lt;span class="k"&gt;ADD&lt;/span&gt; &lt;span class="n"&gt;IsExtraComfortable&lt;/span&gt; &lt;span class="nb"&gt;tinyint&lt;/span&gt; &lt;span class="k"&gt;not&lt;/span&gt; &lt;span class="k"&gt;null&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Even better, use a type table which maps to the enum:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;enum&lt;/span&gt; &lt;span class="n"&gt;ExtraComfortableNess&lt;/span&gt;
&lt;span class="p"&gt;{&lt;/span&gt;
   &lt;span class="n"&gt;NotSelected&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="n"&gt;RegularComfort&lt;/span&gt;  &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
   &lt;span class="n"&gt;ExtraComfortable&lt;/span&gt; &lt;span class="p"&gt;=&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We have a couple important advantages doing this:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;We can see more significance in reports to what the values mean&lt;/li&gt;
&lt;li&gt;An Int in C# is zero by default, so we can simplify our code&lt;/li&gt;
&lt;li&gt;We might not have to touch our code again if another level of comfort is added&lt;/li&gt;
&lt;li&gt;Any expense of a join to the type table is only when we would need to see something like a UI value&lt;/li&gt;
&lt;li&gt;We can have meta data for the comfort type&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Additional thoughts: If we really want a property for IsExtraComforable, we could still achieve this of course:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight csharp"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="kt"&gt;bool&lt;/span&gt; &lt;span class="n"&gt;IsExtraComforable&lt;/span&gt; 
&lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;get&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;ExtraComfortableNess&lt;/span&gt; &lt;span class="p"&gt;==&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;set&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="c1"&gt;//not settable }&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now if in 6 months, the business adds a new "Primo Comfort Cotton", we aren't trying to shoehorn existing logic and new logic together. &lt;/p&gt;

&lt;p&gt;Using a nullable boolean, our logic could get a little weird. Obviously a shirt can't be made of two fabrics. This means we would be constantly checking that where one boolean is set, another is unset, or not set. &lt;/p&gt;

&lt;p&gt;And what would be the business differences between two orders where:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;ShirtFabric&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;IsExtraComfortable:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PrimoFabric:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;and&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;ShirtFabric&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="err"&gt;IsExtraComfortable:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;null&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;PrimoFabric:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="p"&gt;}&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;It's all going to be much easier with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;ShirtFabric&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;Fabric.PrimoFabric&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;or&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight json"&gt;&lt;code&gt;&lt;span class="err"&gt;ShirtFabric&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="err"&gt;:&lt;/span&gt;&lt;span class="w"&gt; &lt;/span&gt;&lt;span class="mi"&gt;3&lt;/span&gt;&lt;span class="w"&gt;
&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h4&gt; Saving Space &lt;/h4&gt;

&lt;p&gt;The reason we usually want to use a bit in the first place is space constraints. The argument goes: By using a bit, we have a very small thing to store on the disk, in the servers memory, and on the client.&lt;/p&gt;

&lt;p&gt;In SQL, this is only sometimes true.&lt;/p&gt;

&lt;p&gt;Where a Byte is 'B', and a bit is 'b'. And 'N' is the number of bit columns on the table our size of bit columns would be more like:&lt;/p&gt;

&lt;p&gt;B = ⌈N/8⌉&lt;/p&gt;

&lt;p&gt;So 1 column, is still a byte, up to 8 bit columns. Or the same as a tinyint. Nine bit columns would also take 2 bytes of storage. This really is our best argument for using a bit column.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;But:&lt;/strong&gt;&lt;br&gt;
in C# bool is 4 bytes. JavaScript (And by Extension TypeScript) a boolean is also 4 bytes.&lt;/p&gt;

&lt;p&gt;So in short, at least most of the time we aren't saving space. In memory a tinyint (byte) could be used, and you'd get up to 255 (0 - 255) possible choices, plus a default without additional overhead. &lt;/p&gt;

&lt;p&gt;Perhaps more importantly though, you can't index on a bit column. You can on any int columns. Especially now, where DTUs are expensive in services like Azure, and storage is cheap; The cost of querying millions of rows of non-indexed values is vastly more expensive than sometimes using more data.&lt;/p&gt;

&lt;p&gt;And finally, I would be much less harsh on a bit column. We get the space saving of a bit column. We could store up to 8 values in bit columns for the same space as a tinyint, and there is no room for a quasi-third state. But if ever your requirements say something like:&lt;/p&gt;

&lt;p&gt;"We will offer standard and rushed processing on all orders; Store whether rushed processing is requested". I encourage you to look at market leaders, and sites you regularly use and note patterns like:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Standard Processing (4-7 days)&lt;/li&gt;
&lt;li&gt;Rush Processing (next business day)&lt;/li&gt;
&lt;li&gt;Super Saving Processing (save $x by waiting 5-10 business days)&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I think we can all smell an enhancement that would break our bit column. I'd opt for the tinyint.&lt;/p&gt;

</description>
      <category>csharp</category>
      <category>sql</category>
      <category>angular</category>
      <category>fullstack</category>
    </item>
    <item>
      <title>Why you should be a "Night Owl"</title>
      <dc:creator>Austin French</dc:creator>
      <pubDate>Fri, 21 Aug 2020 14:11:16 +0000</pubDate>
      <link>https://dev.to/athomsfere/why-you-should-be-night-owl-27bl</link>
      <guid>https://dev.to/athomsfere/why-you-should-be-night-owl-27bl</guid>
      <description>&lt;h3&gt;
  
  
  1. You get more time in the day
&lt;/h3&gt;

&lt;p&gt;OK, the amount of time you are awake, and in the day would be roughly equal. But your productive hours are when everyone else is asleep.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. You get a sense of achievement
&lt;/h3&gt;

&lt;p&gt;Knowing that you use the hours best for you, regardless of what "office hours" generally are.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. You get a proud feeling that while most of the world is sleeping, you are working. This feeling is really good for your morale💯
&lt;/h3&gt;

&lt;h3&gt;
  
  
  5. 🌸You'll feel better about yourself🌸
&lt;/h3&gt;

&lt;p&gt;If you are a night owl, being on your schedule is great! Going grocery shopping at 10pm or 6am is a great experience!&lt;/p&gt;

&lt;h3&gt;
  
  
  6. You’ll Have a Better Chance at Completing your tasks💯
&lt;/h3&gt;

&lt;p&gt;A happy well rested self, is going to get more done with a higher degree of quality.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. You can also just take it slow
&lt;/h3&gt;

&lt;p&gt;With all the morning plebs sleeping, you can buckle down and write code, strategize, and not get sucked into as meetings.&lt;/p&gt;

&lt;h3&gt;
  
  
  8. 💝Some health benefits 💝
&lt;/h3&gt;

&lt;p&gt;Ok, the science here isn't great for us night owls. Hopefully it's correlative. But the Gym is generally empty between 11pm and 4am!&lt;/p&gt;

&lt;p&gt;And although studies say our health tends to be worse, we also tend to have more creativity, endurance, and better reasoning skills!&lt;/p&gt;

&lt;h3&gt;
  
  
  9. 😆Some funny (and possibly sarcastic) reasons 😆
&lt;/h3&gt;

&lt;p&gt;You can talk about it on social media.&lt;br&gt;
Internet speed is usually faster in the middle of the night.&lt;/p&gt;

&lt;p&gt;You can brag about being awake all night, getting stuff done.&lt;/p&gt;

&lt;h1&gt;
  
  
  Serious Talk
&lt;/h1&gt;

&lt;p&gt;This is a joke of a response to: &lt;a href="https://dev.to/nirbhayvashisht/waking-up-early-in-the-morning-how-and-why-1eem"&gt;https://dev.to/nirbhayvashisht/waking-up-early-in-the-morning-how-and-why-1eem&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Us night owls get a lot of crap for our chronotype. It isn't easy being tired all day, and then once the sun sets getting a burst of energy. &lt;/p&gt;

&lt;p&gt;Unfortunately, when the world was figuring out how to run businesses, factories, and schools; some jerks with money and power chose to slot us all into the great lie about the greatness of early risers. Multiple shifts would be better IMO.&lt;/p&gt;

&lt;p&gt;My suggestion: Do what works for you, if you can. And always push for flexible hours. Even if you are a morning person!&lt;/p&gt;

&lt;p&gt;And finally, Nirbhay Vashisht offers some great advice for us all! Whatever your schedule is, make it a schedule. A consistent bedtime and wake-time each day will help your route immensely. For me, the perfect bedtime is about 7am (when my real life allows it)&lt;/p&gt;

</description>
      <category>motivation</category>
      <category>watercooler</category>
      <category>jokes</category>
      <category>productivity</category>
    </item>
  </channel>
</rss>
