<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Idarlington</title>
    <description>Random thougths and TILs.</description>
    <link>https://idarlington.github.iohttps://idarlington.github.io/</link>
    <atom:link href="https://idarlington.github.iohttps://idarlington.github.io/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Tue, 29 Aug 2023 17:56:54 +0000</pubDate>
    <lastBuildDate>Tue, 29 Aug 2023 17:56:54 +0000</lastBuildDate>
    <generator>Jekyll v3.9.3</generator>
    
      <item>
        <title>Not so common Kafka CLI commands</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;p&gt;Recently, a colleague asked how to view keys of consumed records and I wasn’t sure it was possible.  I thought I knew all the important cli commands then. Later on, after a google search, I found it was possible.&lt;/p&gt;

&lt;p&gt;I decided to spend some time going through the Kafka console classes I use the most — &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka.tools.ConsoleConsumer&lt;/code&gt; and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka.tools.ConsoleProducer&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Here are some not so common commands you can use in the CLI:&lt;/p&gt;

&lt;h2 id=&quot;kafka-console-consumer&quot;&gt;Kafka Console Consumer&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;print.key:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;This property configures the console consumer to print the keys of the messages it consumes. The default value is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;print.value:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;When you are not concerned with printing the values of the records being consumed, you can set this property which configures the console consumer to/not to print values of records being consumed. The default value is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;true&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;print.timestamp:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;You can configure the console consumer to/not to print the timestamp of records being consumed. The default value is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;. &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;NO_TIMESTAMP&lt;/code&gt; is printed out if there is no timestamp configured for the records and the property is set to true.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;key.separator:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;This property configures the character that separates the key and value when they are both printed. The default value is the tab character &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\t&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;line.separator:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;Property configuring the character separating each record being consumed. The default value is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\n&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;formatter:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;The name of the class to use for formatting kafka records being printed. The default value is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka.tools.DefaultMessageFormatter&lt;/code&gt;.
  Other formatters are: &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka.tools.LoggingMessageFormatter&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka.tools.NoOpMessageFormatter&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;kafka.tools.ChecksumMessageFormatter&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example of console consumer command using the flags and properties defined above:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;
kafka-console-consumer.sh &lt;span class=&quot;nt&quot;&gt;--bootstrap-server&lt;/span&gt; localhost:9092 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--topic&lt;/span&gt; test-topic &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--from-beginning&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--formatter&lt;/span&gt; kafka.tools.DefaultMessageFormatter &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--property&lt;/span&gt; print.key&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--property&lt;/span&gt; print.value&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;&lt;span class=&quot;nb&quot;&gt;true&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--property&lt;/span&gt; key.deserializer&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;org.apache.kafka.common.serialization.StringDeserializer &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
    &lt;span class=&quot;nt&quot;&gt;--property&lt;/span&gt; value.deserializer&lt;span class=&quot;o&quot;&gt;=&lt;/span&gt;org.apache.kafka.common.serialization.StringSerializer
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;h2 id=&quot;kafka-console-producer&quot;&gt;Kafka Console Producer&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;key.separator:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;By default inputs to the Kafka producer console are recognised as values and null is used for the keys. This property allows users input key and value messages in the producer console.
  It represents the character separating the key and value. The default value is the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;\t&lt;/code&gt; character. It has to be used with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;parse.key&lt;/code&gt; property.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;parse.key:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;This property indicates if the key is to be serialized, it is used with the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;key.separator&lt;/code&gt; property. The default value is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;false&lt;/code&gt;.&lt;/p&gt;
  &lt;/li&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;em&gt;ignore.error:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;This property configures the console producer to ignore errors when the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;key.separator&lt;/code&gt; property is set and there is not used in an input line in the console.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Example of console producer command using the flags and properties defined above:&lt;/p&gt;

&lt;div class=&quot;language-sh highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;kafka-console-producer.sh &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--broker-list&lt;/span&gt; localhost:9092 &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--topic&lt;/span&gt; test-topic &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--property&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;parse.key=true&quot;&lt;/span&gt; &lt;span class=&quot;se&quot;&gt;\&lt;/span&gt;
  &lt;span class=&quot;nt&quot;&gt;--property&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;key.separator=-&quot;&lt;/span&gt;


key1-value1
key2-value2
key3-value3
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;
</description>
        <pubDate>Tue, 30 Oct 2018 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2018/Not-so-common-Kafka-cli-commands/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2018/Not-so-common-Kafka-cli-commands/</guid>
        
        <category>Kafka</category>
        
        
      </item>
    
      <item>
        <title>Error handling in Scala</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;p&gt;Slides for the presentation I gave at Lagos Scala July Meetup.&lt;/p&gt;

