<?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: feileacan</title>
    <description>The latest articles on DEV Community by feileacan (@feileacan).</description>
    <link>https://dev.to/feileacan</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%2F580710%2F6e233065-4944-4396-9e8d-6802a7a2edd6.png</url>
      <title>DEV Community: feileacan</title>
      <link>https://dev.to/feileacan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/feileacan"/>
    <language>en</language>
    <item>
      <title>What I found hard about Rust (and how I got the hang of it)</title>
      <dc:creator>feileacan</dc:creator>
      <pubDate>Mon, 08 Mar 2021 10:42:52 +0000</pubDate>
      <link>https://dev.to/feileacan/what-i-found-hard-about-rust-and-how-i-got-the-hang-of-it-5mb</link>
      <guid>https://dev.to/feileacan/what-i-found-hard-about-rust-and-how-i-got-the-hang-of-it-5mb</guid>
      <description>&lt;p&gt;Rust is an interesting language. &lt;a href="https://insights.stackoverflow.com/survey/2020#technology-most-loved-dreaded-and-wanted-languages"&gt;Much-loved&lt;/a&gt;, a systems programming language (no garbage collection, etc) but feels like a higher level language with iterators, fancy type systems, nice tooling, and you can write code that works&lt;br&gt;
without needing to carefully juggle memory.&lt;/p&gt;

&lt;p&gt;I've done plenty of systems programming (C, C++) and higher level (Python, C#, etc), so figured Rust should be easy enough to pick up, but I'd hit the same struggles everyone else does, where the borrow checker yells at me, and when do I use a &lt;code&gt;String&lt;/code&gt; vs &lt;code&gt;&amp;amp;String&lt;/code&gt; vs &lt;code&gt;str&lt;/code&gt; vs &lt;code&gt;&amp;amp;str&lt;/code&gt;?&lt;/p&gt;

&lt;p&gt;Eventually I figured out why I was struggling so much though, and now I'll share with you, gentle reader, my revelation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;I was forgetting to think about memory and lifetimes&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;When coding in C or C++ I'd be constantly aware of every allocation and trying (and sometimes failing) to carefully track the lifetimes of every object I use because if I don't, bad things happen.&lt;/p&gt;

&lt;p&gt;In a language like Python I don't because that's all hidden from me. I just code and it's the interpreter's problem.&lt;/p&gt;

&lt;p&gt;When writing Rust it felt so easy, so I relaxed and stopped the careful tracking that I would in other systems programming languages. Of course, you can't since it matters in Rust. It has better ergonomics and safety but it's still a systems programming language, that means it assumes you know and care about whether things are heap or stack allocated, or about when exactly something is deallocated.&lt;/p&gt;

&lt;p&gt;This then means the solution is sad but easy. I need to go back to thinking about where I want things allocated, how they're getting passed to functions, how long they live for. But at least when I get it wrong I find out from the compiler instead of &lt;a href="https://googleprojectzero.blogspot.com/"&gt;Project Zero&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>rust</category>
    </item>
    <item>
      <title>What can we learn from Citi's $900 million mistake?</title>
      <dc:creator>feileacan</dc:creator>
      <pubDate>Fri, 19 Feb 2021 00:17:03 +0000</pubDate>
      <link>https://dev.to/feileacan/what-can-we-learn-from-citi-s-900-million-mistake-3p0j</link>
      <guid>https://dev.to/feileacan/what-can-we-learn-from-citi-s-900-million-mistake-3p0j</guid>
      <description>&lt;p&gt;Back in 2020 Citigroup accidentally sent almost USD$900 million to Revlon's creditors. About half the money was returned, but 10 creditors held on to the money and a judge has just ruled that &lt;a href="https://www.nytimes.com/2021/02/17/business/dealbook/citigroup-900-million.html"&gt;they can keep the money&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;In short, Revlon sent Citi a few million for them to transfer to creditors as an interest payment. A Citigroup employee didn't fill out a form in a program correctly, so Citi paid off Revlon's loan in full using their own money. Oops.&lt;/p&gt;

&lt;p&gt;Here's the form, can you see the problem?&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--l-qN2Dvm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w0bzzvxt80suf5afut2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--l-qN2Dvm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7w0bzzvxt80suf5afut2.png" alt="image"&gt;&lt;/a&gt; (sourced from the &lt;a href="https://www.courtlistener.com/recap/gov.uscourts.nysd.542310/gov.uscourts.nysd.542310.243.0_2.pdf"&gt;court record&lt;/a&gt;)&lt;/p&gt;

&lt;p&gt;Thought not. In order to &lt;strong&gt;not&lt;/strong&gt; send lots of money you need to check all of the PRINCIPAL, FUND and FRONT boxes.&lt;/p&gt;

&lt;h2&gt;
  
  
  What can we learn from this?
&lt;/h2&gt;

&lt;p&gt;The real question is what can the rest of us learn from this mistake? Not that people make mistakes or should be fired (three different people looked at and approved the transfer), but the importance of good UI. To me, there are three main takeaways.&lt;/p&gt;

&lt;h3&gt;
  
  
  Safe defaults
&lt;/h3&gt;

&lt;p&gt;Usually we should make the common case the default, that's just good UX. But when one of the options is dangerous and the other safe, make the default the safe one.&lt;/p&gt;

&lt;p&gt;Think about your ops tools, how many have &lt;code&gt;--dry-run&lt;/code&gt; flags instead of &lt;code&gt;--for-realsies&lt;/code&gt;? A repeated trend I've seen in outages is someone ran a command, didn't realise they were targeting production and oops.&lt;/p&gt;

&lt;h3&gt;
  
  
  UI states should match business logic states
&lt;/h3&gt;

&lt;p&gt;Is every combination of checkboxes actually valid? If you have redundant information in the UI you should either consolidate it, or error on mismatch. Either you know what the user wants, in which case you didn't need to ask for it in the first place, or you don't, in which case don't guess. As with all rules you may want to bend this one for convenience but the dangerous an operation the more pedantic you should be.&lt;/p&gt;

&lt;h3&gt;
  
  
  Adding more reviewers only goes so far.
&lt;/h3&gt;

&lt;p&gt;A common pattern after outages is to add more reviewers for changes: "someone ran the foobar tool and took out a datacentre, now all users of the foobar tool need a second person to check the command and approve before running it". In a pinch it can help, but it's a short-term mitigation. It slows you down, takes more person-time, randomises people, and still doesn't give you as much safety as improving the tool itself.&lt;/p&gt;

&lt;h2&gt;
  
  
  Obligatory Disclaimers
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;The above is a very brief summary of what happened, it's more complicated than I made it out to be. Please read the linked article and court record for more details&lt;/li&gt;
&lt;li&gt;All opinions are my own and do not represent my employer&lt;/li&gt;
&lt;/ul&gt;

</description>
    </item>
  </channel>
</rss>
