<?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: Alex Verein</title>
    <description>The latest articles on DEV Community by Alex Verein (@tpom6oh).</description>
    <link>https://dev.to/tpom6oh</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%2F448159%2F37b392fd-e1df-42d9-b720-db3817661572.jpeg</url>
      <title>DEV Community: Alex Verein</title>
      <link>https://dev.to/tpom6oh</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/tpom6oh"/>
    <language>en</language>
    <item>
      <title>Comparing switch-like operators in 14 different programming languages</title>
      <dc:creator>Alex Verein</dc:creator>
      <pubDate>Sat, 11 Sep 2021 10:00:22 +0000</pubDate>
      <link>https://dev.to/tpom6oh/comparing-switch-like-operators-in-14-different-programming-languages-4da9</link>
      <guid>https://dev.to/tpom6oh/comparing-switch-like-operators-in-14-different-programming-languages-4da9</guid>
      <description>&lt;p&gt;We are going to look at Javascript, Typescript, Java, C#, Swift, Objective-C, Python, PHP, Ruby, Kotlin, ReasonML, Dart, Go and Elixir.&lt;/p&gt;

&lt;p&gt;At Avo (avo.app) we work with 12 languages, and I decided to do a series of quick comparisons of those languages, plus 3 languages we are going to support soon.&lt;/p&gt;

&lt;p&gt;First feature we are going to look at is the switch-like constructs. We are interested in 3 features related to switches - ability to use switch as an expression (so it returns a value), whether the switch construct is exhaustive (you need to handle all cases to compile the code) and if the fall-through logic disabled (so you don't need to break out of each case explicitly).&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;Language&lt;/th&gt;
&lt;th&gt;has switch expression&lt;/th&gt;
&lt;th&gt;is exhaustive&lt;/th&gt;
&lt;th&gt;no need to break&lt;/th&gt;
&lt;th&gt;reference&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;javascript&lt;/td&gt;
&lt;td&gt;limited, only if wrapped in a function &lt;a href="https://stackoverflow.com/a/55944296"&gt;https://stackoverflow.com/a/55944296&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch"&gt;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Statements/switch&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;typescript&lt;/td&gt;
&lt;td&gt;limited, only if wrapped in a function&lt;/td&gt;
&lt;td&gt;limited &lt;a href="http://ideasintosoftware.com/exhaustive-switch-in-typescript/"&gt;http://ideasintosoftware.com/exhaustive-switch-in-typescript/&lt;/a&gt;
&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;same as JS&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;java&lt;/td&gt;
&lt;td&gt;starting java 12&lt;/td&gt;
&lt;td&gt;expression is, statement is not&lt;/td&gt;
&lt;td&gt;additional syntax starting java 12&lt;/td&gt;
&lt;td&gt;&lt;a href="https://openjdk.java.net/jeps/354"&gt;https://openjdk.java.net/jeps/354&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;c#&lt;/td&gt;
&lt;td&gt;starting C# 8.0&lt;/td&gt;
&lt;td&gt;- (expression will give a compile warning)&lt;/td&gt;
&lt;td&gt;need to break in the statement&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/switch-expression"&gt;https://docs.microsoft.com/en-us/dotnet/csharp/language-reference/operators/switch-expression&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;swift&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;&lt;a href="https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html"&gt;https://docs.swift.org/swift-book/LanguageGuide/ControlFlow.html&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;objc&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;🤷‍♂️&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;python&lt;/td&gt;
&lt;td&gt;no switch in python :)&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;td&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;php&lt;/td&gt;
&lt;td&gt;called match, introduced in php 8&lt;/td&gt;
&lt;td&gt;match is, switch is not&lt;/td&gt;
&lt;td&gt;match , switch is not&lt;/td&gt;
&lt;td&gt;&lt;a href="https://www.php.net/manual/en/control-structures.match.php"&gt;https://www.php.net/manual/en/control-structures.match.php&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;ruby, called &lt;code&gt;case&lt;/code&gt;
&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;&lt;a href="https://ruby-doc.org/core-3.0.1/doc/syntax/control_expressions_rdoc.html#label-case+Expression"&gt;https://ruby-doc.org/core-3.0.1/doc/syntax/control_expressions_rdoc.html#label-case+Expression&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;kotlin, called when&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;expression is, statement is not&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;&lt;a href="https://kotlinlang.org/docs/control-flow.html#when-expression"&gt;https://kotlinlang.org/docs/control-flow.html#when-expression&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;reasonml/rescript&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;&lt;a href="https://rescript-lang.org/docs/manual/latest/pattern-matching-destructuring#switch-based-on-shape-of-data"&gt;https://rescript-lang.org/docs/manual/latest/pattern-matching-destructuring#switch-based-on-shape-of-data&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;dart&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;&lt;a href="https://dart.dev/guides/language/language-tour#switch-and-case"&gt;https://dart.dev/guides/language/language-tour#switch-and-case&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;go&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;&lt;a href="https://tour.golang.org/flowcontrol/9"&gt;https://tour.golang.org/flowcontrol/9&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;elixir          (called case)&lt;/td&gt;
&lt;td&gt;-&lt;/td&gt;
&lt;td&gt;- (runtime error CaseClauseError)&lt;/td&gt;
&lt;td&gt;+&lt;/td&gt;
&lt;td&gt;&lt;a href="https://elixir-lang.org/getting-started/case-cond-and-if.html#case"&gt;https://elixir-lang.org/getting-started/case-cond-and-if.html#case&lt;/a&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