&lt;iframe src=&quot;https://docs.google.com/presentation/d/e/2PACX-1vTaOe8A2WNqhkCX8jis7NwStLgXjX-4pODQGr88ugKbSFf18bT_58Dt3GK_H1axhtHPGc63v8hiHAXH/embed?start=false&amp;amp;loop=false&amp;amp;delayms=3000&quot; frameborder=&quot;0&quot; width=&quot;960&quot; height=&quot;569&quot; allowfullscreen=&quot;true&quot; mozallowfullscreen=&quot;true&quot; webkitallowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;
</description>
        <pubDate>Sat, 01 Jul 2017 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2017/error-handling-in-scala/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2017/error-handling-in-scala/</guid>
        
        <category>Scala</category>
        
        
      </item>
    
      <item>
        <title>When you dont feel like coding but have to</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;p&gt;Slides for the presentation I gave at Lagos Agile May Meetup.&lt;/p&gt;

&lt;iframe src=&quot;https://docs.google.com/presentation/d/1nlQWTGVklmHGDq82OHDp2U96-Oi6Rl7CVkLUQ1cY0nE/embed?start=false&amp;amp;loop=false&amp;amp;delayms=3000&quot; frameborder=&quot;0&quot; width=&quot;960&quot; height=&quot;569&quot; allowfullscreen=&quot;true&quot; mozallowfullscreen=&quot;true&quot; webkitallowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;
</description>
        <pubDate>Mon, 22 May 2017 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2017/what-to-do-when-you-dont-feel-like-coding-but-have-to/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2017/what-to-do-when-you-dont-feel-like-coding-but-have-to/</guid>
        
        <category>health, wellbeing</category>
        
        
      </item>
    
      <item>
        <title>Getting started with Apache Avro</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;h2 id=&quot;what-is-avro-&quot;&gt;What is Avro ?&lt;/h2&gt;
&lt;p&gt;Avro is a data serialisation and &lt;a href=&quot;https://en.wikipedia.org/wiki/Remote_procedure_call&quot;&gt;RPC&lt;/a&gt; system like protobuff and thrift. It relies on a schema-based system. This schema is in JSON which is an advantage as most languages already have JSON libraries. Avro was originally developed by &lt;a href=&quot;https://twitter.com/cutting&quot;&gt;Doug Cutting&lt;/a&gt; to provide data serialisation and data exchange services for hadoop. It has since evolved to serve other technologies apart from hadoop.&lt;/p&gt;

&lt;p&gt;Theoretically, Avro can be used in any language but it has APIs for PHP, Java, Perl, Python, C, C++, C#, Go, Haskell and Ruby.&lt;/p&gt;

&lt;h2 id=&quot;where-avro-shines&quot;&gt;Where Avro shines&lt;/h2&gt;
&lt;p&gt;Comparing Avro with similar systems (protobuff, thrift, message pack), these are the areas where it differs :&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
    &lt;p&gt;&lt;em&gt;Dynamic typing:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;Serialisation and deserialization can be done without code generation. Code generation is also available for statically typed languages as an optional optimisation.&lt;/p&gt;
  &lt;/li&gt;

&lt;li&gt;
    &lt;p&gt;&lt;em&gt;Schema evolution:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;Avro requires schemas when data is written or read. Most interesting is that you can use different schemas for serialisation and deserialization, and Avro will handle the missing/extra/modified fields.&lt;/p&gt;
  &lt;/li&gt;

&lt;li&gt;
    &lt;p&gt;&lt;em&gt;Untagged data:&lt;/em&gt;&lt;/p&gt;

    &lt;p&gt;Other serialisation systems like protobuff tag data but providing a schema with binary data allows each datum be written without the overhead. The result is more compact data encoding and faster data processing.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;why-you-need-avro-or-serialisation-libraries-generally&quot;&gt;Why you need Avro (or serialisation libraries generally):&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;You save storage space. &lt;a href=&quot;https://eng.uber.com/trip-data-squeeze/&quot;&gt;Uber&lt;/a&gt; drastically reduced their storage needs by implementing data serialization and compression.&lt;/li&gt;
  &lt;li&gt;It significantly reduces the amount of time spent processing data.&lt;/li&gt;
  &lt;li&gt;Translates to less money saved on provisioning hardware.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;data-types-in-avro&quot;&gt;Data types in Avro&lt;/h2&gt;
&lt;p&gt;Avro supports a range of data types. These types could be either primitive, complex or logical types.&lt;/p&gt;

&lt;h3 id=&quot;primitive-types&quot;&gt;Primitive types:&lt;/h3&gt;
&lt;ol&gt;
  &lt;li&gt;&lt;em&gt;null :&lt;/em&gt; no value&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;boolean :&lt;/em&gt; a binary value&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;int :&lt;/em&gt; 32-bit signed integer&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;long :&lt;/em&gt; 64-bit signed integer&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;float :&lt;/em&gt; single precision (32-bit) IEEE 754 floating-point number&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;double :&lt;/em&gt; double precision (64-bit) IEEE 754 floating-point number&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;bytes :&lt;/em&gt; sequence of 8-bit unsigned bytes&lt;/li&gt;
  &lt;li&gt;&lt;em&gt;string :&lt;/em&gt; Unicode character sequence&lt;/li&gt;
