<?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: asifbuetcse</title>
    <description>The latest articles on DEV Community by asifbuetcse (@asifbuetcse).</description>
    <link>https://dev.to/asifbuetcse</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%2F491393%2F2ed9f287-a812-40f8-b78b-ca709c8214f4.jpeg</url>
      <title>DEV Community: asifbuetcse</title>
      <link>https://dev.to/asifbuetcse</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/asifbuetcse"/>
    <language>en</language>
    <item>
      <title>Beyond the Tutorials: A Realistic Look at Coding in the Real World – Part 4</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Sat, 28 Jan 2023 12:26:21 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-4-18o3</link>
      <guid>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-4-18o3</guid>
      <description>&lt;p&gt;Programming tutorials shows us a land of promise where everything happens as you think; as soon as you think. But real world doesn’t work that way most of the times. Here; you spend hours debugging some CORS error or thinking why your database table Id column is not auto-incrementing. For the last 2 days; I am participating in a coding &lt;a href="https://asifulhaque.com/common-interview-questions-for-sr-software-engineers-and-how-to-answer-them/" rel="noopener noreferrer"&gt;interview&lt;/a&gt; which spans 2 days and these series of blog is based on that experience – what am I thinking at each stage; what is the issue and how I am resolving them. This is the fourth part of that.&lt;/p&gt;

&lt;h2&gt;Black cloud on the swagger front&lt;/h2&gt;

&lt;p&gt;When we tried to run the backend project; the swagger returned a 500 error. &lt;br&gt;Few things were missing in SurveyController.cs class -&lt;br&gt;1 &lt;code&gt;[ApiController]&lt;br&gt;[Route("api/[controller]")]&lt;/code&gt; was missing before the &lt;code&gt;public class SurveyController : Controller&lt;/code&gt; line and &lt;br&gt;2. [HttpGet] and [HttpPost] was absent before the method signatures; as I created the file from a wrong template.&lt;/p&gt;

&lt;p&gt;Now after solving this issues; when we try to submit the survey form from the front-end; it is giving us 400 error. Yikes! Roaming around in the preview tab of browser; we can see the issue - &lt;/p&gt;

&lt;p&gt;&lt;code&gt;$.Questions[0].Answers[0].isCorrect: [,…]&lt;br&gt;0: "The JSON value could not be converted to System.Boolean. Path: $.Questions[0].Answers[0].isCorrect | LineNumber: 0 | BytePositionInLine: 80."&lt;/code&gt;&lt;br&gt;So; it failed to convert isCorrect from string to boolean.&lt;/p&gt;

&lt;p&gt;So; we gave them a Boolean value. After that; all of the string value - title, text etc was expecting default value except null; and we had to make them uppercase as to match them with backend model. So the final ts file for survey looks like this that can post to the backend - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { Component, OnInit } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms';
import { HttpClientService } from 'src/app/http-client.service';

@Component({
  selector: 'app-survey-add',
  templateUrl: './survey-add.component.html',
  styleUrls: ['./survey-add.component.scss']
})
export class SurveyAddComponent implements OnInit {
  _client: HttpClientService;
  surveyForm = new FormGroup({
    Title: new FormControl(""),
    Questions: new FormArray(
      [
        new FormGroup(
          {
            Text: new FormControl(""),
            Answers: new FormArray(
              [
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
              ]
            )
          }
        ),
        new FormGroup(
          {
            Text: new FormControl(""),
            Answers: new FormArray(
              [
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
              ]
            )
          }
        ),
        new FormGroup(
          {
            Text: new FormControl(""),
            Answers: new FormArray(
              [
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(""),
                    isCorrect: new FormControl(false),
                  }
                ),
              ]
            )
          }
        ),
      ]
    ),
  });

  constructor(client: HttpClientService) { this._client = client }

  ngOnInit(): void {
  }

  getQuestionControls() {
    return this.surveyForm.controls['Questions'] as FormArray;
  }

  getAnswerControls(question: any) {
    console.log(question['Answers'] as FormArray);
    return question['Answers'];
  }

  selectAnswer(i: number, j: number) {
  }

  save() {
    this._client.postData("survey", this.surveyForm.value).subscribe((res) =&amp;gt; {
      console.log(res);
    });
  }

  cancel() {
    this.surveyForm = new FormGroup({
      title: new FormControl(),
      Questions: new FormArray(
        [
          new FormGroup(
            {
              Text: new FormControl(""),
              Answers: new FormArray(
                [
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                ]
              )
            }
          ),
          new FormGroup(
            {
              Text: new FormControl(""),
              Answers: new FormArray(
                [
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                ]
              )
            }
          ),
          new FormGroup(
            {
              Text: new FormControl(""),
              Answers: new FormArray(
                [
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(""),
                      isCorrect: new FormControl(false),
                    }
                  ),
                ]
              )
            }
          ),
        ]
      ),
    });
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We have to change our surveyRepository also to enable it to save survey, questions and answers. &lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fasifulhaque.com%2Fwp-content%2Fuploads%2F2023%2F01%2Fis-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" 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%2Fasifulhaque.com%2Fwp-content%2Fuploads%2F2023%2F01%2Fis-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" alt="Tutorials_2" width="800" height="639"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The implementation that I go for is like this -&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;using dev_test.DTOs;

namespace dev_test.Repositories.Contracts
{
    public class SurveyRepository : ISurveyRepository
    {
        public DatabaseContext _databaseContext;
        public SurveyRepository(DatabaseContext databaseContext)
        {
            _databaseContext = databaseContext;
        }

        IEnumerable&amp;lt;Survey&amp;gt; ISurveyRepository.GetSurveys()
        {
            _databaseContext.Database.EnsureCreated();
            return _databaseContext.Survey.ToList();
        }

