<?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: Avwerosuoghene Darhare-Igben</title>
    <description>The latest articles on DEV Community by Avwerosuoghene Darhare-Igben (@avwerosuoghene).</description>
    <link>https://dev.to/avwerosuoghene</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%2F1092083%2F5a6df244-729f-4d5e-9178-e271572773b4.jpg</url>
      <title>DEV Community: Avwerosuoghene Darhare-Igben</title>
      <link>https://dev.to/avwerosuoghene</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/avwerosuoghene"/>
    <language>en</language>
    <item>
      <title>Shared Component Architecture in Angular (When To Abstract and When Not To)</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Tue, 18 Nov 2025 18:15:06 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/shared-component-architecture-in-angular-when-to-abstract-and-when-not-to-27m0</link>
      <guid>https://dev.to/avwerosuoghene/shared-component-architecture-in-angular-when-to-abstract-and-when-not-to-27m0</guid>
      <description>&lt;p&gt;One of the easiest traps in frontend development is over–engineering your shared components. You start with one neat reusable button, next thing you know, your shared folder has 40 components, half of which only get used once. &lt;/p&gt;

&lt;p&gt;The real skill is knowing when to abstract and when to leave a component exactly where it is.&lt;/p&gt;

&lt;p&gt;Here’s a simple, practical way to think about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Should Abstract a Component
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The UI pattern shows up everywhere&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you keep recreating the same button style, card layout, dropdown, or modal logic across modules, abstract it. Shared UI components help maintain a tight and consistent visual identity, avoiding copy-paste chaos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The component has clean inputs and outputs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of things like: &lt;strong&gt;app-button, app-card, app-avatar, app-loader&lt;/strong&gt;. These don’t rely on any external state and don’t care which module they’re in. That’s exactly what a shared component should look like.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. You want to avoid future refactor pain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Shared components act like a central control point. Update it once, and every feature automatically benefits. This is especially important as your app grows or when you’re building multiple frontends within the same project.&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Should Not Abstract a Component
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. It belongs to a specific feature&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your component interacts directly with a feature-specific service, relies on domain logic, or only makes sense within a specific part of the app, keep it local.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The abstraction isn’t stable yet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A big mistake is abstracting too early, before you fully understand the pattern. Build the feature first. Let that pattern show up two or three times. Then extract the reusable part.&lt;/p&gt;

&lt;p&gt;This prevents you from building a super-generic shared component that tries to solve every problem and ends up solving none.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. It will introduce unnecessary complexity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes forcing something into a shared folder actually makes the code harder to work with. You start adding extra inputs, optional behaviors, workarounds, and conditionals, all because you tried to make one component do too much. If the component becomes more complicated after abstraction, that’s a red flag.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Guideline You Can Use Today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If a component is UI-only, stateless, and used repeatedly, put it in a shared ui folder.&lt;/li&gt;
&lt;li&gt;If a component contains business logic or is tied to a specific feature, keep it inside the feature module.&lt;/li&gt;
&lt;li&gt;If a component is unique, experimental, or hasn’t shown a clear repeatable pattern, don’t abstract it yet, wait until the pattern actually repeats.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keeping your shared architecture simple doesn’t just make your Angular project clean. It also makes you faster, reduces bugs, and keeps your team from fighting unnecessary over-abstraction.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>web</category>
      <category>frontend</category>
      <category>angular</category>
    </item>
    <item>
      <title>Shared Component Architecture in Angular (When To Abstract and When Not To)</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Tue, 18 Nov 2025 18:15:06 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/shared-component-architecture-in-angular-when-to-abstract-and-when-not-to-10fc</link>
      <guid>https://dev.to/avwerosuoghene/shared-component-architecture-in-angular-when-to-abstract-and-when-not-to-10fc</guid>
      <description>&lt;p&gt;One of the easiest traps in frontend development is over–engineering your shared components. You start with one neat reusable button, next thing you know, your shared folder has 40 components, half of which only get used once. &lt;/p&gt;

&lt;p&gt;The real skill is knowing when to abstract and when to leave a component exactly where it is.&lt;/p&gt;

&lt;p&gt;Here’s a simple, practical way to think about it.&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Should Abstract a Component
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. The UI pattern shows up everywhere&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If you keep recreating the same button style, card layout, dropdown, or modal logic across modules, abstract it. Shared UI components help maintain a tight and consistent visual identity, avoiding copy-paste chaos.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The component has clean inputs and outputs&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Think of things like: &lt;strong&gt;app-button, app-card, app-avatar, app-loader&lt;/strong&gt;. These don’t rely on any external state and don’t care which module they’re in. That’s exactly what a shared component should look like.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. You want to avoid future refactor pain&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Shared components act like a central control point. Update it once, and every feature automatically benefits. This is especially important as your app grows or when you’re building multiple frontends within the same project.&lt;/p&gt;

&lt;h2&gt;
  
  
  When You Should Not Abstract a Component
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;1. It belongs to a specific feature&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;If your component interacts directly with a feature-specific service, relies on domain logic, or only makes sense within a specific part of the app, keep it local.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2. The abstraction isn’t stable yet&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A big mistake is abstracting too early, before you fully understand the pattern. Build the feature first. Let that pattern show up two or three times. Then extract the reusable part.&lt;/p&gt;