&lt;/ol&gt;

&lt;h3 id=&quot;complex-types&quot;&gt;Complex Types:&lt;/h3&gt;
&lt;p&gt;Avro also provides complex data types which are majorly a combination of primitive types. The complex types are:&lt;/p&gt;

&lt;ol&gt;

&lt;li&gt;

    &lt;h4 id=&quot;records&quot;&gt;&lt;em&gt;Records:&lt;/em&gt;&lt;/h4&gt;
    &lt;p&gt;A record is a collection of multiple types. A record is equivalent to a JSON object or a dictionary in python.&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Point&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;fields&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;x&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;y&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;int&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;

&lt;li&gt;

    &lt;h4 id=&quot;enum&quot;&gt;&lt;em&gt;Enum:&lt;/em&gt;&lt;/h4&gt;
    &lt;p&gt;An enumeration is a list of items in a collection.&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;enum&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;Suit&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;symbols&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
        &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;SPADES&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;HEARTS&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;DIAMONDS&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
        &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;CLUBS&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;

&lt;li&gt;

    &lt;h4 id=&quot;arrays&quot;&gt;&lt;em&gt;Arrays:&lt;/em&gt;&lt;/h4&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; type &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; array &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; items &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt; int &lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;

&lt;li&gt;

    &lt;h4 id=&quot;maps&quot;&gt;&lt;em&gt;Maps:&lt;/em&gt;&lt;/h4&gt;
    &lt;p&gt;Map keys are assumed to be strings. Eg :&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;map&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;values&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;long&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;

&lt;li&gt;

    &lt;h4 id=&quot;unions&quot;&gt;&lt;em&gt;Unions:&lt;/em&gt;&lt;/h4&gt;
    &lt;p&gt;Unions are represented using JSON arrays.&lt;/p&gt;

    &lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;[&quot;null&quot;, &quot;string&quot;]&lt;/code&gt; declares a schema which may be either a null or string.&lt;/p&gt;
  &lt;/li&gt;

&lt;li&gt;

    &lt;h4 id=&quot;fixed&quot;&gt;&lt;em&gt;Fixed:&lt;/em&gt;&lt;/h4&gt;
    &lt;p&gt;This data type is used to declare a fixed-sized field that can be used for storing binary data. It has field name and data as attributes. Name holds the name of the field, and size holds the size of the field.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;defining-a-schema&quot;&gt;Defining a schema&lt;/h2&gt;
&lt;p&gt;As indicated, Avro schemas are defined with JSON. The Schema is a representation of the data to be serialized in avro data types.&lt;/p&gt;

&lt;p&gt;Creating a schema for this Object&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;products&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;A green door&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;12.50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;home&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;A green door&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;12.50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;home&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;A green door&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;mf&quot;&gt;12.50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;home&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;green&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;would result in :&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-js&quot; data-lang=&quot;js&quot;&gt;&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;namespace&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;com.idarlington.avro&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;stream&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;fields&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;products&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;
                    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;product&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;record&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                    &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;fields&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:[&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;id&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;integer&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;price&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;float&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;},&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;tags&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                            &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:{&lt;/span&gt;
                                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;type&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;array&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;
                                &lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;items&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;:&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;string&lt;/span&gt;&lt;span class=&quot;dl&quot;&gt;&quot;&lt;/span&gt;
                            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
                        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
                    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
                &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
            &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
        &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;]&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;p&gt;To validate and test your avro schema, you can check &lt;a href=&quot;http://sh6.tarantool.org/&quot;&gt;this&lt;/a&gt; out.&lt;/p&gt;

&lt;p&gt;My next post would be on serialzing and deserializing with Avro. If you like this post, please share ♥.&lt;/p&gt;
</description>
        <pubDate>Thu, 30 Mar 2017 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2017/Getting-started-avro/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2017/Getting-started-avro/</guid>
        
        <category>Avro</category>
        
        
      </item>
    
      <item>
        <title>MongoDB Replication</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;h2 id=&quot;replication&quot;&gt;Replication?&lt;/h2&gt;

&lt;blockquote&gt;
  &lt;p&gt;Replication provides redundancy and increases data availability. With multiple copies of data on different database servers, replication provides a level of fault tolerance against the loss of a single database server.&lt;/p&gt;

  &lt;p&gt;— &lt;em&gt;MongoDB Manual&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A replica set in MongoDB is a group of mongod instances that maintain the same data set. The mongod instances are known as nodes. Nodes could be primary or secondary.&lt;/p&gt;

&lt;p&gt;By default write operations are performed on the primary node and synced to other secondary nodes. Read operations are also performed on the primary node by default but the configuration on read operations can be changed.&lt;/p&gt;
&lt;div style=&quot;text-align:center&quot;&gt;
  &lt;p&gt;&lt;img src=&quot;/assets/images/mongo-replication.png&quot; alt=&quot;MongoDB replication&quot; title=&quot;Replica set example&quot; /&gt;&lt;/p&gt;
&lt;/div&gt;