        void ISurveyRepository.PostSurveys(SurveyComposite survey)
        {
            Survey surv = new Survey
            {
                Title = survey.Title
            };
            _databaseContext.Add&amp;lt;Survey&amp;gt;(surv);
            _databaseContext.SaveChanges();
            foreach(var ques in survey.Questions)
            {
                Question q = new Question
                {
                    Text = ques.Text,
                    SurveyId = surv.Id
                };
                _databaseContext.Add&amp;lt;Question&amp;gt;(q);
                _databaseContext.SaveChanges();
                foreach(var ans in ques.Answers)
                {
                    Answer answer = new Answer
                    {
                        QuestionId = q.Id,
                        Text = ans.Text,
                        IsCorrect = ans.IsCorrect
                    };
                    _databaseContext.Add&amp;lt;Answer&amp;gt;(answer);
                    _databaseContext.SaveChanges();
                }
            }
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We forgot to update CreatedDate and UpdatedDate for survey; so this code is also throwing an error for that.&lt;/p&gt;

&lt;p&gt;So; we change our Survey model creation like this - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;    Survey surv = new Survey
     {
                Title = survey.Title,
                CreatedDate = DateTime.Now,
                UpdatedDate = DateTime.Now
      };        &lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;It's still giving us - &lt;br&gt;&lt;code&gt;Invalid column name 'CreatedDate'.&lt;br&gt;Invalid column name 'UpdatedDate'.&lt;/code&gt;&lt;br&gt;&lt;br&gt;The reason for this is in our db design. If we look closely; for all other two word terms; we used camel casing without any hyphen or underscore, like - &lt;code&gt;isActive&lt;/code&gt;; which is the right way. But for these 2 dates; we used all lower case with underscore in between, like created_date. So; C# can't map &lt;code&gt;CreatedDate &lt;/code&gt;&lt;br&gt;to &lt;code&gt;created_date&lt;/code&gt;.&lt;br&gt;So; we change our db design again and edit all &lt;code&gt;word1_word2&lt;/code&gt; format into &lt;code&gt;camelCase&lt;/code&gt;.&lt;br&gt;The code and updated scripts will be available at version_2.&lt;/p&gt;

&lt;p&gt;This actually solves the issue of saving multiple users; multiple surveys and multiple question and answers.&lt;br&gt;But all we did is just created a skeleton to save some data. &lt;br&gt;And we have some issues here; for example -&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;When saving the user with existing email; it throws an error; next time if we give different email; it saves correctly but skips an index in database.&lt;/li&gt;



&lt;li&gt;Saving successfully doesn't do anything in the front end. It should give an success message or toast ad redirect to list page.&lt;/li&gt;



&lt;li&gt;The save method is returning only a boolean. It should be corrected to send correct format data.&lt;/li&gt;



&lt;li&gt;Validations are not handled properly.&lt;/li&gt;



&lt;li&gt;Survey page should be dynamic. It is bulky and unmanageable at this time.&lt;/li&gt;



&lt;li&gt;We should have ideally separated the DTOs and models for the backend project.&lt;/li&gt;



&lt;li&gt;We didn't go for either code first or db first approach. We need to change that (we are going to code first).&lt;/li&gt;



&lt;li&gt;No authentication and authorization is implemented.&lt;/li&gt;



&lt;li&gt;There are some other issues with the code. &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We will start to fix all of these in the code version_3 and onwards. &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other episodes in this series:&lt;/strong&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/when-programming-tutorials-doesnt-work-part-1/" rel="noopener noreferrer"&gt;First Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-2/" rel="noopener noreferrer"&gt;Second Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-3/" rel="noopener noreferrer"&gt;Third Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-4/" rel="noopener noreferrer"&gt;Fourth Part&lt;/a&gt;&lt;br&gt;And the code is given is updated into - &lt;br&gt;&lt;a href="https://github.com/asifbuetcse/dev-test" rel="noreferrer noopener"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>gratitude</category>
      <category>documentation</category>
    </item>
    <item>
      <title>Beyond the Tutorials: A Realistic Look at Coding in the Real World – Part 3</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Sat, 28 Jan 2023 12:24:41 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-3-4e66</link>
      <guid>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-3-4e66</guid>
      <description>&lt;p&gt;Programming tutorials shows us a land of promise where everything happens as you think; as soon as you think. But real world doesn’t work that way most of the times. Here; you spend hours debugging some CORS error or thinking why your database table Id column is not auto-incrementing. For the last 2 days; I am participating in a coding &lt;a href="https://asifulhaque.com/common-interview-questions-for-sr-software-engineers-and-how-to-answer-them/"&gt;interview&lt;/a&gt; which spans 2 days and these series of blog is based on that experience – what am I thinking at each stage; what is the issue and how I am resolving them. This is the third part of that.&lt;/p&gt;

&lt;h2&gt;Designing the rest of the Angular UI&lt;/h2&gt;

&lt;p&gt;What we left are adding a navigation on top of the page; adding the pages that will be responsible for the UI; and designing the pages in reactive form (Yes; we hate ourself). &lt;/p&gt;

&lt;h3&gt;Reactive Forms:&lt;/h3&gt;

&lt;h4&gt;Pros:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;They provide more control over the form and its elements, as you can programmatically manipulate the form and its elements.&lt;/li&gt;



&lt;li&gt;They are more efficient as they only update the form and its elements when explicitly told to do so.&lt;/li&gt;



&lt;li&gt;They are better suited for handling complex forms with many fields and validation rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Cons:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;They can be more difficult to set up and may require more code to implement.&lt;/li&gt;



&lt;li&gt;They may not be as intuitive to work with for developers who are not familiar with the reactive programming paradigm.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Example:&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;this.form = this.fb.group({
  name: ['', Validators.required],
  email: ['', [Validators.required, Validators.email]],
  password: ['', Validators.required],
});
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Template-Driven Forms:&lt;/h3&gt;

&lt;h4&gt;Pros:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;They are easier to set up and may require less code to implement.&lt;/li&gt;



&lt;li&gt;They are more intuitive for developers who are not familiar with the reactive programming paradigm.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Cons:&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;They provide less control over the form and its elements, as the data binding is handled automatically.&lt;/li&gt;



&lt;li&gt;They may not be as efficient as reactive forms, as they update the form and its elements on every change event.&lt;/li&gt;



&lt;li&gt;They are less suitable for handling complex forms with many fields and validation rules.&lt;/li&gt;
&lt;/ul&gt;

&lt;h4&gt;Example:&lt;/h4&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;form #form="ngForm" (ngSubmit)="submit(form)"&amp;gt;
  &amp;lt;input name="name" ngModel required&amp;gt;
  &amp;lt;input name="email" ngModel required email&amp;gt;
  &amp;lt;input name="password" ngModel required&amp;gt;
  &amp;lt;button type="submit"&amp;gt;Submit&amp;lt;/button&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;h3&gt;Why Reactive over Template-Driven&lt;/h3&gt;

&lt;p&gt;Reactive Forms provide more control over handling complex forms with many fields and validation rules as they allow you to programmatically manipulate the form and its elements. This allows you to create a form structure that is more modular and reusable, making it easier to manage and maintain.&lt;/p&gt;

&lt;p&gt;For example, in a complex form with many fields and validation rules, you can create a custom form control component for each field and reuse it throughout the form. This allows you to keep the form code more organized and maintainable, making it easier to add, remove, or update fields and validation rules.&lt;/p&gt;

&lt;p&gt;Reactive forms also offer a powerful way of handling validation. With reactive forms, you can define validation rules for each form control and even for the form itself. This allows you to centralize your validation logic and keep it organized. You can also use the built-in Angular validation directives such as &lt;code&gt;required&lt;/code&gt;, &lt;code&gt;min&lt;/code&gt;, &lt;code&gt;max&lt;/code&gt;, and &lt;code&gt;pattern&lt;/code&gt; and you can also create your custom validators to apply more complex validation rules.&lt;/p&gt;

&lt;p&gt;For example, here is a sample of how to create a custom validator and use it with a form control:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { FormControl } from '@angular/forms';

function validateEmail(c: FormControl) {
  let EMAIL_REGEXP = /^[a-z0-9!#$%&amp;amp;'*+\/=?^_`{|}~.-]+@[a-z0-9]([a-z0-9-]*[a-z0-9])?(\.[a-z0-9]([a-z0-9-]*[a-z0-9])?)*$/i;

  return EMAIL_REGEXP.test(c.value) ? null : {
    validateEmail: {
      valid: false
    }
  };
}

this.form = new FormGroup({
  email: new FormControl('', [validateEmail])
});&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;One problem that we run into when we design user-list.ts like this -&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClientService } from 'src/app/http-client.service';
import { UserModel } from '../../../../models/user';

@Component({
  selector: 'app-use-list',
  templateUrl: './use-list.component.html',
  styleUrls: ['./use-list.component.scss']
})
export class UseListComponent implements OnInit {
  userList = UserModel[];
  constructor(client: HttpClientService) {
    client.getData("user").subscribe((res: UserModel[]) =&amp;gt; {
      console.log(res);
      this.userList = res;
    });
  }

  ngOnInit(): void {

  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Where we declare UserModel in a model file; we get the following error - &lt;code&gt;Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'typeof UserModel'.&lt;/code&gt; Most probably our use of [] after UserModel is causing the issue. Changing the code like below fixes the issue - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClientService } from 'src/app/http-client.service';
import { UserModel } from '../../../../models/user';

@Component({
  selector: 'app-use-list',
  templateUrl: './use-list.component.html',
  styleUrls: ['./use-list.component.scss']
})
export class UseListComponent implements OnInit {
  userList: UserModel[] = [];
  constructor(client: HttpClientService) {
    client.getData("user").subscribe((res) =&amp;gt; {
      console.log(res);
      this.userList = res as UserModel[];
    });
  }

  ngOnInit(): void {

  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We have since changed the code and our user-create.html file looks like this - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
  &amp;lt;form [formGroup]="userForm"&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
      &amp;lt;label for="name"&amp;gt;Name&amp;lt;/label&amp;gt;
      &amp;lt;input type="text" class="form-control" id="name" formControlName="name"&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
      &amp;lt;label for="email"&amp;gt;Email&amp;lt;/label&amp;gt;
      &amp;lt;input type="email" class="form-control" id="email" formControlName="email"&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group"&amp;gt;
      &amp;lt;label for="mobile"&amp;gt;Mobile&amp;lt;/label&amp;gt;
      &amp;lt;input type="tel" class="form-control" id="mobile" formControlName="mobile"&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;div class="form-group form-check"&amp;gt;
      &amp;lt;input type="checkbox" class="form-check-input" id="is_active" formControlName="isActive"&amp;gt;
      &amp;lt;label class="form-check-label" for="is_active"&amp;gt;Is Active&amp;lt;/label&amp;gt;
    &amp;lt;/div&amp;gt;
    &amp;lt;button type="submit" class="btn btn-primary" (click)="save()"&amp;gt;Save&amp;lt;/button&amp;gt;
    &amp;lt;!-- &amp;lt;button type="button" class="btn btn-secondary" (click)="cancel()"&amp;gt;Cancel&amp;lt;/button&amp;gt; --&amp;gt;
  &amp;lt;/form&amp;gt;
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;which is throwing an error - Can't bind to 'formGroup' since it isn't a known property of 'form'.  &lt;br&gt;When we add&lt;br&gt;&lt;code&gt; import { FormsModule, ReactiveFormsModule } from '@angular/forms';&lt;/code&gt;&lt;br&gt;in app.module.ts file and in imports list added - &lt;br&gt;&lt;code&gt;FormsModule,&lt;br&gt;ReactiveFormsModule&lt;/code&gt;&lt;br&gt;This issue is gone however.&lt;/p&gt;

&lt;p&gt;The code unto this will be available in branch - version_1.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6nQbUUgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/is-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6nQbUUgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/is-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" alt="Tutorials_2" width="880" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;The Struggle Begins!&lt;/h2&gt;

&lt;p&gt;When we submit the form; it shows an error - &lt;code&gt;An error occurred while saving the entity changes. See the inner exception for details.&lt;/code&gt; &amp;amp; &lt;code&gt;Cannot insert the value NULL into column 'id', table 'dev_test.dbo.user'; column does not allow nulls. INSERT fails.&lt;/code&gt; &lt;br&gt;Which is understandable! I mean; we haven't given the object any id value. &lt;br&gt;But shouldn't our db take care of that? &lt;br&gt;&lt;br&gt;Looking into our db script; we can see that we have made id primary key; but we forgot to increment it; specifically forgot to add &lt;code&gt;IDENTITY(1,1) NOT NULL&lt;/code&gt; to our tables.&lt;br&gt;So we need to add some ways to drop and create tables and setting the identity to each id column. &lt;br&gt;And our database file looks like this -&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;IF OBJECT_ID(N'dbo.invitation', N'U') IS NOT NULL  
   DROP TABLE [dbo].invitation;  
GO

IF OBJECT_ID(N'dbo.submission', N'U') IS NOT NULL  
   DROP TABLE [dbo].submission;  
GO

IF OBJECT_ID(N'dbo.answer', N'U') IS NOT NULL  
   DROP TABLE [dbo].answer;  
GO

IF OBJECT_ID(N'dbo.question', N'U') IS NOT NULL  
   DROP TABLE [dbo].question;  
GO

IF OBJECT_ID(N'dbo.survey', N'U') IS NOT NULL  
   DROP TABLE [dbo].survey;  
GO


IF OBJECT_ID(N'dbo.[user]', N'U') IS NOT NULL  
   DROP TABLE [dbo].[user];  
GO


CREATE TABLE [user]
(
    id INT PRIMARY KEY  IDENTITY(1,1),
    email VARCHAR(255) NOT NULL UNIQUE,
    mobile VARCHAR(15) NOT NULL,
    isActive BIT NOT NULL,
    role VARCHAR(255) NOT NULL
);

CREATE TABLE survey
(
    id INT PRIMARY KEY IDENTITY(1,1),
    title VARCHAR(255) NOT NULL,
    created_date DATETIME NOT NULL,
    updated_date DATETIME NOT NULL
);

CREATE TABLE question
(
    id INT PRIMARY KEY IDENTITY(1,1),
    survey_id INT NOT NULL,
    text NVARCHAR(MAX) NOT NULL,
    FOREIGN KEY (survey_id) REFERENCES survey(id)
);

CREATE TABLE answer
(
    id INT PRIMARY KEY IDENTITY(1,1),
    question_id INT NOT NULL,
    text NVARCHAR(MAX) NOT NULL,
    is_correct BIT NOT NULL,
    FOREIGN KEY (question_id) REFERENCES question(id)
);


CREATE TABLE invitation
(
    id INT PRIMARY KEY IDENTITY(1,1),
    survey_id INT NOT NULL,
    user_id INT NOT NULL,
    invitation_link NVARCHAR(MAX) NOT NULL,
    FOREIGN KEY (survey_id) REFERENCES survey(id),
    FOREIGN KEY (user_id) REFERENCES [user](id)
);


CREATE TABLE submission
(
    id INT PRIMARY KEY IDENTITY(1,1),
    survey_id INT NOT NULL,
    user_id INT NOT NULL,
    answer1 INT NOT NULL,
    answer2 INT NOT NULL,
    answer3 INT NOT NULL,
    score INT NOT NULL,
    FOREIGN KEY (survey_id) REFERENCES survey(id),
    FOREIGN KEY (user_id) REFERENCES [user](id)
);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;We then proceed to design the rest of the UI as well. The complete code is given by version_2.&lt;br&gt;One issue we stumbled upon is this. When we design the survey front end like this -&lt;/p&gt;

&lt;p&gt;And ts file like this -&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { Component, OnInit } from '@angular/core';
import { FormArray, FormControl, FormGroup } from '@angular/forms';
import { HttpClientService } from 'src/app/http-client.service';

@Component({
  selector: 'app-survey-add',
  templateUrl: './survey-add.component.html',
  styleUrls: ['./survey-add.component.scss']
})
export class SurveyAddComponent implements OnInit {
  _client: HttpClientService;
  surveyForm = new FormGroup({
    title: new FormControl(),
    Questions: new FormArray(
      [
        new FormGroup(
          {
            Text: new FormControl(),
            Answers: new FormArray(
              [
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
              ]
            )
          }
        ),
        new FormGroup(
          {
            Text: new FormControl(),
            Answers: new FormArray(
              [
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
              ]
            )
          }
        ),
        new FormGroup(
          {
            Text: new FormControl(),
            Answers: new FormArray(
              [
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
                new FormGroup(
                  {
                    Text: new FormControl(),
                    isCorrect: new FormControl(),
                  }
                ),
              ]
            )
          }
        ),
      ]
    ),
  });

  constructor(client: HttpClientService) { this._client = client }

  ngOnInit(): void {
  }

  getQuestionControls() {
    return this.surveyForm.controls['Questions'] as FormArray;
  }

  getAnswerControls(question: any) {
    console.log(question['Answers'] as FormArray);
    return question['Answers'] as FormArray;
  }

  selectAnswer(i: number, j: number) {
  }

  save() {
    this._client.postData("survey", this.surveyForm.value).subscribe((res) =&amp;gt; {
      console.log(res);
    });
  }

  cancel() {
    this.surveyForm = new FormGroup({
      title: new FormControl(),
      Questions: new FormArray(
        [
          new FormGroup(
            {
              Text: new FormControl(),
              Answers: new FormArray(
                [
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                ]
              )
            }
          ),
          new FormGroup(
            {
              Text: new FormControl(),
              Answers: new FormArray(
                [
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                ]
              )
            }
          ),
          new FormGroup(
            {
              Text: new FormControl(),
              Answers: new FormArray(
                [
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                  new FormGroup(
                    {
                      Text: new FormControl(),
                      isCorrect: new FormControl(),
                    }
                  ),
                ]
              )
            }
          ),
        ]
      ),
    });
  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The output is like this - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--2d7mvA60--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-4-1024x275.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--2d7mvA60--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-4-1024x275.png" alt="" width="880" height="236"&gt;&lt;/a&gt;Problematic UI&lt;/p&gt;

&lt;p&gt;As we can see; it's not showing the answers or anything related to that.&lt;br&gt;Rewriting the ts file as - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;  getAnswerControls(question: any) {
    console.log(question['Answers'] as FormArray);
    return question['Answers'];
  }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And the html file as - &lt;/p&gt;

&lt;p&gt;Fixed the issue.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other episodes in this series:&lt;/strong&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/when-programming-tutorials-doesnt-work-part-1/"&gt;First Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-2/"&gt;Second Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-3/"&gt;Third Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-4/"&gt;Fourth Part&lt;/a&gt;&lt;br&gt;And the code is given is updated into - &lt;br&gt;&lt;a href="https://github.com/asifbuetcse/dev-test" rel="noreferrer noopener"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>dotnetcore</category>
      <category>angular</category>
    </item>
    <item>
      <title>Beyond the Tutorials: A Realistic Look at Coding in the Real World – Part 2</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Sat, 28 Jan 2023 12:20:54 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-2-414</link>
      <guid>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-2-414</guid>
      <description>&lt;p&gt;Programming tutorials shows us a land of promise where everything happens as you think; as soon as you think. But real world doesn’t work that way most of the times. Here; you spend hours debugging some CORS error or thinking why your database table Id column is not auto-incrementing. For the last 2 days; I am participating in a coding &lt;a href="https://asifulhaque.com/common-interview-questions-for-sr-software-engineers-and-how-to-answer-them/"&gt;interview&lt;/a&gt; which spans 2 days and these series of blog is based on that experience – what am I thinking at each stage; what is the issue and how I am resolving them. This is the second part of that.&lt;/p&gt;

&lt;h2&gt;Adding DB Context&lt;/h2&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test
{
    public class DatabaseContext : DbContext
    {
        public DatabaseContext()
        : base()
        {
        }

        public DbSet&amp;lt;User&amp;gt; Users { get; set; }
        public DbSet&amp;lt;Survey&amp;gt; Surveys { get; set; }
        public DbSet&amp;lt;Question&amp;gt; Questions { get; set; }
        public DbSet&amp;lt;Answer&amp;gt; Answers { get; set; }
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;At this point; while adding stuff to DatabaseContext file; error was shown and needed to add nuget package Microsoft.EntityFrameworkCore and relevant packages. &lt;br&gt;Added the following line to appsettings.json file - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;"ConnectionStrings": {
    "DBConnection": "server=(localdb)\\MSSQLLocalDB;database=dev_test;Trusted_Connection=true"
  }&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;As there is no startup.cs file in the project; adding following line was not possible.&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;services.AddDbContext&amp;lt;MyDbContext&amp;gt;(options =&amp;gt;
options.UseSqlServer(Configuration.GetConnectionString("DefaultConnection")));&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;At this point; modified the Program.cs class to look like this-&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;using dev_test;
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddDbContext&amp;lt;DatabaseContext&amp;gt;(options =&amp;gt;
  options.UseSqlServer(builder.Configuration.GetConnectionString("DefaultConnection")));&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And got the following error: DbContextOptionsBuilder does not contain a definition for 'usesqlserver' and no extension method 'usesqlserver'. Installed nuget packages and added "using Arch.EntityFrameworkCore;" before the file. Now getting "options is not null here" error. Turns out; "using Arch.EntityFrameworkCore;"  was not the right solution; it should be - &lt;br&gt;&lt;code&gt;"using Microsoft.EntityFrameworkCore;"&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;The difference between the packages "Arch.EntityFrameworkCore" and "Microsoft.EntityFrameworkCore" is that Arch.EntityFrameworkCore is a third-party package that provides additional functionality on top of the standard Microsoft.EntityFrameworkCore package. It may contain additional classes, methods, and features that are not included in the Microsoft.EntityFrameworkCore package. On the other hand, Microsoft.EntityFrameworkCore is an official package from Microsoft that provides the core functionality for working with Entity and databases in .NET applications. It is the foundation for all Entity Framework Core functionality, and it is typically included as a dependency in other packages that provide additional functionality.&lt;br&gt;After that the program.cs file looks like this -&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;using Microsoft.EntityFrameworkCore;
using dev_test;

var builder = WebApplication.CreateBuilder(args);

var connectionString = builder.Configuration.GetConnectionString("DBConnection");
builder.Services.AddDbContext&amp;lt;DatabaseContext&amp;gt;(x =&amp;gt; x.UseSqlServer(connectionString));

builder.Services.AddControllers();
builder.Services.AddEndpointsApiExplorer();
builder.Services.AddSwaggerGen();
...&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Tried to run the project but got the following error -&lt;br&gt;&lt;code&gt;fail: Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware[1]&lt;br&gt;An unhandled exception has occurred while executing the request.&lt;br&gt;Swashbuckle.AspNetCore.SwaggerGen.SwaggerGeneratorException: Ambiguous HTTP method for action - dev_test.Controllers.UserController.Get (dev_test). Actions require an explicit HttpMethod binding for Swagger/OpenAPI 3.0&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Added &lt;code&gt;[HttpGet]&lt;/code&gt; and &lt;code&gt;[HttpPost]&lt;/code&gt; before the &lt;code&gt;UserController&lt;/code&gt; actions; and it worked out perfectly fine.&lt;br&gt;Also; removed the default WeatherController and associated files.&lt;/p&gt;

&lt;p&gt;When running this project in Swagger; it gives the following error - &lt;br&gt;&lt;code&gt;System.InvalidOperationException: Unable to resolve service for type 'dev_test.Services.Contracts.IUserService' while attempting to activate 'dev_test.Controllers.UserController'.&lt;/code&gt;&lt;br&gt;Which means we forgot to register the dependencies. After adding them to our program.cs; it works perfectly fine.&lt;br&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--BbmxLVaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-1024x387.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--BbmxLVaQ--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-1024x387.png" alt="" width="880" height="333"&gt;&lt;/a&gt;Registering repository and service&lt;/p&gt;

&lt;p&gt;Another problem arises though; the database isn't connecting as I am trying to connect over local server. Changing &lt;code&gt;"DBConnection": "server=(localdb)\MSSQLLocalDB;database=dev_test;Trusted_Connection=true"&lt;/code&gt; to &lt;code&gt;"DBConnection":"Server=localhost;Database=dev_test;Trusted_Connection=True;MultipleActiveResultSets=true,TrustServerCertificate=True"&lt;/code&gt; has solved the connection issue; but it is throwing "Invalid value for key 'Multiple Active Result Sets' error." &lt;br&gt;Changing yet again to &lt;code&gt;"DBConnection": "Server=localhost;Database=dev_test;Trusted_Connection=True;TrustServerCertificate=True"&lt;/code&gt; solved the issue; but showing "Invalid object name 'Users'." error. &lt;br&gt;Turns out; in dbcontext; name should be singular instead of plural like this:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;using dev_test.DTOs; // WRONG CODE
using Microsoft.EntityFrameworkCore;

namespace dev_test
{
    public class DatabaseContext : DbContext
    {
        public DatabaseContext(DbContextOptions&amp;lt;DatabaseContext&amp;gt; options) : base(options){}
        public DbSet&amp;lt;User&amp;gt; Users { get; set; }
        public DbSet&amp;lt;Survey&amp;gt; Surveys { get; set; }
        public DbSet&amp;lt;Question&amp;gt; Questions { get; set; }
        public DbSet&amp;lt;Answer&amp;gt; Answers { get; set; }
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;using dev_test.DTOs; // RIGHT CODE
using Microsoft.EntityFrameworkCore;

namespace dev_test
{
    public class DatabaseContext : DbContext
    {
        public DatabaseContext(DbContextOptions&amp;lt;DatabaseContext&amp;gt; options) : base(options){}
        public DbSet&amp;lt;User&amp;gt; User { get; set; }
        public DbSet&amp;lt;Survey&amp;gt; Survey { get; set; }
        public DbSet&amp;lt;Question&amp;gt; Question { get; set; }
        public DbSet&amp;lt;Answer&amp;gt; Answer { get; set; }
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;And for getting the user list; the controller signature should be - public ActionResult&amp;gt; Get()&lt;/p&gt;

&lt;p&gt;Our user insert is working for the time being; though it is requiring us to manually put an different id each time. We need to address this issue later. &lt;br&gt;But first; we need to create our front-end application. &lt;br&gt;Let's get into it and use angular-cli command to create an angular project with routing.&lt;/p&gt;

&lt;h2&gt;Setting Up Angular Project&lt;/h2&gt;

&lt;p&gt;We set up the angular project the common way; start with angular-cli project; remove app.component.html file; add some component of our own and set up a service file to call to the backend. The initial setup might look like this -&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--dUrAruYy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-1.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--dUrAruYy--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-1.png" alt="" width="470" height="886"&gt;&lt;/a&gt;Angular project structure&lt;/p&gt;

&lt;p&gt;And the ever innocuous user-list.component.ts might look like this - &lt;/p&gt;

&lt;pre&gt;&lt;code&gt;import { Component, OnInit } from '@angular/core';
import { HttpClient } from '@angular/common/http';
import { HttpClientService } from 'src/app/http-client.service';

@Component({
  selector: 'app-use-list',
  templateUrl: './use-list.component.html',
  styleUrls: ['./use-list.component.scss']
})
export class UseListComponent implements OnInit {
  userList = [];
  constructor(client: HttpClientService) {
    client.getData("user").subscribe((res) =&amp;gt; console.log(res));
  }

  ngOnInit(): void {

  }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6nQbUUgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/is-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6nQbUUgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/is-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" alt="Tutorials_2" width="880" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;But here comes the issues. While running this project; we conveniently greeted with an error like this - &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qfUGHlU4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-2-1024x161.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qfUGHlU4--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-2-1024x161.png" alt="" width="880" height="138"&gt;&lt;/a&gt;The ever dreadful CORS error!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--otFjZTGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-3.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--otFjZTGN--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/image-3.png" alt="" width="880" height="567"&gt;&lt;/a&gt;Adding these 2 lines fixes the problem. Nice! &lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other episodes in this series:&lt;/strong&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/when-programming-tutorials-doesnt-work-part-1/"&gt;First Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-2/"&gt;Second Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-3/"&gt;Third Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-4/"&gt;Fourth Part&lt;/a&gt;&lt;br&gt;And the code is given is updated into - &lt;br&gt;&lt;a href="https://github.com/asifbuetcse/dev-test" rel="noreferrer noopener"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>dotnetcore</category>
      <category>angular</category>
    </item>
    <item>
      <title>Beyond the Tutorials: A Realistic Look at Coding in the Real World – Part 1</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Sat, 28 Jan 2023 12:06:20 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-1-2555</link>
      <guid>https://dev.to/asifbuetcse/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-1-2555</guid>
      <description>&lt;p&gt;Programming tutorials shows us a land of promise where everything happens as you think; as soon as you think. But real world doesn't work that way most of the times. Here; you spend hours debugging some CORS error or thinking why your database table Id column is not auto-incrementing. For the last 2 days; I am participating in a coding interview which spans 2 days and these series of blog is based on that experience - what am I thinking at each stage; what is the issue and how I am resolving them.&lt;/p&gt;

&lt;h2&gt;Project Requirement&lt;/h2&gt;

&lt;p&gt;I need to design a survey system. It will have 3 main screen.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Admin will create an user. User email will be unique. User will also have name, mobile, isActive field.&lt;/li&gt;



&lt;li&gt;Admin will create a survey. For simplicity, a survey will have only 3 questions. Each questions will have 4 answers. only one answer can be selected as correct answer. Each question will have one and only one correct answer.&lt;/li&gt;



&lt;li&gt;User can participate in the survey with a link from email.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The flow would be like this - User create page with user list in the bottom (with number of surveys participated) -&amp;gt; survey creation page -&amp;gt; survey list page with option to send invitation to all ACTIVE users -&amp;gt; user participating in survey. After creating a survey; in the survey list there will be option to send emails to each user with unique link (unique to each user for each survey) to take the survey. &lt;/p&gt;

&lt;p&gt;Requirement and validations:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt; Using Dot-net core (not webform or anything)&lt;/li&gt;



&lt;li&gt;Using some sort of front end technology (angular/react)&lt;/li&gt;



&lt;li&gt;Using entity framework&lt;/li&gt;



&lt;li&gt;Each survey questions will have only one answer&lt;/li&gt;



&lt;li&gt;Proper front end validation&lt;/li&gt;



&lt;li&gt;In user page; show count of surveys that an user participated&lt;/li&gt;



&lt;li&gt;Implement some sort of email gateway to send mails&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;My Initial Thinking Process&lt;/h2&gt;

&lt;p&gt;I have assumed few things that have proved costly (or wrong) down the road. For example:&lt;br&gt;I should have picked code first or database first approach. &lt;br&gt;I picked neither. &lt;br&gt;And I thought I would just create the table with SQL and bind them with rest Api project. &lt;br&gt;BIG MISTAKE.&lt;br&gt;Why?&lt;br&gt;Because then comes my second mistake. As I am not using migrations; I assumed I could just pass Entities object as DTO objects and cuts out the auto mapping portion. &lt;br&gt;But that didn't work very well.&lt;br&gt;&lt;br&gt;I didn't think about making surveys dynamic with number of questions; and for that reason my submission table is stuck with 3 answers.&lt;/p&gt;

&lt;h2&gt;Designing Database&lt;/h2&gt;

&lt;p&gt;My initial db design has 6 tables - user, survey, question, answer, invitation, submission.&lt;br&gt;And my create table script is like below:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;CREATE TABLE [user]
(
    id INT PRIMARY KEY,
    email VARCHAR(255) NOT NULL UNIQUE,
    mobile VARCHAR(15) NOT NULL,
    isActive BIT NOT NULL,
    role VARCHAR(255) NOT NULL
);

CREATE TABLE survey
(
    id INT PRIMARY KEY,
    title VARCHAR(255) NOT NULL,
    created_date DATETIME NOT NULL,
    updated_date DATETIME NOT NULL
);

CREATE TABLE question
(
    id INT PRIMARY KEY,
    survey_id INT NOT NULL,
    text NVARCHAR(MAX) NOT NULL,
    FOREIGN KEY (survey_id) REFERENCES survey(id)
);

CREATE TABLE answer
(
    id INT PRIMARY KEY,
    question_id INT NOT NULL,
    text NVARCHAR(MAX) NOT NULL,
    is_correct BIT NOT NULL,
    FOREIGN KEY (question_id) REFERENCES question(id)
);


CREATE TABLE invitation
(
    id INT PRIMARY KEY,
    survey_id INT NOT NULL,
    user_id INT NOT NULL,
    invitation_link NVARCHAR(MAX) NOT NULL,
    FOREIGN KEY (survey_id) REFERENCES survey(id),
    FOREIGN KEY (user_id) REFERENCES [user](id)
);


CREATE TABLE submission
(
    id INT PRIMARY KEY,
    survey_id INT NOT NULL,
    user_id INT NOT NULL,
    answer1 INT NOT NULL,
    answer2 INT NOT NULL,
    answer3 INT NOT NULL,
    score INT NOT NULL,
    FOREIGN KEY (survey_id) REFERENCES survey(id),
    FOREIGN KEY (user_id) REFERENCES [user](id)
);&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Can you spot any issues with this query? (Hint: not setting any identity was a huge pain in the - "ahem" - heart)&lt;/p&gt;

&lt;h2&gt;Creating Backend Project&lt;/h2&gt;

&lt;p&gt;Alongside this; I also created the backend project. From visual studio; go to create new project -&amp;gt; ASP.NET core web api -&amp;gt; an create the app (I left authentication unchecked; another mistake; it should be fairly easy to implement and almost must do for any sort of real life project) and kept the weather forecast controller. After adding services and repositories folder; the folder structure looked like this:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KdYP83hM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/Folder-Structure.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KdYP83hM--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/Folder-Structure.png" alt="" width="741" height="513"&gt;&lt;/a&gt;Folder Structure&lt;/p&gt;

&lt;p&gt;I then proceeded to add the required DTOs (and entities also; as I thought re-using them would be so easy!)&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;public int Id { get; set; }
    public int SurveyId { get; set; }
    public int UserId { get; set; }
    public int Answer1 { get; set; }
    public int Answer2 { get; set; }
    public int Answer3 { get; set; }
    public int Score { get; set; }&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class Survey
    {
        public int Id { get; set; }
        public string Title { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime UpdatedDate { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class Question
    {
        public int Id { get; set; }
        public int SurveyId { get; set; }
        public string Text { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class Answer
    {
        public int Id { get; set; }
        public int QuestionId { get; set; }
        public string Text { get; set; }
        public bool IsCorrect { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class Invitation
    {
        public int Id { get; set; }
        public int SurveyId { get; set; }
        public int UserId { get; set; }
        public string InvitationLink { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class Submission
    {
        public int Id { get; set; }
        public int SurveyId { get; set; }
        public int UserId { get; set; }
        public int Answer1 { get; set; }
        public int Answer2 { get; set; }
        public int Answer3 { get; set; }
        public int Score { get; set; }
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;The thinking process behind Submission class is that as there would only be 3 questions (from requirement); I should just save all the submission data in one class (another mistake; it stopped the system to made any change so much difficult!)&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--6nQbUUgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/is-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--6nQbUUgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://asifulhaque.com/wp-content/uploads/2023/01/is-programming-hard-a-guide-to-getting-started-in-2022-scaled-1-1024x819.jpeg" alt="Tutorials_2" width="880" height="704"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h3&gt;Adding Controllers&lt;/h3&gt;

&lt;p&gt;Then I added 2 controllers - UserController and SurveyController with read/write methods (deleted edit and delete methods as they were out of scope). But designing SurveyController posed an issue. As survey is not only survey table; but it has some questions and answers; it was interesting how to receive data from the front-end. I thought about creating a composite object to receive as I decided to use reactive form in the front end with angular. I also added 2 repository with their interface and 2 services with their interfaces for user and survey. These classes are as follows:&lt;/p&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class QuestionComposite // dto
    {
        public int SurveyId { get; set; }
        public string Text { get; set; }
        public List&amp;lt;Answer&amp;gt; Answers { get; set; }
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;namespace dev_test.DTOs
{
    public class SurveyComposite // dto
    {
        public string Title { get; set; }
        public DateTime CreatedDate { get; set; }
        public DateTime UpdatedDate { get; set; }
        public List&amp;lt;Question&amp;gt; Questions { get; set; }
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;using dev_test.DTOs;

namespace dev_test.Repositories.Contracts // repository interface
{
    public interface IUserRepository
    {
        public IEnumerable&amp;lt;User&amp;gt; GetUsers();
        public void PostUser(User user);
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;using dev_test.DTOs;

namespace dev_test.Repositories.Contracts // repository interface
{
    public interface ISurveyRepository
    {
        public IEnumerable&amp;lt;SurveyComposite&amp;gt; GetSurveys();
        public void PostSurveys(SurveyComposite survey);
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;
using dev_test.DTOs;

namespace dev_test.Services.Contracts //  service interface
{
    public interface IUserService
    {
        public IEnumerable&amp;lt;User&amp;gt; GetUsers();
        public void PostUser(User user);
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;pre&gt;&lt;code&gt;using dev_test.DTOs;

namespace dev_test.Services.Contracts //  service interface
{
    public interface ISurveyService
    {
        public IEnumerable&amp;lt;SurveyComposite&amp;gt; GetSurveys();
        public void PostSurveys(SurveyComposite survey);
    }
}&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;If you are using Visual Studio 2022; you might be seeing some warning here and there. Pay close attention to those. They are trying to tell something. &lt;br&gt;I then thought about writing the solid classes for the repo and service contracts; but then I remembered I don't have any way to connect to db or dbcontext or something like that. So I decided to add that to the project. (Will be continued ...)&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Other episodes in this series:&lt;/strong&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/when-programming-tutorials-doesnt-work-part-1/"&gt;First Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-2/"&gt;Second Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-3/"&gt;Third Part&lt;/a&gt;&lt;br&gt;&lt;a href="https://asifulhaque.com/beyond-the-tutorials-a-realistic-look-at-coding-in-the-real-world-part-4/"&gt;Fourth Part&lt;/a&gt;&lt;br&gt;And the code is given is updated into - &lt;br&gt;&lt;a href="https://github.com/asifbuetcse/dev-test" rel="noreferrer noopener"&gt;Github&lt;/a&gt;&lt;/p&gt;

</description>
      <category>programming</category>
      <category>tutorial</category>
      <category>dotnetcore</category>
    </item>
    <item>
      <title>Common Interview Questions for Sr. Software Engineers and How to Answer Them</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Mon, 26 Dec 2022 18:07:56 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/common-interview-questions-for-sr-software-engineers-and-how-to-answer-them-4mpm</link>
      <guid>https://dev.to/asifbuetcse/common-interview-questions-for-sr-software-engineers-and-how-to-answer-them-4mpm</guid>
      <description>&lt;p&gt;As a senior software engineer, you are likely to encounter a range of common interview questions during your job search regarding leadership, team management and overall skills as a leader. These questions are designed to help employers understand your technical skills, experience, and approach to problem-solving. In this article, we will provide an overview of some common interview questions for senior software engineers and offer sample answers on how to answer them effectively.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Tell me about yourself.&lt;/strong&gt;&lt;br&gt;
A: Hi, my name is [Your Name] and I have been working in the software development industry for over seven years, primarily in fintech and microfinance. I am currently a senior software developer at a large MFI company, where I lead a team of three people and am responsible for three projects. In my current role, I have gained a lot of experience in daily operation management modules and have developed strong skills in project management and team leadership. I am excited to explore new opportunities and expand my experience in different industries, which is why I am particularly interested in joining a company like yours. With my technical expertise and leadership experience, I believe I can contribute to your team and help drive the success of your projects.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Why do you want a leadership position?&lt;/strong&gt;&lt;br&gt;
A1: I have always been interested in taking on more responsibility and helping to guide the direction of projects and teams. I believe that I have the skills and experience to be an effective leader, and I am eager to use those skills to drive the success of a team and contribute to the overall success of the company. In my current role as a senior software developer, I have already taken on some leadership responsibilities, such as managing a team of three people and overseeing multiple projects. I have enjoyed the challenges and rewards of these responsibilities and believe that I am ready to take on a more formal leadership position. I am excited about the opportunity to work with a talented team and help guide them to achieve our shared goals.&lt;/p&gt;

&lt;p&gt;A2: I am interested in a leadership position because I believe that I have the necessary skills to effectively lead and motivate a team of developers. In my previous role, I gained confidence in my coding abilities and was able to offer support and advice to my colleagues who were still learning and perfecting their skills. In addition, I have always been someone who is able to meet deadlines and communicate effectively with clients, which are important qualities for a leader to possess.&lt;/p&gt;

&lt;p&gt;I believe that I am ready to take on a leadership role at this point in my career, as I have both technical expertise and the ability to guide and support my team. Throughout my experience as a developer, I have honed my programming skills and have also been able to help my coworkers troubleshoot and understand complex tasks. These experiences have prepared me to take on the responsibilities of a technical lead.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Tell me a strength of yourself&lt;/strong&gt;&lt;br&gt;
A: One of my strengths is my ability to manage multiple tasks and projects effectively. I am organized and able to prioritize my work to ensure that everything is completed on time and to the highest standard. I am also able to delegate tasks to my team members and provide clear instructions to ensure that they are able to complete their work efficiently. As a result, I have a strong track record of delivering projects on time and within budget. I believe that this strength is particularly important in a software team lead role, as it allows me to ensure that the team is working efficiently and meeting the project’s goals.&lt;/p&gt;

&lt;p&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%2F4s13zuwuj9fzceeiahm4.jpg" 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%2F4s13zuwuj9fzceeiahm4.jpg" alt="Image description" width="800" height="500"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Tell me a weakness of yourself&lt;/strong&gt;&lt;br&gt;
A1: One of my weaknesses is that I can sometimes struggle with public speaking. While I am comfortable speaking to small groups or one-on-one, I sometimes get nervous when speaking in front of larger audiences. I am aware of this weakness and have been working on it by taking public speaking classes and practicing my presentation skills. I believe that being able to effectively communicate and present ideas is an important skill for a leader to have, and I am committed to continuing to improve in this area.&lt;/p&gt;

&lt;p&gt;A2: One of my weaknesses is that I sometimes struggle to balance my focus on technical details with the broader business goals and objectives of a project. While I have a strong foundation in technical skills and am able to delve deep into the details of a task, I recognize that it is important to also consider the bigger picture and the long-term impacts of my decisions. To address this weakness, I have been working on improving my strategic thinking skills and focusing on how my work fits into the broader context of the project and the company. I am committed to continuing to develop this skill and becoming a more well-rounded and effective software team lead.&lt;/p&gt;

&lt;p&gt;We can also say that …&lt;br&gt;
A3: One area that I have been working on improving is my ability to effectively manage and mentor team members. In the past, I have struggled with finding the right balance between providing support and guidance to my team members and allowing them the autonomy to complete their work. I have found that this can be a challenge, especially when working with team members who have different levels of experience and skills. However, I am committed to continuing to learn and grow in this area, and I have been working on developing my leadership and mentorship skills. I believe that with practice and experience, I will be able to effectively manage and mentor my team members to help them grow and succeed.&lt;/p&gt;

&lt;p&gt;It is important to note that when answering this question, it is best to choose a weakness that is not critical to the role and to emphasize your efforts to improve upon it. Avoid choosing a weakness that is directly related to the job or that may disqualify you from the position.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What are your salary requirements?&lt;/strong&gt;&lt;br&gt;
A1: I am open to discussing salary and other compensation details once I have a better understanding of the responsibilities and expectations of the role. I believe that it is important to first understand the value that I can bring to the company and how my skills and experience align with the needs of the team. I am confident that we can come to an agreement that is fair and mutually beneficial.&lt;/p&gt;

&lt;p&gt;A2: I am open to discussing salary and other compensation details at a later stage in the interview process. At this point, I am more focused on learning more about the role and the company and understanding how I can contribute to the team’s success. I am confident that we can come to a mutually beneficial agreement once we have had the opportunity to discuss the details of the position in more depth.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What is your experience with project management?&lt;/strong&gt;&lt;br&gt;
A: Although I have not yet had the opportunity to lead a development team or project, I have had some experience with project management as part of my work on the large system development project for a microfinance institution in Bangladesh. In this role, I was responsible for managing my own work and ensuring that it was completed on time and to the required standards. I also had to coordinate with other team members and communicate effectively with stakeholders to ensure that the project was delivered successfully. These experiences have helped me to develop my organizational and time management skills, as well as my ability to communicate effectively and work collaboratively with others. I believe that these skills will be valuable as I take on more responsibilities in a software team lead role.&lt;/p&gt;

&lt;p&gt;In my last role, I was responsible for guiding a team of five software engineers on several large-scale projects. I had the opportunity to develop my project management skills by leading weekly meetings, breaking down tasks into smaller objectives, and ensuring that we met our deadlines. This experience helped me to develop strong communication and organization skills, which are essential for success in a software team lead role. I am confident in my ability to manage projects and teams effectively, and I am always looking for ways to improve my skills and knowledge in this area.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Tell me about a time you made a mistake. What did you learn from it?&lt;/strong&gt;&lt;br&gt;
A: One time, I made a mistake while working on a project that involved integrating a new piece of software with an existing system. I was also responsible for managing the UAT database, and during the development process, I accidentally deleted some data from the database while working on it. This caused delays in the project and required us to restore the data from a backup.&lt;/p&gt;

&lt;p&gt;I learned a valuable lesson from this experience about the importance of being careful and cautious when working with sensitive data. I also learned the importance of double-checking my work and seeking guidance from my team members or manager if I am unsure about something. This mistake helped me to develop a more thorough and careful approach to my work, and I believe it has made me a better developer as a result.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: Describe how you would handle a situation if you were required to finish multiple tasks by the end of the day, and there was no conceivable way that you could finish them.&lt;/strong&gt;&lt;br&gt;
A: If I were faced with a situation where I had to finish multiple tasks by the end of the day, and there was no conceivable way that I could finish them, I would first assess the priorities of the tasks and determine which ones are most important to complete. I would then communicate with my manager or team members to explain the situation and seek their guidance on how to proceed. It may be necessary to reevaluate the timeline for the tasks or to reassign some of the work to other team members in order to ensure that the most important tasks are completed on time.&lt;/p&gt;

&lt;p&gt;Regardless of the outcome, I would make sure to document the situation and the actions that were taken to address it, as this will help to prevent similar issues from occurring in the future. I believe that effective communication and problem-solving are key to handling situations like this, and I would work with my team to find a solution that minimizes the impact on our overall project goals.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Q: What Did You Like Least About Your Last Job?&lt;/strong&gt;&lt;br&gt;
A: There were a few things about my last job that I found challenging, but I believe that these challenges ultimately helped me to grow and develop as a professional. For example, I found that the workload at times was quite heavy, and there were times when I felt overwhelmed by the number of tasks that I had to complete. However, I learned to manage my time more effectively and to prioritize my work in order to meet my deadlines.&lt;/p&gt;

&lt;p&gt;Overall, I believe that my last job provided me with valuable experience and helped me to develop important skills that will be valuable in my future career. While there were certainly challenges, I am grateful for the opportunity to have worked with such a talented team and to have contributed to the success of the company.&lt;/p&gt;

&lt;p&gt;Common interview questions for senior software engineers often focus on your technical skills, experience, and problem-solving abilities. By being prepared to answer these questions effectively, you can demonstrate your value as a candidate and increase your chances of landing the job. By highlighting your strengths and providing clear and concise examples of your work, you can show potential employers that you are the right fit for their team.&lt;/p&gt;

&lt;p&gt;Read the full article here: &lt;a href="https://asifulhaque.com/common-interview-questions-for-sr-software-engineers-and-how-to-answer-them/" rel="noopener noreferrer"&gt;Common Interview Questions for Sr. Software Engineers&lt;/a&gt;&lt;/p&gt;

</description>
      <category>career</category>
      <category>management</category>
    </item>
    <item>
      <title>Polymorphism Deep Dive: Single vs Double Dispatch</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Sat, 24 Dec 2022 10:23:21 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/polymorphism-deep-dive-single-vs-double-dispatch-4kg4</link>
      <guid>https://dev.to/asifbuetcse/polymorphism-deep-dive-single-vs-double-dispatch-4kg4</guid>
      <description>&lt;p&gt;Runtime polymorphism or dynamic method dispatch is a feature of object-oriented programming languages that allows a subclass or derived class to provide a different implementation for a method that is already defined in its superclass or base class. This is achieved by creating a method with the same name and signature in the derived class as in the base class, and then replacing or “overriding” the implementation of the method in the derived class.&lt;/p&gt;

&lt;p&gt;At runtime, when an object of the derived class is created and a method is called on it, the object will execute the overridden version of the method rather than the one inherited from the base class. This allows the derived class to customize the behavior of the method to suit its own needs, while still maintaining the same interface as the base class.&lt;/p&gt;

&lt;p&gt;For example, consider a base class called “Shape” that has a method called “area” that calculates the area of the shape. A derived class called “Rectangle” might override the “area” method to provide its own implementation that calculates the area of a rectangle using the length and width of the rectangle. When an object of the “Rectangle” class is created and the “area” method is called on it, the object will execute the overridden version of the method, which calculates the area of a rectangle.&lt;/p&gt;

&lt;p&gt;In this way, runtime polymorphism allows an object to behave differently based on its type, even if the object is referred to through a base class reference. This can be useful for creating more flexible and reusable code, as it allows different types of objects to be used interchangeably without the need to write separate code for each type.&lt;/p&gt;

&lt;p&gt;Read the full article here ...&lt;br&gt;
&lt;a href="https://asifulhaque.com/polymorphism-deep-dive-single-double-and-multiple-dispatch/" rel="noopener noreferrer"&gt;Polymorphism - Md Asiful Haque&lt;/a&gt;&lt;/p&gt;

</description>
      <category>chatgpt</category>
      <category>openai</category>
      <category>ai</category>
    </item>
    <item>
      <title>Simple tips on how (not) to plan a project</title>
      <dc:creator>asifbuetcse</dc:creator>
      <pubDate>Thu, 08 Dec 2022 11:17:12 +0000</pubDate>
      <link>https://dev.to/asifbuetcse/simple-tips-on-how-not-to-plan-a-project-55k1</link>
      <guid>https://dev.to/asifbuetcse/simple-tips-on-how-not-to-plan-a-project-55k1</guid>
      <description>&lt;p&gt;Have you been recently put in charge of a big software project?&lt;br&gt;
May be you have been given a large team, a long list of stakeholders and some pretty complex subsystems to develop and you are feeling that butterfly in the stomach?&lt;br&gt;
May be you wished that a perfect tipsy topsy timeline milestone oriented project plan would fall from the sky right in to your lap?&lt;br&gt;
But that’s not possible at all, is it? So you have to buckle up and do it yourself, unfortunately! project management is not difficult or scary after all.&lt;br&gt;
Here some of the tips of how (not) to do that!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not identifying the capability of each resources&lt;/strong&gt;: After all; you have recruited them saying that they must all be “full stack” developers, right? Who cares if one of them is better in front end and someone else is prolific in backend? If the job description says they have to be “full stack”, they have to be “full stack”!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Focusing on technology rather than the user need&lt;/strong&gt;: We are a software company. Our holy target is to practice and implement latest and greatest technologies and trends there is! Who cares about what the end users are hoping for and at what timeline? What do they know about latest industry trends; right? Do they have any idea how much their prestige would go up if the project have latest untested beta version of the framework which might increase the project time by 30-50%?&lt;br&gt;
Absolutely not!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Not allocating time for refactoring&lt;/strong&gt;: Refactoring is for the weak! The alpha developers just write the code on top of old code and it works? Besides; we are not going to stay at this company forever; right? So what if the next guy that comes after me pull out his/her hair in agony while fixing bug in my code? Tough luck! Besides; the time that we spend on ultra super cutting edge technology just crept on us and now the customer demands to finish the project in such a short period of time! They are pissed that we already extended the deadline 3 times and now they are not that happy. Ain’t nobody got time for refactoring now!&lt;/p&gt;

&lt;p&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%2Fyby51fyis8p32dh0lq2h.jpg" 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%2Fyby51fyis8p32dh0lq2h.jpg" alt="Image description" width="800" height="576"&gt;&lt;/a&gt;&lt;br&gt;
&lt;strong&gt;Change plan, team, expectations and deadlines whenever needed&lt;/strong&gt;: World is unpredictable; so are we and our project planning! If we can’t score in normal way; we just have to move the goalpost a little bit. What’s the harm in it, right?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Throw more resources at a problem rather than fixing it&lt;/strong&gt;: If 1 women can deliver a baby in 10 months; shouldn’t 10 women be able to do it in a month?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Micromanage the hell out of everything&lt;/strong&gt;: What is the benefit of trusting your team and delegating responsibility when you can micromanage each and every thing and paying the price down the road?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Take the big decisions all by yourself&lt;/strong&gt;: While planning with everyone is a viable option; we can also take each big decisions; like project deadline, resources, technologies, challenges, risk factors etc; by ourselves also. What is the point of taking suggestions from someone who can’t think and express themselves like us; right?&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Meetings each day; everyday&lt;/strong&gt;: Talking is fun! Giving motivational speech is more fun! Talking about productivity in each day meeting is even more fun and intuitive! And meeting without clear agenda and points? Oh, boy! They are just heavenly. May be we could order some snacks and lunch (or dinner) for the meeting so we can kill more time together!&lt;br&gt;
Sounds fun!&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Point fingers&lt;/strong&gt;: What’s more fun than meeting each day is delivering blame, guilt and personal judgement. Who needs to focus on the result and teams and process and motivations when we can just sit around a table and point fingers to each other?&lt;/p&gt;

&lt;p&gt;all in all, project management is a child’s play. In the end; just focusing on you rather than the team, people, process and organization is a surefire way to make a project a massive success!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://asifulhaque.com/project-management-how-not-to-plan/" rel="noopener noreferrer"&gt;Read the full article here....&lt;/a&gt;&lt;/p&gt;

</description>
      <category>watercooler</category>
    </item>
  </channel>
</rss>