&lt;p&gt;This prevents you from building a super-generic shared component that tries to solve every problem and ends up solving none.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3. It will introduce unnecessary complexity&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Sometimes forcing something into a shared folder actually makes the code harder to work with. You start adding extra inputs, optional behaviors, workarounds, and conditionals, all because you tried to make one component do too much. If the component becomes more complicated after abstraction, that’s a red flag.&lt;/p&gt;

&lt;h2&gt;
  
  
  A Practical Guideline You Can Use Today
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;If a component is UI-only, stateless, and used repeatedly, put it in a shared ui folder.&lt;/li&gt;
&lt;li&gt;If a component contains business logic or is tied to a specific feature, keep it inside the feature module.&lt;/li&gt;
&lt;li&gt;If a component is unique, experimental, or hasn’t shown a clear repeatable pattern, don’t abstract it yet, wait until the pattern actually repeats.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Keeping your shared architecture simple doesn’t just make your Angular project clean. It also makes you faster, reduces bugs, and keeps your team from fighting unnecessary over-abstraction.&lt;/p&gt;

</description>
      <category>tutorial</category>
      <category>web</category>
      <category>frontend</category>
      <category>angular</category>
    </item>
    <item>
      <title>How to Use GitHub Secrets Effectively in Multi-Service Deployments</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Thu, 13 Nov 2025 20:29:32 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/how-to-use-github-secrets-effectively-in-multi-service-deployments-13dp</link>
      <guid>https://dev.to/avwerosuoghene/how-to-use-github-secrets-effectively-in-multi-service-deployments-13dp</guid>
      <description>&lt;p&gt;Managing secrets across multiple services can quickly get really messy. Your API keys, database passwords, and service credentials need to be available to your CI/CD pipeline without exposing them publicly. GitHub Secrets makes this easy, but only if you use them wisely.&lt;/p&gt;

&lt;p&gt;Here's how to handle them effectively:&lt;/p&gt;

&lt;h2&gt;
  
  
  1. Centralize Your Secrets
&lt;/h2&gt;

&lt;p&gt;Instead of dumping everything into one place, create service-specific secrets. For example, API_SERVICE_DB_PASSWORD for your backend and FRONTEND_API_KEY for your frontend. This keeps things clear and reduces the risk of accidentally using the wrong secret.&lt;/p&gt;

&lt;h2&gt;
  
  
  2. Use Environment Variables in Workflows
&lt;/h2&gt;

&lt;p&gt;Pull secrets into your workflow using environment variables. For instance:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliltp1z9oyuf1doratcx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fliltp1z9oyuf1doratcx.png" alt=" " width="800" height="354"&gt;&lt;/a&gt;&lt;br&gt;
This way, each service will only get the secrets it needs.&lt;/p&gt;

&lt;h2&gt;
  
  
  3. Don’t Overload Secrets
&lt;/h2&gt;

&lt;p&gt;Avoid lumping too many secrets together. Break them down per service or environment (dev, staging, prod). This makes rotation and management much easier.&lt;/p&gt;

&lt;h2&gt;
  
  
  4. Rotate Secrets Regularly
&lt;/h2&gt;

&lt;p&gt;Secrets are also not set-and-forget. Rotate them regularly, update them in GitHub, and redeploy services so they can incorporate the changes. Your workflow can retrieve the latest secrets from a secure vault if needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  5. Inject Secrets Directly in Deployments
&lt;/h2&gt;

&lt;p&gt;For cloud services, inject secrets at deployment rather than baking them into your images.&lt;/p&gt;

&lt;p&gt;Example:&lt;br&gt;
&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4pks6ber0a0odoqrd0w.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fm4pks6ber0a0odoqrd0w.png" alt=" " width="800" height="345"&gt;&lt;/a&gt;&lt;br&gt;
This way, your services get only what they need—securely.&lt;/p&gt;

&lt;h2&gt;
  
  
  The Bottom Line:
&lt;/h2&gt;

&lt;p&gt;Keep secrets per service and environment, don’t hardcode them, and leverage GitHub Actions plus cloud secret injection. Doing this keeps your multi-service deployments secure, manageable, and stress-free.&lt;/p&gt;

</description>
      <category>cloud</category>
      <category>webdev</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>The Hidden Gotchas When Running a Dockerized .NET App on Google Cloud Run</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Fri, 07 Nov 2025 11:20:30 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/the-hidden-gotchas-when-running-a-dockerized-net-app-on-google-cloud-run-efj</link>
      <guid>https://dev.to/avwerosuoghene/the-hidden-gotchas-when-running-a-dockerized-net-app-on-google-cloud-run-efj</guid>
      <description>&lt;p&gt;Deploying a Dockerized .NET app to Cloud Run looks simple on paper: build an image, push to Artifact Registry, and deploy. But once your app starts interacting with services like Google Cloud Storage (GCS), subtle issues start showing up.&lt;/p&gt;