&lt;h2 id=&quot;benefits-of-replication&quot;&gt;Benefits of replication&lt;/h2&gt;

&lt;ul&gt;
  &lt;li&gt;High availability  &amp;amp; redundancy&lt;/li&gt;
  &lt;li&gt;Distributes database requests, therefore, could increase application’s speed (has to be configured)&lt;/li&gt;
&lt;/ul&gt;

&lt;h2 id=&quot;setting-up-a-replica-set&quot;&gt;Setting Up a Replica Set&lt;/h2&gt;

&lt;ol&gt;
  &lt;li&gt;

    &lt;h4 id=&quot;set-up-mongodb-on-the-servers-&quot;&gt;&lt;em&gt;Set Up MongoDB on the servers&lt;/em&gt; :&lt;/h4&gt;
    &lt;p&gt;&lt;a href=&quot;https://docs.mongodb.com/v3.0/tutorial/install-mongodb-on-ubuntu/&quot;&gt;Mongod instances&lt;/a&gt; need to be setup on the servers you plan to use in the replica set.&lt;/p&gt;

    &lt;p&gt;Ideally, a replica set is to have an odd number of mongod instances; this is to ensure that during an election for a master mongod instance, quorom can be reached. If you can only set up even mongod instances, then you have to add an arbiter.  The minimum number of mongod instances is three,  if you can only setup two, then you have to add an arbiter.&lt;/p&gt;

    &lt;p&gt;Arbiters are mongod instances that are part of a replica set but do not hold data. Arbiters participate in elections in order to break ties.&lt;/p&gt;

    &lt;p&gt;I have seen a few cases where all mongod instances of a replica set are setup on a single server, I think it beats the purpose of setting up a replica set. If that server goes down, then your MongoDB server becomes unavailable.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;h3 id=&quot;check-connection-between-mongod-instances-&quot;&gt;&lt;em&gt;Check connection between Mongod instances&lt;/em&gt; :&lt;/h3&gt;
    &lt;p&gt;The connection between the Mongod instances on the different servers needs to be tested and confirmed. This is important if you use a firewall on your servers. I have had cases where I setup a replica set and it wasn’t working only to find out the connection port between the Mongod instances was blocked.&lt;/p&gt;

    &lt;p&gt;The hostname of the servers where other Mongod instances are located needs to be added to each server’s &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/hosts&lt;/code&gt;. For a server with hostname &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;idarlington&lt;/code&gt; and ip &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;192.168.2.218&lt;/code&gt;, it should be added as :&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;192.168.2.218 idarlington&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;


  &lt;li&gt;
    &lt;h3 id=&quot;set-up-configuration-file-&quot;&gt;&lt;em&gt;Set up configuration file&lt;/em&gt; :&lt;/h3&gt;
    &lt;p&gt;After confirming the connection between the Mongod instances, you can now begin the replica set setup proper. You need to edit the MongoDB conf file that starts the Mongod service.&lt;/p&gt;

    &lt;p&gt;For most linux systems the conf file is located in the &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;/etc/init&lt;/code&gt;. For &lt;strong&gt;MongoDB 2.4 and lower&lt;/strong&gt;, the file is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mongodb.conf&lt;/code&gt; while for &lt;strong&gt;MongoDB 2.6 and above&lt;/strong&gt;,  the file is &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;mongod.conf&lt;/code&gt;&lt;/p&gt;

    &lt;p&gt;For &lt;strong&gt;MongoDB version 2.6 and above&lt;/strong&gt;&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;s&quot;&gt;replication.replSetName&lt;/span&gt; &lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;replset&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;you&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;have&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;chosen&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

    &lt;p&gt;OR&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;na&quot;&gt;replication&lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt;
   &lt;span class=&quot;na&quot;&gt;replSetName &lt;/span&gt;&lt;span class=&quot;pi&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;s2&quot;&gt;&quot;&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;replset&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;you&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;have&lt;/span&gt;&lt;span class=&quot;nv&quot;&gt; &lt;/span&gt;&lt;span class=&quot;s&quot;&gt;chosen&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

    &lt;p&gt;For &lt;strong&gt;MongoDB 2.4 and below&lt;/strong&gt;&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-yaml&quot; data-lang=&quot;yaml&quot;&gt;&lt;span class=&quot;s&quot;&gt;replSet  = &quot;replset name you have chosen&quot;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;


  &lt;li&gt;

    &lt;h3 id=&quot;initiate-replica-set-&quot;&gt;&lt;em&gt;Initiate Replica Set&lt;/em&gt; :&lt;/h3&gt;
    &lt;p&gt;You can now exit the conf file and start a mongo shell on the server you want to be the primary node.&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-zsh&quot; data-lang=&quot;zsh&quot;&gt;  Mongo
  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

    &lt;p&gt;Then to initiate the replica set :&lt;/p&gt;
    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;rs.initiate&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

    &lt;p&gt;To show the configuration of the replica set :&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt; rs.conf&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

    &lt;p&gt;To show the recent status of the replica set :&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;rs.status&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;

  &lt;li&gt;

    &lt;h3 id=&quot;add-other-members-&quot;&gt;&lt;em&gt;Add other members&lt;/em&gt; :&lt;/h3&gt;
    &lt;p&gt;After initiating the replica set, its only member is the current server where you are running the mongo shell. To add other members to the replica set, use the IP address or hostname of the server with the mongod instance you want to add like&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  rs.add&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;192.168.2.128&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;

  &lt;li&gt;

    &lt;h3 id=&quot;adding-an-arbiter-&quot;&gt;&lt;em&gt;Adding an arbiter&lt;/em&gt; :&lt;/h3&gt;
    &lt;p&gt;Arbiters are useful when you have an even number of nodes, if you already have an odd number of nodes, it is not needful. To add an arbiter, you can either use its hostname or ip address.&lt;/p&gt;

    &lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-sh&quot; data-lang=&quot;sh&quot;&gt;  rs.addArb&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s2&quot;&gt;&quot;192.168.2.13&quot;&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;
  &lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

  &lt;/li&gt;