</description>
      <category>programminglanguages</category>
    </item>
    <item>
      <title>How to set up `git bro` command with git alias</title>
      <dc:creator>Alex Verein</dc:creator>
      <pubDate>Fri, 16 Jul 2021 11:49:38 +0000</pubDate>
      <link>https://dev.to/tpom6oh/how-to-unlock-git-bro-command-1l40</link>
      <guid>https://dev.to/tpom6oh/how-to-unlock-git-bro-command-1l40</guid>
      <description>&lt;p&gt;Have you seen people use the &lt;code&gt;git bro&lt;/code&gt; command in terminal and always wondered how they do it?&lt;/p&gt;

&lt;p&gt;It's actually very easy and I'm going to teach you now. Moreover, after mastering this technique you'll be able to use any command your imagination comes up with, like &lt;code&gt;git cmon&lt;/code&gt; or &lt;code&gt;git brunch&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I'll also share my own commands config in the end (quite conservative tbh).&lt;/p&gt;

&lt;h2&gt;
  
  
  You have git set up
&lt;/h2&gt;

&lt;p&gt;First of all, you need git. I assume you already have it, if not, &lt;a href="https://git-scm.com/book/en/v2/Getting-Started-Installing-Git"&gt;check this out&lt;/a&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  Add the command
&lt;/h2&gt;

&lt;p&gt;All you need to add a command is to define an alias, like this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global alias.bro `branch`
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Manage the aliases
&lt;/h2&gt;

&lt;p&gt;To see all the aliases run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --list
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;To remove one run&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;git config --global --unset alias.bro
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  My aliases
&lt;/h2&gt;

&lt;p&gt;As I promised, in the end I share my setup&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;alias.co=checkout
alias.cm=commit
alias.st=status
alias.bro=branch
alias.br=checkout -b
alias.pushit=push -u origin HEAD
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Thanks for tuning in
&lt;/h2&gt;

&lt;p&gt;That's it, now you can update your CV stating that you are bros with &lt;code&gt;git&lt;/code&gt;!&lt;/p&gt;

&lt;p&gt;👋&lt;/p&gt;