&lt;p&gt;In this post, I’ll share the hidden gotchas I discovered while debugging a real-world .NET Cloud Run deployment and how to fix them.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gotcha 1 — Application Default Credentials (ADC) Don’t Just Work in Containers
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You might hit this error: &lt;em&gt;“Your default credentials were not found. To set up Application Default Credentials”&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Why it happens:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Locally, gcloud auth application default login saves credentials in your user directory. But Cloud Run runs your container in a sandbox, no user directory, no local credentials.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Assign a Service Account to your Cloud Run service.&lt;/li&gt;
&lt;li&gt;Give it the Storage Object Admin role.&lt;/li&gt;
&lt;li&gt;Cloud Run automatically uses that service account for ADC.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once that’s done, calls like GoogleCredential.GetApplicationDefault() work seamlessly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Gotcha 2 — Verifying the Service Account Used by Cloud Run
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Developers often assume Cloud Run uses their own credentials. It doesn’t.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;In the Google Cloud Console, go to Cloud Run → your service → Security tab.&lt;/li&gt;
&lt;li&gt;Look for Service account that’s what your app runs as.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Gotcha 3 — Generating Signed URLs for Private Buckets
&lt;/h2&gt;

&lt;p&gt;Scenario:&lt;br&gt;
Your app uploads files to GCS, and you need signed URLs so your frontend can access them securely.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Signed URLs that work locally may fail on Cloud Run because your service account lacks signBlob permission.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Add the Service Account Token Creator role.&lt;/li&gt;
&lt;li&gt;Use: &lt;code&gt;var signer = UrlSigner.FromCredential(GoogleCredential.GetApplicationDefault());&lt;/code&gt;
This ensures your signed URLs are generated correctly in production.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Gotcha 4 — Public vs Private Buckets
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;The problem:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Locally, you might test with a public bucket. But in production, GCS buckets are private by default.&lt;/p&gt;

&lt;p&gt;Accessing an uploaded file directly shows this message: “This XML file does not appear to have any style information”. That’s GCS politely saying “Access Denied.”&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The fix:&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Make the bucket public. Works for testing but not recommended for production.&lt;/li&gt;
&lt;li&gt;Use signed URLs, the secure and scalable approach. Generate time-limited signed URLs that grant temporary access to private objects.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Takeaways
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Cloud Run does not inherit your local credentials.&lt;/li&gt;
&lt;li&gt;Always verify which service account your service runs as.&lt;/li&gt;
&lt;li&gt;Use signed URLs to safely expose private media.&lt;/li&gt;
&lt;li&gt;Expect differences between local and Cloud Run environments, especially around GCP services.&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>devops</category>
      <category>google</category>
      <category>docker</category>
      <category>dotnet</category>
    </item>
    <item>
      <title>Declarative vs. Imperative Programming in JavaScript</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Sat, 24 Aug 2024 21:26:45 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/declarative-vs-imperative-programming-in-javascript-2ipe</link>
      <guid>https://dev.to/avwerosuoghene/declarative-vs-imperative-programming-in-javascript-2ipe</guid>
      <description>&lt;p&gt;When it comes to programming methodology, two common approaches often come up: declarative and imperative programming. Each has its strengths and ideal use cases, especially in JavaScript. Let’s explore these two styles with some examples.&lt;/p&gt;

&lt;h2&gt;
  
  
  Imperative Programming: Telling the Computer How to Do It
&lt;/h2&gt;

&lt;p&gt;Imperative programming is like giving a detailed set of instructions. You tell the computer how to achieve a specific result step by step. Think of it as guiding someone through a recipe—first do this, then do that.&lt;/p&gt;

&lt;p&gt;Here’s a classic example of summing an array of numbers using an imperative approach:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqclupw7t0029y25415h0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqclupw7t0029y25415h0.png" alt="Image description" width="800" height="513"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we manually loop through the array and accumulate the sum. Each step is explicitly defined: start with 0, iterate through each number, and keep adding to the total.&lt;/p&gt;

&lt;h2&gt;
  
  
  Declarative Programming: Telling the Computer What You Want
&lt;/h2&gt;

&lt;p&gt;Declarative programming, on the other hand, focuses on what you want to achieve rather than how to do it. You describe the desired outcome, and the underlying system figures out the steps to get there.&lt;/p&gt;

&lt;p&gt;Let’s rewrite the same sum operation using a declarative approach:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2sp6ei605a084d1cfiov.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2sp6ei605a084d1cfiov.png" alt="Image description" width="800" height="381"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here, the reduce method abstracts away the loop and accumulation details. You simply declare that you want to reduce the array into a single value (the sum), and JavaScript handles the rest.&lt;/p&gt;

&lt;h2&gt;
  
  
  When to Use Which?
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Imperative: When you need fine-grained control over each step of an operation, imperative programming is your go-to. It’s ideal for complex algorithms or when you need to optimize performance at each step.&lt;/li&gt;
&lt;li&gt;Declarative: When clarity and simplicity are more important than control, declarative programming shines. It’s great for tasks like data transformations, UI rendering, and database queries (like SQL).&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  A More Practical Example: Filtering an Array
&lt;/h2&gt;