&lt;/ol&gt;

&lt;h2 id=&quot;notes&quot;&gt;Notes&lt;/h2&gt;
&lt;ul&gt;
  &lt;li&gt;If you formerly built your application to work with a standalone MongoDB server, you have to update your mongodb connection to work with a replica set. The way to do this differs with the ORM or driver you use for your application.&lt;/li&gt;
  &lt;li&gt;You can set read preference on your application. The available options are &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;primary&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;primaryPrefered&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secondary&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;secondaryPrefered&lt;/code&gt;, &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;nearest&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;
</description>
        <pubDate>Mon, 14 Nov 2016 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2016/mongodb-replication/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2016/mongodb-replication/</guid>
        
        <category>MongoDB</category>
        
        
      </item>
    
      <item>
        <title>Why Scala ?</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;p&gt;Slides for the presentation I gave at Lagos Scala October Meetup.&lt;/p&gt;

&lt;iframe src=&quot;https://docs.google.com/presentation/d/15SDgIM70gJxCIF3UD5tiA5LmrfyDKwKizLNU6KV2hBg/embed?start=false&amp;amp;loop=false&amp;amp;delayms=3000&quot; frameborder=&quot;0&quot; width=&quot;960&quot; height=&quot;569&quot; allowfullscreen=&quot;true&quot; mozallowfullscreen=&quot;true&quot; webkitallowfullscreen=&quot;true&quot;&gt;&lt;/iframe&gt;
</description>
        <pubDate>Mon, 24 Oct 2016 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2016/why-scala-lagos-scala-meetup/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2016/why-scala-lagos-scala-meetup/</guid>
        
        <category>Scala</category>
        
        
      </item>
    
      <item>
        <title>Best resources for learning Scala</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}