</description>
      <category>git</category>
      <category>tips</category>
      <category>devtips</category>
    </item>
    <item>
      <title>ReasonML &amp; Rescript in 5 minutes</title>
      <dc:creator>Alex Verein</dc:creator>
      <pubDate>Fri, 23 Apr 2021 16:46:57 +0000</pubDate>
      <link>https://dev.to/tpom6oh/reasonml-rescript-in-5-minutes-58l6</link>
      <guid>https://dev.to/tpom6oh/reasonml-rescript-in-5-minutes-58l6</guid>
      <description>&lt;h3&gt;
  
  
  What is this language about?
&lt;/h3&gt;

&lt;p&gt;It's a functional language that compiles to JavaScript (or to OCaml). We use it widely at &lt;a href="//avo.app"&gt;avo.app&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  What is ML in ReasonML?
&lt;/h3&gt;

&lt;p&gt;Nowadays ML usually stands for Machine Learning, but in the old days there was a programming language called "Meta Language" which is the ancestor of ReasonML, or Reason Meta Language.&lt;/p&gt;

&lt;h3&gt;
  
  
  Why rename?
&lt;/h3&gt;

&lt;p&gt;ReasonML is compatible with both JS and OCaml, but lately it was mostly used in the JS ecosystem.&lt;br&gt;
Rescript takes JS-related things from Reason and stops being limited by OCaml support.&lt;/p&gt;
&lt;h3&gt;
  
  
  What are the good things?
&lt;/h3&gt;
&lt;h4&gt;
  
  
  Immutability
&lt;/h4&gt;

&lt;p&gt;All references are actually constants. Shadowing is widely used. Standard library functions are non-mutative and produce new instances if any changes are made. There is a workaround to create a mutable reference if needed but deliberate enough to be discouraging.&lt;/p&gt;
&lt;h4&gt;
  
  
  Piping and currying
&lt;/h4&gt;

&lt;p&gt;Rescript is a functional language with no methods on objects, but you can call and chain functions in a familiar way with piping and currying, like&lt;br&gt;
&lt;code&gt;myList-&amp;gt;List.length&lt;/code&gt; &lt;br&gt;
or &lt;br&gt;
&lt;code&gt;myArray-&amp;gt;Array.map(item =&amp;gt; item * 2)&lt;/code&gt;&lt;/p&gt;
&lt;h4&gt;
  
  
  Sound type system and type inference
&lt;/h4&gt;

&lt;p&gt;This is probably the main reason to choose rescript. It has strong type system and powerful type inference, so you are rarely required to explicitly define types, but the compiler always knows what the types are.&lt;/p&gt;
&lt;h4&gt;
  
  
  No folder requirements and no imports
&lt;/h4&gt;

&lt;p&gt;This is a case in many languages, but coming from Java I really appreciate this feature. And Javascript developers love the no imports thing!&lt;/p&gt;
&lt;h4&gt;
  
  
  Full support of algebraic data types
&lt;/h4&gt;