&lt;p&gt;Let’s say you want to filter out even numbers from an array. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Imperative Approach:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruveqwugamnxofnb7lzb.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fruveqwugamnxofnb7lzb.png" alt="Image description" width="800" height="566"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You manually iterate over the array, check each number, and conditionally push even numbers into a new array.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Declarative Approach:&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqu98orc64a6x2lnsopsm.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fqu98orc64a6x2lnsopsm.png" alt="Image description" width="800" height="263"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;With filter, you simply declare your intention: “Give me all the numbers that are even.” The filter method handles the iteration and condition checking for you.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Both declarative and imperative styles have their places in TypeScript development. Imperative code can be more verbose and harder to read but offers more control. Declarative code, meanwhile, tends to be more concise and readable, making it easier to maintain.&lt;/p&gt;

&lt;p&gt;Next time you’re coding, consider which approach best suits your needs. Do you need precise control? Go imperative. Need clear, maintainable code? Declarative might be your best bet. Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>tutorial</category>
    </item>
    <item>
      <title>Plan First, Code Later</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Mon, 03 Jun 2024 13:09:59 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/plan-first-code-later-7fo</link>
      <guid>https://dev.to/avwerosuoghene/plan-first-code-later-7fo</guid>
      <description>&lt;p&gt;As a software engineer, getting caught up in the excitement of writing code and building new features is pretty easy. However, successful developers understand the importance of taking the time to plan your project thoroughly. Here’s why you should always plan first and code later.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Define Clear Objectives&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Setting clear objectives provides direction and purpose for your project. They help ensure everyone on the team is aligned and working towards the same goals.&lt;/p&gt;

&lt;p&gt;Imagine you're tasked with developing a new e-commerce platform. Without clear objectives, you might focus on adding flashy features like animations and complex user interfaces. However, if your primary purpose is to increase sales, your efforts would be better spent optimizing the checkout process and improving load times.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Create a Blueprint&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;A well-thought-out blueprint serves as a roadmap for your project. It helps you visualize the structure and flow of your application, making it easier to identify potential issues before they arise.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Break Down Tasks&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Breaking down the project into smaller, manageable tasks makes it easier to track progress and stay organized. The task of handling a large-scale project can feel overwhelming unless you effectively break it down into manageable segments. It also helps you identify dependencies and prioritize work more effectively. &lt;/p&gt;

&lt;p&gt;For the e-commerce platform mentioned earlier, you can break down tasks into components such as user authentication, product listing, shopping cart functionality, payment processing, and order management. This way, you can tackle each component individually, ensuring thorough testing and integration.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Choose the Right Tools&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;The tools and technologies you choose can significantly impact your project's success. Selecting the right tools ensures your team can work efficiently and leverage their expertise effectively.&lt;/p&gt;

&lt;p&gt;If your e-commerce app requires real-time updates, such as inventory changes and live customer support, choosing a technology like Node.js with WebSocket support would be more appropriate than a traditional request-response model. Additionally, you can never go wrong using version control tools like Git to ensure collaborative and organized code management.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Consider Scalability&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Planning for scalability ensures that your application can handle increased load and growth over time. This helps avoid costly refactoring and performance issues in the future.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Plan for Testing&lt;/strong&gt;&lt;br&gt;
Incorporating testing from the beginning ensures code quality and reliability. It helps catch bugs early, reducing the cost and effort required to fix them later.&lt;/p&gt;

&lt;p&gt;For the e-commerce app, create unit tests for individual functions like user registration and payment processing. Implement integration tests to ensure different components work together seamlessly, such as adding items to the cart and completing a purchase.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Conclusion&lt;/strong&gt;&lt;br&gt;
By investing time in thorough planning, you set a strong foundation for your project. This approach leads to cleaner, more efficient code and a smoother development process. Remember, the key to successful software development lies in thinking first and coding later.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>productivity</category>
      <category>softwaredevelopment</category>
      <category>devjournal</category>
    </item>
    <item>
      <title>Passing Data from Dart to JSON for Backend Integration</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Tue, 23 Apr 2024 15:01:20 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/passing-data-from-dart-to-json-for-backend-integration-5bn2</link>
      <guid>https://dev.to/avwerosuoghene/passing-data-from-dart-to-json-for-backend-integration-5bn2</guid>
      <description>&lt;p&gt;JSON (JavaScript Object Notation) provides a lightweight and simple method of data interchange, widely used in modern systems, including application development in Dart. Its simplicity, support for nested data, and language independence make it a go-to option for transmitting information across different platforms and programming languages. It serves as a means of providing dynamic web experiences through its vital role in client and server-side communications, particularly in APIs. In short, it is a vital tool used by software engineers today for data exchange in Dart-based mobile app development. This article delves into how to utilize this simple yet powerful tool to enhance the functionality and efficiency of Dart-based software.&lt;/p&gt;

&lt;h2&gt;
  
  
  Converting Dart Objects to JSON
&lt;/h2&gt;