ol {
  list-style-type: decimal;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;p&gt;Assuming I have been able to convince you to &lt;a href=&quot;/2016/why-you-should-learn-scala/&quot;&gt;learn Scala&lt;/a&gt;, as a &lt;em&gt;good friend&lt;/em&gt;, I won’t throw you into the deep end with no guide.&lt;/p&gt;

&lt;p&gt;Here are few resources I believe will help you fully learn Scala and accelerate the process :&lt;/p&gt;

&lt;ol&gt;
  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://gumroad.com/l/AtomicScala&quot;&gt;Atomic Scala&lt;/a&gt; : &lt;a href=&quot;http://www.atomicscala.com/&quot;&gt;This book&lt;/a&gt; assumes the reader has no prior programming experience. It introduces solution patterns and syntax. It provides the reader with the foundations of programming and Scala. It could be the first book you use in learning Scala but not the last.&lt;/p&gt;
    &lt;div style=&quot;text-align:center&quot;&gt;
      &lt;p&gt;&lt;img src=&quot;/assets/images/atomicScala.png&quot; alt=&quot;Atomic Scala&quot; title=&quot;Atomic Scala&quot; /&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://bigdatauniversity.com/courses/scala-course/&quot;&gt;Big Data University’s Introduction to Scala&lt;/a&gt; : This is a series of videos on Scala that can be completed within 6-8 hours. It is assumed you have no prior knowledge of Scala but have some programming experience. The videos were created by &lt;a href=&quot;https://www.lightbend.com/&quot;&gt;Typesafe&lt;/a&gt; (now known as Lightbend)&lt;/p&gt;
    &lt;div style=&quot;text-align:center&quot;&gt;
      &lt;p&gt;&lt;img src=&quot;/assets/images/bdu-logo-centre.png&quot; alt=&quot;Big Data University&quot; title=&quot;Big Data University&quot; /&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://shop.oreilly.com/product/0636920030287.do&quot;&gt;Learning Scala&lt;/a&gt; : This book is a comprehensive introduction for beginner and intermediate programmers to Scala. It contains syntax diagrams, examples, and exercises. You’ll start with Scala’s core types and syntax before diving into higher-order functions and immutable data structures. This book is a great place to start for student, intermediate or experts that aren’t familiar with the Java stack and is about 220 pages long.&lt;/p&gt;
    &lt;div style=&quot;text-align:center&quot;&gt;
      &lt;p&gt;&lt;img src=&quot;http://akamaicovers.oreilly.com/images/0636920030287/cat.gif&quot; alt=&quot;Learning Scala&quot; title=&quot;Learning Scala&quot; /&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://shop.oreilly.com/product/0636920026914.do&quot;&gt;Scala Cookbok&lt;/a&gt; : Although I wouldn’t advise anyone to use a cookbook in learning a language or framework as they give the learner a shallow understanding of the available features and design decisions.&lt;/p&gt;
    &lt;p&gt;This book gives the reader an overview of the language, it can also be used as a quick reference which is what I use it for most times. It is well written and approachable.
  &lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://joelabrahamsson.com/learning-scala/&quot;&gt;Joel Abrahamsson’s Learning Scala&lt;/a&gt; :  This is a series of blog posts on Joel Abrahamsson’s adventures in learning scala. It is a short series but gives the reader a easy way to approach learning Scala. It is mostly suited for novices and beginners.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.coursera.org/learn/progfun1&quot;&gt;Functional Programming Principles in Scala on Coursera&lt;/a&gt; :
  This coursera course is taught by Martin Odersky - the creator of scala. It focuses on programming in Scala using the functional paradigm and gives a great overview of the language. The course could span about seven weeks and is suited for intermediate programmers.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://shop.oreilly.com/product/0636920033073.do&quot;&gt;Programming Scala&lt;/a&gt;
  Programming Scala gets you up to speed on Scala, it is also packed with code examples. This book shows you how to be productive with the language and ecosystem and is quite comprehensive and easy to read.&lt;br /&gt;&lt;/p&gt;
    &lt;div style=&quot;text-align:center&quot;&gt;
      &lt;p&gt;&lt;img src=&quot;http://akamaicovers.oreilly.com/images/0636920033073/cat.gif&quot; alt=&quot;Programming Scala&quot; title=&quot;Programming Scala&quot; /&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.artima.com/shop/programming_in_scala_3ed&quot;&gt;Programming in Scala&lt;/a&gt; :
  This book is written by some of the core maintainers and developers of Scala - Martin Odersky, Lex Spoon, and Bill Venners . It is a detailed and definitive guide to Scala. It provides great insights on the language’s features with detailed examples. There is a &lt;a href=&quot;http://www.artima.com/pins1ed/&quot;&gt;free online version&lt;/a&gt; of the book.&lt;/p&gt;
    &lt;div style=&quot;text-align:center&quot;&gt;
      &lt;p&gt;&lt;img src=&quot;/assets/images/progScala.gif&quot; alt=&quot;Programming in Scala&quot; title=&quot;Programming in Scala&quot; /&gt;&lt;/p&gt;
    &lt;/div&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://twitter.github.io/scala_school/&quot;&gt;Twitter Scala School&lt;/a&gt; :
  This resource started as a series the of lectures at twitter to &lt;em&gt;prepare experienced engineers to be productive Scala programmers&lt;/em&gt;. The lessons are quite concise and properly organized. It is suited for intermediate programmers who have programming experience and quickly want to grasp Scala concepts.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;http://www.scala-tour.com/&quot;&gt;Scala Tour&lt;/a&gt; :
  This is similar to &lt;a href=&quot;https://twitter.github.io/scala_school/&quot;&gt;twitter Scala School&lt;/a&gt; in its concise nature. It provides an overview to the main features of Scala. It also allows you to run and test your code as you learn.&lt;/p&gt;
  &lt;/li&gt;

  &lt;li&gt;
    &lt;p&gt;&lt;a href=&quot;https://www.scala-exercises.org/&quot;&gt;Scala Exercises&lt;/a&gt; :
  I believe this resource should be used by anyone learning Scala. It is a set of Scala exercises that have sections on Scala features. It is an open source project actively maintained by &lt;a href=&quot;http://www.47deg.com/&quot;&gt;47 Degrees&lt;/a&gt;. It is one of my best Scala resources and one that I have contributed to.&lt;/p&gt;
  &lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;As you progress with learning scala, you can try solving the &lt;a href=&quot;http://aperiodic.net/phil/scala/s-99/&quot;&gt;99 problems&lt;/a&gt; and &lt;a href=&quot;https://projecteuler.net/archives&quot;&gt;project euler problems&lt;/a&gt; using &lt;a href=&quot;https://pavelfatin.com/scala-for-project-euler/&quot;&gt;scala&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Another good resource is &lt;a href=&quot;https://pavelfatin.com/scala-collections-tips-and-tricks/&quot;&gt;pavel fatin’s Scala Collections Tips and Tricks&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Know of other awesome resources ? have questions ? please do comment and share.&lt;/p&gt;

&lt;p&gt;Wishing you a smooth Journey in Scala ; )&lt;/p&gt;
</description>
        <pubDate>Thu, 14 Jul 2016 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2016/best-resources-for-learning-scala/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2016/best-resources-for-learning-scala/</guid>
        
        <category>Scala</category>
        
        
      </item>
    
      <item>
        <title>Why you should learn Scala</title>
        <description>&lt;style&gt;