&lt;p&gt;It's very easy to describe any domain with the custom types&lt;br&gt;
You can create type aliases like &lt;code&gt;type eventId = string&lt;/code&gt; or complex types like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;type event = {
  id: eventId,
  name: string,
  uniqueName: option&amp;lt;string&amp;gt;,
  description: string,
  properties: list&amp;lt;property&amp;gt;,
  types: list&amp;lt;eventType&amp;gt;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h4&gt;
  
  
  The main construction in the language is the exhaustive switch optimized for pattern matching
&lt;/h4&gt;

&lt;p&gt;It's accompanied by an empowered kind of enum called variants. There are options of variants with and without duck typing. &lt;a href="https://tinyurl.com/yv4nfpkm"&gt;Better to see it in action&lt;/a&gt;&lt;/p&gt;

&lt;h4&gt;
  
  
  Simple syntax
&lt;/h4&gt;

&lt;p&gt;It's possible to start writing code after just a few hours of learning if you already know another programming language.&lt;/p&gt;

&lt;h3&gt;
  
  
  Relatively safe refactoring
&lt;/h3&gt;

&lt;p&gt;The combination of a rigid type system and exhaustive switches make the compiler very efficient in finding bugs in the compile time.&lt;/p&gt;

&lt;h3&gt;
  
  
  What are the not so good things?
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Simple syntax means it's verbose
&lt;/h4&gt;

&lt;p&gt;There is not much syntax sugar, for example to unwrap an optional constant you'd have to write &lt;code&gt;maybeSomething-&amp;gt;Option.map(something -&amp;gt; something-&amp;gt;performOperation)&lt;/code&gt; instead of &lt;code&gt;maybeSomething?.performOperation()&lt;/code&gt; in some other languages.&lt;/p&gt;

&lt;h4&gt;
  
  
  You have to define functions before using them
&lt;/h4&gt;

&lt;p&gt;Yes, like in good old C.&lt;/p&gt;

&lt;h4&gt;
  
  
  You can still have type-related bugs
&lt;/h4&gt;

&lt;p&gt;Having a powerful compiler that catches 99% of the type bugs can be too relaxing and it becomes easier to miss that one occasional bug that slips through the compiler checks. 😉&lt;/p&gt;

&lt;h3&gt;
  
  
  Bonus
&lt;/h3&gt;

&lt;p&gt;We are maintaining a public code style guide for &lt;a href="https://github.com/avohq/reasonml-code-style-guide"&gt;ReasonML&lt;/a&gt;, contributions are very welcome!&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>web</category>
      <category>node</category>
    </item>
    <item>
      <title>Kotlin vs Swift: implementing a method that accepts a limited set of polymorphic equitable types</title>
      <dc:creator>Alex Verein</dc:creator>
      <pubDate>Tue, 23 Mar 2021 18:47:34 +0000</pubDate>
      <link>https://dev.to/tpom6oh/kotlin-vs-swift-implementing-a-method-that-accepts-a-limited-set-of-polymorphic-equitable-types-jd8</link>
      <guid>https://dev.to/tpom6oh/kotlin-vs-swift-implementing-a-method-that-accepts-a-limited-set-of-polymorphic-equitable-types-jd8</guid>
      <description>&lt;p&gt;At Avo we work on code generation based on tracking plans.&lt;br&gt;
Recently we added a new interface for calling events - before we were generating a method for each event in the tracking plan, i. e. there were methods &lt;code&gt;Avo.userSubscribed(userType, subscriptionType)&lt;/code&gt; and &lt;code&gt;Avo.commentAdded(authorId, mentionedUserIds)&lt;/code&gt;.&lt;br&gt;
With the new interface we create a type for each event, i.e. &lt;code&gt;UserSubscribed&lt;/code&gt; with &lt;code&gt;userType&lt;/code&gt; and &lt;code&gt;subscriptionType&lt;/code&gt; as fields and &lt;code&gt;CommentAdded&lt;/code&gt; with &lt;code&gt;authorId&lt;/code&gt; and &lt;code&gt;mentionedUserIds&lt;/code&gt; fields, and a new method called &lt;code&gt;track&lt;/code&gt; that expects instances of those types, like this  &lt;code&gt;Avo.track(UserSubscribed(userType, subscriptionType))&lt;/code&gt;&lt;/p&gt;
&lt;h3&gt;
  
  
  Why?
&lt;/h3&gt;

&lt;p&gt;This change makes Avo more flexible to use in large codebases, for example you can build the &lt;code&gt;UserSubscribed&lt;/code&gt; events in different parts of you app gradually and pass it around.&lt;br&gt;
You can also build a simple test implementation of the new &lt;code&gt;track&lt;/code&gt; interface that does not require mocking.&lt;/p&gt;
&lt;h3&gt;
  
  
  What are the challenges?
&lt;/h3&gt;

&lt;p&gt;Firstly, we don't want users of the generated code to pass unexpected things to the track method. Only the events defined in the tracking plan are expected.&lt;br&gt;
Secondly, we want the events to be meaningfully comparable.&lt;/p&gt;
&lt;h3&gt;
  
  
  Solution
&lt;/h3&gt;

&lt;p&gt;Let's see what both languages can offer us to solve this little challenge.&lt;/p&gt;
&lt;h4&gt;
  
  
  1. Defining the event types.
&lt;/h4&gt;

&lt;p&gt;The ways of choice to define a limited set of types are:&lt;/p&gt;

&lt;p&gt;In Kotlin - sealed classes. Sealed classes are abstract classes and you can define their child classes only in the same file. User's won't be able to create their implementation of our sealed class, exactly as we want. This also makes the compiler know the exact set of descendants of our sealed class.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;sealed class AvoEvent {
    data class UserSubscribed(val userType: String, val subscriptionType: String): AvoEvent()
    data class CommentAdded(val authorId: String, val mentionedUserIds: List&amp;lt;String&amp;gt;): AvoEvent()
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In Swift - enums. Enums in Swift are more powerful than in most other similar languages. Each enum case can have any number of variously typed parameters, which is nice for our case. User's are not able to add cases outside of the enum.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;public enum AvoEvent: Equatable {
    case userSubscribed(userType: String, subscriptionType: String);
    case commentAdded(authorId: String, mentionedUserIds: [String]);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ul&gt;
&lt;li&gt;Here things are quite even, since classes are a bit more flexible (more on it in the next section) and also in Kotlin you use common &lt;code&gt;class&lt;/code&gt; interface for most things, while in Swift you have to use different entities - &lt;code&gt;classes&lt;/code&gt; / &lt;code&gt;structs&lt;/code&gt; and &lt;code&gt;enums&lt;/code&gt;. On the other hand Swift code looks cleaner.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  2. Making the types equitable
&lt;/h4&gt;

&lt;p&gt;In Kotlin we use data classes. Every data class automatically gets &lt;code&gt;equals&lt;/code&gt; method implementation without the need to write any code based on the primary constructor values.&lt;br&gt;
In Swift we set our enum to conform the &lt;code&gt;Equitable&lt;/code&gt; protocol. In modern Swift if all the used types of a thing we add &lt;code&gt;Equitable&lt;/code&gt; protocol to are &lt;code&gt;Equitable&lt;/code&gt; you don't need to write any implementation. This is similar for both languages.&lt;br&gt;
Everything is great until we get a enum member with an &lt;code&gt;Any&lt;/code&gt; type parameter.&lt;br&gt;
The problem in Swift is that the &lt;code&gt;Any&lt;/code&gt; type is not &lt;code&gt;Equitable&lt;/code&gt;. And once it appears you have to implement the compare method (&lt;code&gt;==&lt;/code&gt;) manually. Moreover, once you have the compare method you have to manually implement comparison of each enum case. (In Kotlin for example we can implement the equality method on a separate single child class of our sealed class, that's the advantage of sealed classes over enums I mentioned in the previous section).&lt;br&gt;
In Kotlin &lt;code&gt;Any&lt;/code&gt; type is equitable out of the box. Since it's has &lt;code&gt;equals&lt;/code&gt; method it is designed to be.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;This point is won by Kotlin.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;
  
  
  3. Picking what to do based on the provided parameter
&lt;/h4&gt;

&lt;p&gt;Here everything is quite simple:&lt;br&gt;
In Kotlin we use &lt;code&gt;when&lt;/code&gt; statement.&lt;br&gt;
In Swift we use &lt;code&gt;switch&lt;/code&gt; statement.&lt;br&gt;
The good thing about the &lt;code&gt;switch&lt;/code&gt; statements in Swift is that they are required to be exhaustive. This makes perfect sense in a statically typed languages - I want to be sure that if I add a new case to my enum and not add it to the &lt;code&gt;switch&lt;/code&gt; I'm alarmed by the compiler.&lt;br&gt;
Unfortunately it is not the case in Kotlin. When you use &lt;code&gt;when&lt;/code&gt; as a statement, not assigning it's result to a variable or using it in some other way, which is a default way for those who come from Java and many other C-like languages, it is not required to be exhaustive. You can use &lt;code&gt;when&lt;/code&gt; as expression and then it becomes &lt;code&gt;exhaustive&lt;/code&gt;, but that's not enough. &lt;a href="https://proandroiddev.com/til-when-is-when-exhaustive-31d69f630a8b"&gt;Here is a bit more on that topic&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In this part I give the point to Swift.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Results
&lt;/h3&gt;

&lt;p&gt;All in all, it is a draw in out little face off, Kotlin is a winner on the data structure design side and Swift wins in the operator design.&lt;/p&gt;

</description>
      <category>kotlin</category>
      <category>swift</category>
    </item>
    <item>
      <title>What are great developer docs? Looking at Stripe here, let's discuss</title>
      <dc:creator>Alex Verein</dc:creator>
      <pubDate>Tue, 16 Mar 2021 09:43:30 +0000</pubDate>
      <link>https://dev.to/tpom6oh/what-are-great-developer-docs-looking-at-stripe-here-let-s-discuss-1eo9</link>
      <guid>https://dev.to/tpom6oh/what-are-great-developer-docs-looking-at-stripe-here-let-s-discuss-1eo9</guid>
      <description>&lt;p&gt;Recently I had a chance to work with one of the most honored developer experiences out there - with Stripe, &lt;a href="https://stripe.com/docs"&gt;https://stripe.com/docs&lt;/a&gt;&lt;br&gt;
Here are a few things I really liked about the docs there and a few flaws I found.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;But to be clear, overall I rate Stripe docs very high.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;(+) First of all, it's awesome. Human readable prefixes in the API keys, omg, why does not everyone do it?!! I.e. &lt;code&gt;price_******&lt;/code&gt; for a price key and &lt;code&gt;sub_*******&lt;/code&gt; for a subscription key&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(+) Docs are user story based, which is very cool. It's easy to go with the flow and find what you need. Would totally adapt that. Search is also good, but it is a must nowadays&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(-) The subject area is huge, some specific things are hard to find though, i.e. subscription statuses are teased here and there, but the whole list is only in the API docs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(-) Some cherry picked dev docs/references are available through the main docs entry point, but others live at &lt;a href="https://stripe.dev"&gt;https://stripe.dev&lt;/a&gt; and there are no easily findable direct links to the server sdks from the main docs&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;(+) Server (at least Node.js I worked with) SKDs are exactly like the API reference. This is insanely convenient. I suspect this is one of the reason why the server SDKs are not featured in the main docs&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;What do you like and dislike about developer docs, for Stripe or any other product? Share some examples!&lt;/strong&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>devrel</category>
      <category>docs</category>
      <category>devlive</category>
    </item>
    <item>
      <title>Public ReasonML Code Style Guide @Avo</title>
      <dc:creator>Alex Verein</dc:creator>
      <pubDate>Tue, 27 Oct 2020 08:58:54 +0000</pubDate>
      <link>https://dev.to/tpom6oh/public-reasonml-code-style-guide-avo-1pad</link>
      <guid>https://dev.to/tpom6oh/public-reasonml-code-style-guide-avo-1pad</guid>
      <description>&lt;p&gt;Just released a &lt;a href="https://www.avo.app/blog/reasonml-code-style-guide"&gt;blog post&lt;/a&gt; about our Code Style Guide approach.&lt;/p&gt;

&lt;p&gt;Last week we've open sourced the guide itself &lt;a href="https://github.com/avohq/reasonml-code-style-guide"&gt;on GitHub&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Contributions are adoptions are more than welcome, let's build a canonical ReasonML &amp;amp; ReScript code style guide together! &lt;/p&gt;

</description>
      <category>reason</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