&lt;p&gt;When creating Dart applications, it's often necessary to transform Dart objects into JSON format to carry out tasks like transmitting data over networks or storing it in databases. Dart offers built-in support for such data transformation using the dart:convert library. This library provides utilities for serializing Dart objects into JSON and vice versa.&lt;br&gt;
The serialization process involves converting Dart objects into JSON format. Dart provides a convenient way to do this using the jsonEncode() function from the dart:convert library. This function converts a Dart object into its JSON representation as a string.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhtqi4f5eombtegnwbhhq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fhtqi4f5eombtegnwbhhq.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The snippet above demonstrates the usage of the jsonEncode method to convert Dart data into JSON format. The SignupRequestPayload class includes a toJson method that converts the email and password Dart objects into JSON format, as evidenced by the output printed to the console.&lt;/p&gt;

&lt;h2&gt;
  
  
  Handling Different Data Types
&lt;/h2&gt;

&lt;p&gt;When translating Dart objects into JSON, it's important to handle different data types properly. Dart supports a range of data types including strings, numbers, booleans, lists, and maps, which need to be properly converted to their JSON equivalents.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3xf10q0urrwb3kmfmkbe.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F3xf10q0urrwb3kmfmkbe.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The above UniversityList class contains a list of university names of type String, the number of universities passed, which is of type int, and a boolean that indicates whether the list of universities is valid or not&lt;/p&gt;

&lt;h2&gt;
  
  
  Sending JSON to the Backend
&lt;/h2&gt;

&lt;p&gt;After converting Dart objects to JSON, the next step is often to transmit this JSON data to a backend server for further processing or storage. Dart provides HTTP client libraries like http or dio for making HTTP requests and sending JSON data to the server.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2u5urr606fyz90zal7e9.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F2u5urr606fyz90zal7e9.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The snippet above shows how an http request can be made to a backend server using the dart http package. &lt;br&gt;
NB: Ensure the http package is installed on your project and imported to your file.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;In conclusion, Dart provides robust support for converting Dart objects to JSON format and transmitting this JSON data to backend servers. By following the serialization process and properly handling different data types, developers can effectively work with JSON data in their Dart applications. Additionally, through HTTP requests, Dart applications can seamlessly communicate with backend systems, making it a versatile and powerful language for building web and mobile applications.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>dart</category>
    </item>
    <item>
      <title>A Guide to Formatting Dates in JavaScript</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Mon, 20 Nov 2023 13:56:51 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/a-guide-to-formatting-dates-in-javascript-an2</link>
      <guid>https://dev.to/avwerosuoghene/a-guide-to-formatting-dates-in-javascript-an2</guid>
      <description>&lt;p&gt;Working with dates is a common task in web development, and JavaScript provides a powerful Date object to handle various date and time operations. Formatting dates for display is an essential aspect of creating user-friendly applications. In this guide, we'll explore different ways to format dates in JavaScript, along with code snippets and detailed explanations.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Using 'toLocaleString'&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The toLocaleString method is a built-in function in JavaScript that provides a simple way to format dates based on the user's locale.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ctIBRcH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smbikjp5wcddnm9w3lve.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ctIBRcH9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/smbikjp5wcddnm9w3lve.png" alt="Image description" width="800" height="260"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This method automatically adapts the date format based on the user's locale, providing a localized representation.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Using 'toLocaleDateString'&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If you want to display only the date portion without the time, you can use the toLocaleDateString method.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ArKMteo2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56nw4m5k62u9dr6etmqw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ArKMteo2--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/56nw4m5k62u9dr6etmqw.png" alt="Image description" width="800" height="276"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Custom Formatting with 'Intl.DateTimeFormat'&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The Intl.DateTimeFormat object provides a higher level of precision in date formatting, allowing you to customize both date and time formats. By specifying options with Intl.DateTimeFormat, you have the flexibility to tailor date presentations to meet your specific requirements.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7zJz9LQL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nva26z3zbdnxjmz7qjef.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7zJz9LQL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/nva26z3zbdnxjmz7qjef.png" alt="Image description" width="800" height="225"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Using Libraries like moment.js&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The moment.js library stands out as a favored solution for managing dates and times in JavaScript. Offering a straightforward and adaptable API for date formatting, it simplifies the process.&lt;/p&gt;

