<?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: Sebastian Sastre</title>
    <description>The latest articles on DEV Community by Sebastian Sastre (@sebastianconcept).</description>
    <link>https://dev.to/sebastianconcept</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%2F224394%2Ffa51ae47-0e41-47da-a089-21ac37de1c82.png</url>
      <title>DEV Community: Sebastian Sastre</title>
      <link>https://dev.to/sebastianconcept</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/sebastianconcept"/>
    <language>en</language>
    <item>
      <title>Developing a SQLite backend for Mapless</title>
      <dc:creator>Sebastian Sastre</dc:creator>
      <pubDate>Tue, 10 Oct 2023 14:20:35 +0000</pubDate>
      <link>https://dev.to/sebastianconcept/developing-a-sqlite-backend-for-mapless-8pj</link>
      <guid>https://dev.to/sebastianconcept/developing-a-sqlite-backend-for-mapless-8pj</guid>
      <description>&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--tdZ17X2P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6y5c7zykh44xtdnagne8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--tdZ17X2P--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/6y5c7zykh44xtdnagne8.png" alt="Mapless unit tests coverage for the SQLite backend" width="800" height="522"&gt;&lt;/a&gt;&lt;br&gt;
Earlier this month I was asking in the community for interest on moving forward the development of a SQLite backend for &lt;a href="https://github.com/sebastianconcept/Mapless"&gt;Mapless&lt;/a&gt; and it was generally well received. People understands that is good to have another persistence option in Smalltalk specially if it's based on a backend that is both mature and well accepted, not just among smalltalkers but in the whole industry.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.sqlite.org/"&gt;SQLite&lt;/a&gt; alone will be a good fit specially with new small projects, MVPs or &lt;a href="https://www.microns.io/blog/best-micro-saas-ideas"&gt;micro-SaaS&lt;/a&gt; and used behind Mapless, the SQLite features will be reachable with its comfortable API and its schemaless experience in the smalltalk side.&lt;/p&gt;

&lt;p&gt;Two attractive reasons for adoption.&lt;/p&gt;

&lt;p&gt;And with Mapless, there is a plus: state portability. A secondary benefit of having a &lt;code&gt;MaplessSQLiteRepository&lt;/code&gt; is that your data can easily be migrated from one backend to another and since running SQLite is cheap, this has important economic consequences. It could make feasible something that previously wasn't. &lt;/p&gt;

&lt;p&gt;Think of the margins for a project that can start with a persistence solution that doesn't require the costs of setup, DevOps and operations of an additional database server. Instead, it will be the same server you're using for the application as SQLite only needs a library in the system and lean usage of CPU and RAM. &lt;/p&gt;

&lt;p&gt;Once your product, either a MVP, micro-SaaS or full SaaS has the network traffic that requires an upgrade, with Mapless you'll be enabled to easily develop migrations to &lt;code&gt;MaplessPostgreSQLRepository&lt;/code&gt; or &lt;code&gt;MaplessMongoDBRepository&lt;/code&gt; with almost no impact on your application. All that while the economics of that migration and setup are covered by the growth of your business.&lt;/p&gt;

&lt;p&gt;So, for using SQLite with Mapless, the good news is that I'm almost having all its unit tests green. &lt;/p&gt;

&lt;p&gt;Currently two unit tests that are failing. These were designed when developing the &lt;a href="https://www.postgresql.org/"&gt;PostgreSQL&lt;/a&gt; support and using its feature of querying inside the  JSON column type. &lt;/p&gt;

&lt;p&gt;Speaking of which, I'm still thinking what's the best approach for that since SQLite has 2 ways to use JSON:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;JSON1 extension and &lt;/li&gt;
&lt;li&gt;using the BLOB type&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;If you have an educated opinion on what's the best path for this, reach me by email, the &lt;a href="https://discord.com/invite/QewZMZa"&gt;Pharo Discord server&lt;/a&gt; or &lt;a href="https://www.linkedin.com/in/sebastiansastre/"&gt;LinkedIn&lt;/a&gt; I'd love to hear it.&lt;/p&gt;
&lt;h3&gt;
  
  
  Bonus benchmarks