ul {
  list-style-type: square;
  margin-bottom: 10px;
  padding-left: 30px;
}

h3 strong {
  font-weight:normal;
}
&lt;/style&gt;

&lt;p&gt;I want to believe you must have heard or read about Scala and learnt it was a JVM language. You probably thought - just another JVM language that would die out soon. Right ?  Or maybe you haven’t heard of Scala. How so?&lt;/p&gt;

&lt;h2 id=&quot;history&quot;&gt;History&lt;/h2&gt;

&lt;p&gt;Scala is short for scalable language, it combines both object oriented and functional programming concepts. It runs on the JVM (Java Virtual Machine). Scala was created by Martin Odersky (he worked on the Java compiler) and it’s first release was in 2003.&lt;/p&gt;

&lt;p&gt;In 2011, corporate stewardship was brought to bear – a set of people were making sure that the language was enterprise-ready at all times. Scala is used by some of the largest companies and startups LinkedIn, Twitter, Foursquare, The Guardian &amp;amp; Intel to name a few.&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/scala-companies.png&quot; alt=&quot;Scala Companies&quot; title=&quot;companies using scala&quot; /&gt;&lt;/p&gt;

&lt;p&gt;I have been using Scala for over a year and I believe it won’t die out. I would like to give you reasons to &lt;del&gt;ditch that other language and&lt;/del&gt; start using Scala. I would be presenting my case using powerful features in Scala known as case classes (no pun intended) and &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;pattern matching&lt;/code&gt;. Pattern matching is described as &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;switch on steroids&lt;/code&gt; on &lt;a href=&quot;http://www.scala-lang.org/&quot;&gt;Scala’s official website&lt;/a&gt;. I think comparing it with switch cases is quite an injustice to it. It has also been called &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Swiss army knife of Scala&lt;/code&gt;.&lt;/p&gt;

&lt;h3 id=&quot;case-concise-codes&quot;&gt;case &lt;strong&gt;Concise Codes&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Unlike Java that is riddled with boiler plate codes, Scala is quite concise. Though to be fair, using Java 8 lambdas could make Java code a bit concise.&lt;/p&gt;

&lt;p&gt;Comparing codes creating a user class in Scala and Java clearly shows Scala’s concise nature.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-java&quot; data-lang=&quot;java&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//Java Code&lt;/span&gt;
&lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kd&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;User&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;private&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;surname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;email&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setSurname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;surname&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;setEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;email&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getName&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getSurname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
  &lt;span class=&quot;kd&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;String&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;getEmail&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;()&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;return&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;this&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;na&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;;&lt;/span&gt;
  &lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;o&quot;&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scala&quot; data-lang=&quot;scala&quot;&gt;&lt;span class=&quot;c1&quot;&gt;//Scala Code&lt;/span&gt;

&lt;span class=&quot;k&quot;&gt;class&lt;/span&gt; &lt;span class=&quot;nc&quot;&gt;User&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;name&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;surname&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;,&lt;/span&gt;
 &lt;span class=&quot;k&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;email&lt;/span&gt;&lt;span class=&quot;k&quot;&gt;:&lt;/span&gt; &lt;span class=&quot;kt&quot;&gt;String&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;)&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;blockquote&gt;
  &lt;p&gt;When we started Spark, we wanted it to have a concise API for users, which Scala did well.&lt;/p&gt;

  &lt;p&gt;— &lt;em&gt;Matei Zaharia,CTO @ Databricks&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h3 id=&quot;case-functional--oop&quot;&gt;case &lt;strong&gt;Functional &amp;amp; OOP&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Scala mixes the functional paradigm with pure object orientation.  In  Scala, functional programming is the recommended way to program but the creators knew making that deep dive would be tough for anyone so you can still use your OOP patterns.&lt;/p&gt;

&lt;p&gt;Functions are first class objects in Scala. Using functional programming, you will be able to write less code that is reusable and easily maintained.&lt;/p&gt;

&lt;p&gt;Solving the first Euler problem &lt;em&gt;(Find the sum of all the multiples of 3 or 5 below 1000)&lt;/em&gt; in Scala with the functional paradigm shows clean and maintainable code.&lt;/p&gt;

&lt;figure class=&quot;highlight&quot;&gt;&lt;pre&gt;&lt;code class=&quot;language-scala&quot; data-lang=&quot;scala&quot;&gt;&lt;span class=&quot;k&quot;&gt;val&lt;/span&gt; &lt;span class=&quot;nv&quot;&gt;result&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;mi&quot;&gt;1&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;until&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;1000&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;view&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;filter&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;=&amp;gt;&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;3&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;||&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;n&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;%&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;5&lt;/span&gt; &lt;span class=&quot;o&quot;&gt;==&lt;/span&gt; &lt;span class=&quot;mi&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;o&quot;&gt;).&lt;/span&gt;&lt;span class=&quot;py&quot;&gt;sum&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/figure&gt;