&lt;p&gt;Commence by installing moment.js through npm with the following command: npm install moment. Subsequently, incorporate it into your JavaScript code using:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--S70LWyx0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhfj8wqie8ehi5its8h7.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--S70LWyx0--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qhfj8wqie8ehi5its8h7.png" alt="Image description" width="800" height="325"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Manually Formatting with get Methods&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;For more control over the date components, you can manually extract the date, month, and year using the get methods of the Date object.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sdH7yxG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4lo5k55wntklpbpnjne.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sdH7yxG_--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/c4lo5k55wntklpbpnjne.png" alt="Image description" width="800" height="329"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;While opting for this method grants you extensive control, it involves a more hands-on approach in managing the individual date components.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Picking the right way to format dates in JavaScript boils down to what suits your needs. Whether you go for the simplicity of built-in methods like toLocaleString or try out third-party options like moment.js, knowing these choices helps you create a straightforward and user-friendly date display in your web applications. Play around with these methods to find what works best for you.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>programming</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Understanding "use strict" in TypeScript</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Mon, 06 Nov 2023 19:36:14 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/understanding-use-strict-in-typescript-2dh</link>
      <guid>https://dev.to/avwerosuoghene/understanding-use-strict-in-typescript-2dh</guid>
      <description>&lt;p&gt;TypeScript offers many helpful features to make coding cleaner and more reliable. In this article, we'll take a closer look at one such feature called "use strict." This feature is a simple but important part of TypeScript that can improve the quality and reliability of your code. We'll explore how "use strict" helps you follow best practices and maintain the integrity of your software projects. Let's dive into the world of "use strict" in TypeScript!&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;What is "use strict"?&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Before we delve into how TypeScript uses "use strict," let's understand what it is. "use strict" is a directive in JavaScript that changes the way the code is interpreted. When it is applied, JavaScript operates in a more secure and structured mode. It enforces stricter parsing and error handling, making your code less prone to common coding mistakes.&lt;/p&gt;

&lt;p&gt;Here's how to enable "use strict" in JavaScript:&lt;/p&gt;

&lt;p&gt;&lt;a href="![Image%20description](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/qize1ekpx3wimprffo50.png)"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;"use strict" in TypeScript&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In TypeScript, the use of "use strict" is a bit different from traditional JavaScript. TypeScript always assumes "use strict" by default. This means that the best practices and error prevention provided by "use strict" are already integrated into your TypeScript code without explicitly adding the directive.&lt;/p&gt;

&lt;p&gt;Let's take a look at an example. Consider this TypeScript code snippet:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foouznt6gx2kgaoxcedgc.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Foouznt6gx2kgaoxcedgc.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Under the hood, TypeScript transpile this code into JavaScript and ensures that "use strict" is implicitly present:&lt;br&gt;
&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxyy8nwrw73rza3gc3al0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fxyy8nwrw73rza3gc3al0.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Benefits of Implicit "use strict"&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;The implicit "use strict" in TypeScript offers several benefits:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Enhanced Code Quality&lt;/strong&gt;&lt;br&gt;
By enforcing stricter rules and preventing common coding mistakes, "use strict" in TypeScript helps maintain a higher level of code quality. This leads to fewer runtime errors and a more predictable code behavior.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Improved Security&lt;/strong&gt;&lt;br&gt;
"Use strict" enhances security by preventing certain types of vulnerabilities and exploits. It reduces the risk of accidentally declaring global variables and mitigates potential security threats.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Future-Proofing&lt;/strong&gt;&lt;br&gt;
With "use strict" implicitly enabled, your TypeScript code is more compatible with evolving JavaScript standards. You're less likely to encounter issues when adopting new language features and adhering to best practices.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;When to Use "use strict" Explicitly&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;In most cases, TypeScript's implicit "use strict" is sufficient to ensure code quality and security. However, there may be scenarios where you want to use it explicitly. This is relevant when you're working with existing JavaScript code and want to ensure that the "use strict" directive is in place.&lt;/p&gt;

&lt;p&gt;To use "use strict" explicitly in TypeScript, you can do the following:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ewudeyutds9rzyl4pd3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1ewudeyutds9rzyl4pd3.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;By adding the directive at the top of your TypeScript file, you make it clear that you intend to enforce strict mode. It's also useful when integrating TypeScript code into projects with existing JavaScript codebases.&lt;/p&gt;

&lt;h2&gt;
  
  
  &lt;strong&gt;Conclusion&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;"Use strict" is a valuable feature that enhances the quality, security, and compatibility of your code. In TypeScript, it's always enabled by default, making your development experience more reliable. While you might need to use it explicitly in specific scenarios, TypeScript's implicit "use strict" is your steadfast guardian, ensuring your code remains robust and future-proof.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>typescript</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Step-by-Step Guide: Converting C# Object to JSON</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Sun, 17 Sep 2023 17:31:54 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/step-by-step-guide-converting-c-object-to-json-olc</link>
      <guid>https://dev.to/avwerosuoghene/step-by-step-guide-converting-c-object-to-json-olc</guid>
      <description>&lt;p&gt;Dealing with data in different formats is a routine task when working with C#. JSON (JavaScript Object Notation) is a widely used format for sharing data. It's user-friendly and computer-friendly, making it a popular choice for storing and exchanging information. In this article, we'll guide you through the process of transforming a C# object into JSON format, one step at a time.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 1: Create a C# Object
&lt;/h2&gt;

&lt;p&gt;Let's start with a C# object you want to turn into JSON. This object could be a class instance, a collection, or any custom data structure. To illustrate, let's use a basic example: the "Person" class.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57wpb618y1zc5yegirmx.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F57wpb618y1zc5yegirmx.png" alt="Image description" width="800" height="201"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 2: Use a JSON Serialization Library
&lt;/h2&gt;

&lt;p&gt;To make this conversion happen, you'll require a JSON serialization library. Luckily, C# comes equipped with built-in options such as Newtonsoft.Json, often referred to as JSON.NET, which enjoys widespread use in the C# community.&lt;/p&gt;