&lt;/h3&gt;

&lt;p&gt;Here are some benchmarks it on my 2,5 GHz Quad-Core Intel Core i7:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;Benchmarking Mapless on SQLite...

Saved 1000 instances of MaplessDummyPerson in: 166 ms (~6008 saves per second)
Read 1000 instances of MaplessDummyPerson in: 159 ms (~6279 reads per second)
Saved 10000 instances of MaplessDummyPerson in: 1755 ms (~5699 saves per second)
Read 10000 instances of MaplessDummyPerson in: 1590 ms (~6290 reads per second)
Saved 1000 instances of MaplessDummyPerson and MaplessDummyUser in: 367 ms (~2722 saves per second)
Read 1000 instances of MaplessDummyPerson and MaplessDummyUser in: 188 ms (~5311 reads per second)
Saved 10000 instances of MaplessDummyPerson and MaplessDummyUser in: 3721 ms (~2687 saves per second)
Read 10000 instances of MaplessDummyPerson and MaplessDummyUser in: 1818 ms (~5500 reads per second)
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



</description>
    </item>
    <item>
      <title>The DRY Principle: Reducing Redundancy for Clean Code</title>
      <dc:creator>Sebastian Sastre</dc:creator>
      <pubDate>Thu, 07 Sep 2023 22:05:53 +0000</pubDate>
      <link>https://dev.to/sebastianconcept/the-dry-principle-reducing-redundancy-for-clean-code-55d2</link>
      <guid>https://dev.to/sebastianconcept/the-dry-principle-reducing-redundancy-for-clean-code-55d2</guid>
      <description>&lt;p&gt;Have you heard about DRY? or "Don't Repeat Yourself"? This a principle that leads to clean coding, aims to reduce redundancy and promotes elegant, concise, and maintainable code.&lt;/p&gt;

&lt;p&gt;At its core, DRY encapsulates a simple idea: avoid duplication. It's the art of writing code in such a way that every piece of knowledge or logic is expressed in just one place. By adhering to DRY, you ensure that your codebase remains efficient, consistent. Also we can say less error-prone because each non-repeated functional unit can, precisely, be unit-tested.&lt;/p&gt;

&lt;p&gt;Here are key scenarios where DRY shines and can make your code better:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Repetitive Logic&lt;/strong&gt;: Whenever you find yourself writing the same logic, obviously for a second time or a slight variation of it that can be refactored into one. That's a DRY opportunity. Create an intermediary reusable function or method to encapsulate that logic, promoting code consistency and making maintenance a breeze.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Configuration Management&lt;/strong&gt;: Managing configuration settings like API endpoints or database credentials in one central location not only adheres to DRY but also simplifies updates and reduces the chance of inconsistencies.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Constants and Magic Numbers&lt;/strong&gt;: Replace hardcoded values scattered throughout your code with named constants. This not only enhances readability but also facilitates changes by modifying one central constant. Better, these central constants can be taken from environment variables making your code safer while keeping it flexible.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Cross-Function Duplication&lt;/strong&gt;: If you have multiple functions or methods that perform similar tasks, consider consolidating the common logic into a single function and calling it from wherever needed.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Testing&lt;/strong&gt;: In your test suites, the DRY principle shine. If you avoided duplicating functions you will fill the benefits when coding its unit tests. You'll notice it reduces test maintenance efforts, ensures consistent test conditions and provides regression detection.&lt;/p&gt;

&lt;p&gt;Note that the DRY principle isn't limited to a specific programming language or paradigm; it's a universal concept for evading to have multiple source of the same function. And multiple source of truth leads to ambiguity and deambiguation costs. Hence, whether you're writing Ruby, JavaScript, Python, Smalltalk, or any other language, DRY remains a guiding rule.&lt;/p&gt;

&lt;p&gt;Said that, we can also talk about when not to use DRY in software engineering.&lt;/p&gt;