&lt;h3 id=&quot;case-static-typing-and-type-inference&quot;&gt;case &lt;strong&gt;Static Typing and Type Inference&lt;/strong&gt;&lt;/h3&gt;

&lt;blockquote&gt;
  &lt;p&gt;Statically typed programming languages do type checking (the process of verifying and enforcing the constraints of types) at compile-time as opposed to run-time.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Scala’s static typing is one of my favorite feature.It has been proven that static typing improves code quality. This is important for data scientists, if you have a large job that will run for hours, you don’t want to find out half way through the job that it was not a correct implementation.&lt;/p&gt;

&lt;p&gt;Scala’s static typing helps you write less tests, you don’t need to write tests to check type consistency as the compiler does that for you (Sigh of relief).  This helps you reduce the amount of stupid bugs at an early stage.&lt;/p&gt;

&lt;p&gt;Also, with Scala’s type inference you can create variables without a specified type and the type would be inferred.&lt;/p&gt;

&lt;h3 id=&quot;case--java-interoperability&quot;&gt;case  &lt;strong&gt;Java Interoperability&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Scala has awesome Java interoperability which means you can import and use your Java codes and libraries in your Scala application (isn’t that awesome?). The good thing is that integration is seamless as Scala runs on the JVM, you do it without any performance penalty.&lt;/p&gt;

&lt;h3 id=&quot;case-concurrency-and-distribution&quot;&gt;case &lt;strong&gt;Concurrency and Distribution&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;Scala is suited for multi-core programming, it has built in tools for its implementation. Using Immutable values and collections is the recommended method of programming in Scala, as it guards your data from being mangled by different processes.&lt;/p&gt;

&lt;p&gt;Scala also uses &lt;strong&gt;Akka&lt;/strong&gt; which is a &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;toolkit and runtime for building highly concurrent, distributed, and fault tolerant event-driven applications&lt;/code&gt;. Scala’s functional nature makes it easier to write safe and performant multi-threaded code. There is less reliance on mutable state and Scala’s futures and actors provide powerful tools for organizing concurrent systems.&lt;/p&gt;

&lt;h3 id=&quot;case-high-paying-jobs-and-most-loved-language&quot;&gt;case &lt;strong&gt;High Paying Jobs and Most loved Language&lt;/strong&gt;&lt;/h3&gt;
&lt;p&gt;From the results of the recent &lt;a href=&quot;http://stackoverflow.com/research/developer-survey-2016#technology-most-loved-dreaded-and-wanted&quot;&gt;stack-overflow survey&lt;/a&gt;, Scala is amongst the top five most loved  languages.  Scala has recently seen adoption as the language for introduction to computer science in some educational institutions.&lt;/p&gt;

&lt;p&gt;It is no mistake that Spark (a data engine written in Scala) jobs and Scala jobs are the top paying tech jobs in the US and amongst the top ten paying tech jobs worldwide according to the &lt;a href=&quot;http://stackoverflow.com/research/developer-survey-2016#technology-top-paying-tech&quot;&gt;stack-overflow survey&lt;/a&gt;. I guess if none of the above cases impressed you, this should do right?&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;/assets/images/loved-scala.png&quot; alt=&quot;Loved Scala&quot; title=&quot;scala top paying tech 2016&quot; /&gt;&lt;/p&gt;

&lt;h3 id=&quot;case-_&quot;&gt;case &lt;strong&gt;_&lt;/strong&gt;&lt;/h3&gt;

&lt;p&gt;Other features that make Scala awesome are&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;&lt;strong&gt;Options&lt;/strong&gt; – No more NullPointerExceptions code crashes or errors.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;One class != one file&lt;/strong&gt; as you can have more than a class in a file.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Scala traits&lt;/strong&gt; - multiple inheritance without some of it’s dangers but with some limitations.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Scala streams&lt;/strong&gt; - an awesome scala collection that can be used for efficient Big Data pocessing.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Case classes&lt;/strong&gt; and &lt;strong&gt;pattern matching&lt;/strong&gt;.&lt;/li&gt;
  &lt;li&gt;&lt;strong&gt;Semicolons&lt;/strong&gt; are not &lt;strong&gt;compulsory&lt;/strong&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;So, what do you think? Drop your thoughts in the comments section.&lt;/p&gt;
</description>
        <pubDate>Sun, 10 Jul 2016 00:00:00 +0000</pubDate>
        <link>https://idarlington.github.iohttps://idarlington.github.io/2016/why-you-should-learn-scala/</link>
        <guid isPermaLink="true">https://idarlington.github.iohttps://idarlington.github.io/2016/why-you-should-learn-scala/</guid>
        
        <category>Scala</category>
        
        
      </item>
    
  </channel>
</rss>