&lt;p&gt;Getting JSON.NET on board is straightforward. You can install it using NuGet Package Manager or the built-in package manager in Visual Studio. Once installed, it's ready to be integrated into your project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F84jbp78vm97lcqs4n5ai.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F84jbp78vm97lcqs4n5ai.png" alt="Image description" width="800" height="184"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 3: Serialize the C# Object
&lt;/h2&gt;

&lt;p&gt;Now that you have your C# object and the JSON serialization library in place, it's time to perform the actual conversion. Here's a simple example of how to serialize a Person object:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4dci6zam1i0k58pptlrq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F4dci6zam1i0k58pptlrq.png" alt="Image description" width="800" height="492"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this snippet, we first create a Person object with some sample data. Then, we use the JsonConvert.SerializeObject method provided by JSON.NET to convert the person object into a JSON string stored in the JSON variable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Step 4: Handle Serialization Options (Optional)
&lt;/h2&gt;

&lt;p&gt;JSON serialization often comes with various options. You can customize the serialization process to exclude specific properties, format dates, or handle null values differently. JSON.NET allows you to achieve this through attributes or by configuring the JsonSerializerSettings.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firvf5n2eymd0ov7023v8.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/cdn-cgi/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Firvf5n2eymd0ov7023v8.png" alt="Image description" width="800" height="466"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this example, we customize the JSON serialization process using JsonSerializerSettings. We set NullValueHandling to Ignore, which means that any null properties in the person object will be excluded from the JSON output. We also set Formatting to Indented to make the JSON output more human-readable with proper indentation which is evident in the console display.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Transforming C# objects into JSON is a crucial skill for every C# developer. With handy tools like JSON.NET and the easy steps we've shared in this guide, you can effortlessly manage JSON data in your C# projects. Whether you're crafting web services, interfacing with APIs, or managing data storage, becoming adept at JSON serialization is a valuable addition to your programming toolbox.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>programming</category>
      <category>beginners</category>
      <category>csharp</category>
    </item>
    <item>
      <title>Understanding NullReferenceException in C#</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Tue, 29 Aug 2023 18:04:27 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/understanding-nullreferenceexception-in-c-3lk1</link>
      <guid>https://dev.to/avwerosuoghene/understanding-nullreferenceexception-in-c-3lk1</guid>
      <description>&lt;p&gt;NullReferenceException is a common puzzler in C#. It shows up when you try to to access a member(like a property, method, or field) of a reference type variable that is currently null. Picture trying to build a house with invisible bricks – not gonna work, right? This article aims to provide a clear understanding of NullReferenceException, its causes, and practical ways to handle it.&lt;/p&gt;

&lt;p&gt;In C#, reference types (such as classes and interfaces) can hold references to objects, or they can be assigned a special value, "null," which signifies the absence of an object reference. Attempting to access members of a null reference triggers a NullReferenceException at runtime, as the runtime environment cannot resolve the requested member on a null object.&lt;/p&gt;

&lt;h2&gt;
  
  
  Common Causes of NullReferenceException
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;- Null Returned from Method&lt;/strong&gt;&lt;br&gt;
If a method returns null and you then try to access a member or call a method on that null value, you'll come face to face with a NullReferenceException. This is because you're attempting to interact with an object that doesn't actually exist.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--FwuhoPQC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plbuc7gafndovxzy30e0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--FwuhoPQC--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/plbuc7gafndovxzy30e0.png" alt="Image description" width="800" height="375"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In the code snippet above, the GetGreeting method returns null. When you call this method and assign its result to the greeting variable, greeting becomes null.&lt;/p&gt;

&lt;p&gt;When you then try to access the Length property of greeting, a NullReferenceException will be thrown because you're attempting to access a member of a null value.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Missing Object Initialisation&lt;/strong&gt;&lt;br&gt;
If you create a reference type (such as a class) but forget to initialise an instance of that class before trying to access its members or methods, you will encounter a NullReferenceException.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--rKFSLeMq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xtlg5c9g26eibr6nd4t.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--rKFSLeMq--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/7xtlg5c9g26eibr6nd4t.png" alt="Image description" width="800" height="579"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this code, the Person class has a property Name and a method Introduce() to introduce the person's name. However, in the Main() method, the person variable is declared but not initialised with an instance of the Person class.&lt;/p&gt;

&lt;p&gt;When you try to call the Introduce() method on the uninitialised person variable, a NullReferenceException will be thrown because person is null, and you can't call methods on a null reference&lt;/p&gt;

&lt;h2&gt;
  
  
  Preventing NullReferenceException
&lt;/h2&gt;