&lt;p&gt;But as usual, before breaking the rule, you need to first master the rule so let's keep that for an incoming article.&lt;/p&gt;

&lt;p&gt;In principle let's think about DRY and the reasons why is a great rule to have as default system design and programmer's behavior.&lt;/p&gt;

</description>
    </item>
    <item>
      <title>My solution to Phone Number on Exercism in the Ruby journey</title>
      <dc:creator>Sebastian Sastre</dc:creator>
      <pubDate>Wed, 23 Aug 2023 13:54:32 +0000</pubDate>
      <link>https://dev.to/sebastianconcept/my-solution-to-phone-number-on-exercism-in-the-ruby-journey-1af</link>
      <guid>https://dev.to/sebastianconcept/my-solution-to-phone-number-on-exercism-in-the-ruby-journey-1af</guid>
      <description>&lt;p&gt;&lt;a href="https://exercism.org/tracks/ruby/exercises/phone-number/solutions/sebastianconcept"&gt;https://exercism.org/tracks/ruby/exercises/phone-number/solutions/sebastianconcept&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>Answer: Compiling Pharo to C?</title>
      <dc:creator>Sebastian Sastre</dc:creator>
      <pubDate>Wed, 23 Aug 2023 13:45:02 +0000</pubDate>
      <link>https://dev.to/sebastianconcept/answer-compiling-pharo-to-c-230c</link>
      <guid>https://dev.to/sebastianconcept/answer-compiling-pharo-to-c-230c</guid>
      <description>&lt;div class="ltag__stackexchange--container"&gt;
  &lt;div class="ltag__stackexchange--title-container"&gt;
    
      &lt;div class="ltag__stackexchange--title"&gt;
        &lt;div class="ltag__stackexchange--header"&gt;
          &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--AoTUKOcU--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/stackoverflow-logo-b42691ae545e4810b105ee957979a853a696085e67e43ee14c5699cf3e890fb4.svg" alt=""&gt;
          &lt;a href="https://stackoverflow.com/questions/28967423/compiling-pharo-to-c/76961957#76961957" rel="noopener noreferrer"&gt;
            &lt;span class="title-flare"&gt;answer&lt;/span&gt; re: Compiling Pharo to C?
          &lt;/a&gt;
        &lt;/div&gt;
        &lt;div class="ltag__stackexchange--post-metadata"&gt;
          &lt;span&gt;Aug 23 '23&lt;/span&gt;
        &lt;/div&gt;
      &lt;/div&gt;
      &lt;a class="ltag__stackexchange--score-container" href="https://stackoverflow.com/questions/28967423/compiling-pharo-to-c/76961957#76961957" rel="noopener noreferrer"&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--oeieW07A--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/stackexchange-arrow-up-eff2e2849e67d156181d258e38802c0b57fa011f74164a7f97675ca3b6ab756b.svg" alt=""&gt;
        &lt;div class="ltag__stackexchange--score-number"&gt;
          0
        &lt;/div&gt;
        &lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--h2-sXgSn--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev.to/assets/stackexchange-arrow-down-4349fac0dd932d284fab7e4dd9846f19a3710558efde0d2dfd05897f3eeb9aba.svg" alt=""&gt;
      &lt;/a&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--body"&gt;
    
&lt;blockquote&gt;
&lt;p&gt;I wan't to develop, test and profile code using Pharo, but then
compile it to C.&lt;/p&gt;
&lt;/blockquote&gt;
&lt;ul&gt;
&lt;li&gt;How can I do it?&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;Smalltalk code in Pharo will be compiled to bytecodes that the VM runs, so there is no way really to transpile straight Smalltalk code from Pharo to the raw…&lt;/p&gt;
    
  &lt;/div&gt;
  &lt;div class="ltag__stackexchange--btn--container"&gt;
    &lt;a href="https://stackoverflow.com/questions/28967423/compiling-pharo-to-c/76961957#76961957" class="ltag__stackexchange--btn" rel="noopener noreferrer"&gt;Open Full Answer&lt;/a&gt;
  &lt;/div&gt;
&lt;/div&gt;


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