Tips on how to better test your feature and on working on a new project!

When you're working on a new feature in a new project or a legacy one, here are some tips to help you. #csharp #dotnet #angular #rubyonrails #testing #writing

Computer
Photo by Dell / Unsplash

Don't test with a single User

One testing tip I find helpful when developing a new feature is to test it with different types of users.

Sometimes we have the tendency to focus only on one use case with a single user and neglect side effects.

Different users usually have different types of access rights that we might not take into account not only when designing user stories but also during development itself.

E.g. assume user X has the access right for feature A but user Y doesn't. When the latter logins, there's a null message that's displayed when in reality the page or component itself shouldn't be accessible.


How to start working on a new / legacy project?

I'm working on a project whereby a few features are being ported from a previous application, which is an ASP.NET MVC project. I don't have much experience developing with this structure but for me, a good start is simply to understand how the project is structured.

I've previously worked extensively with Ruby On Rails. I, therefore, understand the Model View Controller (MVC) design pattern completely - particularly the importance of separation of concerns - and how everything is connected to each other.

For example, what's the purpose of the App_Data and App_Start directories?

You can read more on the sites below:

MVC Folder Structure

https://www.tutorialsteacher.com/mvc/mvc-folder-structure


Controllers

If you need to start working on a web project, where do you begin? I think the simplest way is to start with the controllers esp. in MVC projects. Controllers are normally simple enough to illustrate what's going on without getting bogged down with Presentation / View Layer codes or the Business Logic residing in services or utility classes.

You can also get a good idea of the general process (if any) by checking the base classes for example an overridden base controller.

Here's an example from eShopOnWeb:

https://github.com/dotnet-architecture/eShopOnWeb

[HttpGet]
public async Task<IActionResult> MyOrders()
{   
    Guard.Against.Null(User?.Identity?.Name, nameof(User.Identity.Name));
    var viewModel = await _mediator.Send(new GetMyOrders(User.Identity.Name));

    return View(viewModel);
}

Get Citation feature using Grammarly

During dev meetings, I often come across new terms or those that I've previously forgotten due to the vastness of the world of Computer Science, Mathematics and Information Systems.

This time my colleague mentions "Magic String". On reading on Wikipedia, I notice this Get citation widget with the Grammarly icon. Intrigue, I click on it. And it works.

One of the top features using Grammarly:

I click on "Get citation":

You can even switch between APA, MLA & Chicago.

I think it's a must-have tool for students and researchers.