&lt;p&gt;By employing proactive measures and careful coding practices, it's possible to prevent these exceptions. Let's consider some of the ways this can be achieved.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Null-Conditional Operator&lt;/strong&gt;&lt;br&gt;
This operator allows us to safely access members of an object that might be null, without causing a NullReferenceException.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--XlseDERh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yoacfb5ttznt4jz20xld.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--XlseDERh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/yoacfb5ttznt4jz20xld.png" alt="Image description" width="800" height="462"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this code, the ? operator ensures that if person is null, the value of name will also be null. If person is not null, name will hold the value of the Name property.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Null Coalescing Operator:&lt;/strong&gt;&lt;br&gt;
The ?? Operator is a handy feature that allows you to provide a default value when dealing with null values. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--F08LWVJK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vszdc3pc5yz7s4mdbbao.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--F08LWVJK--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/vszdc3pc5yz7s4mdbbao.png" alt="Image description" width="800" height="454"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this code, the ?? operator allows us to provide a default value ("Default Name") if person?.Name is null. If person is not null, the value of the Name property will be used.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Conditional Statements:&lt;/strong&gt;&lt;br&gt;
Conditional statements like if-else provide another option for handling null values.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--iWXe16xG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0ku7hceshd4pl29gina.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--iWXe16xG--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v0ku7hceshd4pl29gina.png" alt="Image description" width="800" height="494"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this code, an if-else statement is used to check whether the Name property of the person object is null. If this condition is met, the value of person.Name is assigned to the name variable; otherwise, if person is null or person.Name is null, the name variable is set to "Default Name".&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion:
&lt;/h2&gt;

&lt;p&gt;NullReferenceException is a common challenge in C# programming, often arising from attempting to access members of null reference type variables. By using null-safe operators, null coalescing, null checks, and conditional statements, you can prevent these exceptions and write more robust and reliable code. Understanding the nuances of null values and handling them proactively will enhance your programming skills and contribute to better software development practices&lt;/p&gt;

</description>
      <category>dotnet</category>
      <category>webdev</category>
      <category>tutorial</category>
      <category>programming</category>
    </item>
    <item>
      <title>Interfaces vs Types in TypeScript: Understanding the Differences</title>
      <dc:creator>Avwerosuoghene Darhare-Igben</dc:creator>
      <pubDate>Wed, 23 Aug 2023 15:18:10 +0000</pubDate>
      <link>https://dev.to/avwerosuoghene/interfaces-vs-types-in-typescript-understanding-the-differences-2j61</link>
      <guid>https://dev.to/avwerosuoghene/interfaces-vs-types-in-typescript-understanding-the-differences-2j61</guid>
      <description>&lt;p&gt;In TypeScript, creating custom data structures involves two key players: interfaces and types. These tools, although similar, have specific roles and benefits. This article delves into the practical aspects of interfaces and types, exploring their features and suggesting optimal situations for their application. Let's uncover the nuanced world of TypeScript's essential building blocks.&lt;/p&gt;

&lt;h2&gt;
  
  
  Interfaces
&lt;/h2&gt;

&lt;p&gt;Interfaces are primarily used to define the shape of objects or classes. They act as contracts that specify which properties an object must have and their respective types. Interfaces are ideal for maintaining consistent structures across various parts of your codebase.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92gaoz1wyxtsr6v5eedv.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F92gaoz1wyxtsr6v5eedv.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In this scenario, the Furniture interface ensures that any object assigned to the chair variable adheres to the required properties and types.&lt;/p&gt;

&lt;h2&gt;
  
  
  Types
&lt;/h2&gt;

&lt;p&gt;Types offer a more versatile approach to defining custom types. While they can define object shapes just like interfaces, their true power lies in handling unions, intersections, tuples, and complex type compositions. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11pmjime6ncgs8s8zyij.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F11pmjime6ncgs8s8zyij.png" alt="Image description"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The example code above creates custom types for managing furniture-related data.It defines FurnitureID for IDs that can be either strings or numbers. FurniturePiece describes furniture properties like color, newness, and width. FurnitureWithDimensions extends FurniturePiece to include height and depth. FurnitureOwner includes ID and name for furniture owners, while FurnitureShop contains details about the shop manager and staff.&lt;/p&gt;

&lt;h2&gt;
  
  
  Making the Choice Between Interfaces and Types
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;- Interfaces&lt;/strong&gt;&lt;br&gt;
Choose interfaces when you want to lay out how objects should be built and make sure everyone follows the same rules. This helps keep your code neat and easy to understand, making it simpler to manage and work together on. Interfaces give your code a solid base, making it easier for different parts to work well together.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;- Types&lt;/strong&gt;&lt;br&gt;
Go for types when things get more complicated, like dealing with combinations, overlaps, special rules, or conditions. Types are your go-to for handling intricate situations, giving you more freedom in defining how things should behave. For instance, you can use types to describe different kinds of data in a detailed and adaptable way&lt;/p&gt;

&lt;p&gt;Although interfaces and types serve different purposes, they can sometimes be used interchangeably. Your decision between them should be based on your project's needs and your coding preferences. If you want well-defined object layouts, go for interfaces. For complex type handling, types are your choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Interfaces and types are essential tools in TypeScript to ensure your code has the right types. Knowing their differences helps you choose wisely. Whether you're creating basic shapes or handling complex types, TypeScript's interfaces and types offer the flexibility and structure for strong and manageable code.&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>beginners</category>
      <category>programming</category>
    </item>
  </channel>
</rss>
