<?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: Ahmed Nawaz Khan</title>
    <description>The latest articles on DEV Community by Ahmed Nawaz Khan (@ahmednawazkhan).</description>
    <link>https://dev.to/ahmednawazkhan</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%2F329545%2F02f568f7-cb88-43df-b6bf-374f1bdf6d34.jpg</url>
      <title>DEV Community: Ahmed Nawaz Khan</title>
      <link>https://dev.to/ahmednawazkhan</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmednawazkhan"/>
    <language>en</language>
    <item>
      <title>Prisma generated types can hinder changing the database layer later on?</title>
      <dc:creator>Ahmed Nawaz Khan</dc:creator>
      <pubDate>Thu, 08 Jul 2021 15:29:47 +0000</pubDate>
      <link>https://dev.to/ahmednawazkhan/prisma-generated-types-can-hinder-changing-the-database-layer-later-on-3nhm</link>
      <guid>https://dev.to/ahmednawazkhan/prisma-generated-types-can-hinder-changing-the-database-layer-later-on-3nhm</guid>
      <description>&lt;p&gt;I recently heard about &lt;code&gt;prisma&lt;/code&gt; and wanted to try it. I really liked the simple interface it provides and the level of type saftey. however, I have one question. when we use &lt;code&gt;prisma&lt;/code&gt; to query an entity, the response we get has a type that comes from &lt;code&gt;@prisma/client&lt;/code&gt; ( prisma generated ). Though it has some advantages but this is where I think that a violation of open closed principle can occur. In the future if I want to change the database layer or the orm to &lt;code&gt;typeorm&lt;/code&gt; then all the return types of my service methods have to be changed to reflect my entities (rather than previously prisma generated types). Think of it in context of nestjs where we have entities that are our common return types. Is there a way we can solve this problem with prisma? Or it is not a problem at all?&lt;/p&gt;

</description>
      <category>database</category>
      <category>architecture</category>
    </item>
    <item>
      <title>Idiomatic way to implement this in golang</title>
      <dc:creator>Ahmed Nawaz Khan</dc:creator>
      <pubDate>Mon, 03 Feb 2020 16:22:12 +0000</pubDate>
      <link>https://dev.to/ahmednawazkhan/idiomatic-way-to-implement-this-in-golang-3n8b</link>
      <guid>https://dev.to/ahmednawazkhan/idiomatic-way-to-implement-this-in-golang-3n8b</guid>
      <description>&lt;p&gt;I am experimenting to migrate a nodejs system (typescript) to golang. Its going well except i am having trouble in reproducing the following in idiomatic go&lt;/p&gt;

&lt;p&gt;I have the following abstract class:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;BaseSensor&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;beforeStart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/*default implementation*/&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;afterStart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/*default implementation*/&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;shutdown&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;&lt;span class="cm"&gt;/*default implementation*/&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="kd"&gt;abstract&lt;/span&gt; &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;

  &lt;span class="nx"&gt;work&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;beforeStart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="c1"&gt;//...&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;afterStart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="c1"&gt;//...&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
    &lt;span class="c1"&gt;//...&lt;/span&gt;
    &lt;span class="k"&gt;this&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;shutdown&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;then i have some concrete classes/sensors which implement atleast the &lt;code&gt;process()&lt;/code&gt; method and optionally any of the other lifecycle methods.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight typescript"&gt;&lt;code&gt;&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;SensorA&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;BaseSensor&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//SensorA specific processing&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="kd"&gt;class&lt;/span&gt; &lt;span class="nx"&gt;SensorB&lt;/span&gt; &lt;span class="kd"&gt;extends&lt;/span&gt; &lt;span class="nx"&gt;BaseSensor&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nx"&gt;beforeStart&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//SensorB overriding beforeStart()&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="nx"&gt;process&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="c1"&gt;//SensorB specific processing&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;code&gt;SensorA&lt;/code&gt; only implements the &lt;code&gt;process()&lt;/code&gt; method and doesn't override anything else. &lt;code&gt;SensorB&lt;/code&gt; implements &lt;code&gt;process()&lt;/code&gt; and also overrides &lt;code&gt;beforeStart()&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;What is the correct way of doing something like this in &lt;code&gt;golang&lt;/code&gt;&lt;/p&gt;

</description>
      <category>discuss</category>
      <category>go</category>
      <category>typescript</category>
    </item>
  </channel>
</rss>
