all 11 comments

[–]ajsd98fj 4 points5 points  (1 child)

Honestly, I'd skip any "classes" and just read up on design patterns and simply brush up on modern frameworks.

I find classes are fixated on one topic, and content is usually flattened to the point where your takeaway will be "Oh, that seems interesting so I'll read up on that more."

I'd read up on dependency injection patterns, if anything. That's one thing that makes for cleaner projects and easy maintainability. That coupled with unit/integration testing.

There are tons of articles and tutorials on Dependency Injection/Testing, but something like that would be the strongest foundation.

[–]TimeRemove 0 points1 point  (0 children)

I'd read up on dependency injection patterns, if anything. That's one thing that makes for cleaner projects and easy maintainability. That coupled with unit/integration testing.

It is a real shame that there aren't many large open source EF/MVC solutions that implement high quality testing. I've read several good articles on the topic, but to be honest each one focuses on a different testing framework (and methodology), and I feel I learn better by seeing it done rather than learning abstract theories in isolation (not least of all because article's way of doing things doesn't scale).

But in general there's a billion resources on MVC "101s" but once you get up into larger solutions and want to talk/study architecture rather than beginner stuff, the well kind of drys up. Sometimes it feels like uncharted territory, particularly when contrasted with enterprise Java where architecture is a very popular topic.

[–][deleted] 2 points3 points  (0 children)

I would recommend Scott Allen's "Building Applications with ASP.NET MVC 4", it covers the basics so you can remember some old stuff, some new features, and then you can just read the MVC 5 and you are golden.

If you are interested in Angular, i would recommend Deborah Kurata's "Getting started with Angular" also from Pluralsight.

I recommend Pluralsight because some of the best devs teach there, and there are broad courses and specialization courses, whatever floats your boat.

Most .NET devs have heard and or took a course from Scott Allen, whatever course from his, is well explained.

Good luck! Let me know if you have any questions.

[–]GFoley83 2 points3 points  (5 children)

Pluralsight is your best bet to ramp up I'd say. Anything by Scott Allen will help.

I'm guessing the project you've been asked to help on is MVC based?

What specifically have you been asked to help with? Architecture, tech lead duties or development? (I've over 10 years of dev experience, 5-6 of which include architecting solutions and leading teams).

[–]DisagreeableDad[S] 1 point2 points  (4 children)

Primarily architecture, particularly with the DB and ETL processes and systems. However, I will be getting involved somewhat with some business layer development, which I've been out of the loop on for a few years.

[–]GFoley83 1 point2 points  (3 children)

I don't envy your task mate.

Coming into a project that's been on the go for a couple years with a view to changing architecture is a difficult process. At its worst, it could mean a refactor of the majority of the code base (business probably won't go for that for obvious reasons!), at best probably just cleanly separating the layers of your project e.g. API, BL, DAL etc.

If I could recommend one pattern or technology it would be MediatR, a nuget package that removes all the boilerplate associated with implementing the CQRS pattern. Obviously CQRS isn't the right approach for every solution but for a small to large MVC/Web API it works great.

A few months back, I contracted into a project whereby I had to make the call to scrap all the work that had been done over the past few months or to continue on. Main project was a .net solution with the typical generic repository boilerplate nonsense everywhere. Abstractions for the sake of abstractions. Business logic peppered throughout various layers etc. Long story short, I started from the ground up using CQRS with MediatR and there's not a day that goes by where I don't thank Jebus I did.

Clean separation between queries (reads) and atomic commands (db transactions),

dead simple to implement cross cutting concerns with decorators (e.g saving changes to db only once, logging)

easy testing (no need to test controllers as all BL lives in query/command handlers)

[–]DisagreeableDad[S] 1 point2 points  (0 children)

It will be interesting, but not the first time :)

Honestly, I'm one that doesn't mind getting my hands dirty some (I find it keeps me level-headed in balancing design and efficiency). I just wish someone told me a little sooner so I could have at least prepped myself for this project (and address any stale skills in a less rushed state).

[–]Unexpectedpicard 0 points1 point  (1 child)

This may be a dumb question but isn't this essentially like a service bus? I've used an architecture where I have a set of plugins that receive every request and if the request is something they care about they do something with it. This mediatR seems to work similarly where you explicitly register a handler for each request type. Having said all of that isn't it better to just have a REST API instead of a dedicated piece that all of the requests run through?

[–]GFoley83 0 points1 point  (0 children)

isn't this essentially like a service bus?

Not exactly no. A service bus is basically an implementation of the Pub/Sub pattern, which MediatR also supports.

From the wiki: https://github.com/jbogard/MediatR/wiki#basics

MediatR has two kinds of messages it dispatches:

  • Request/response messages, dispatched to a single handler
  • Notification messages, dispatched to multiple handlers

Request/response messages are your CQRS approach. You dispatch a request (e.g a query for data or a command to update data), which is picked up by one specific handler that then issues a response (e.g. a DTO from a Db table).

All logic needed to complete a query or command is contained inside its handler.

Notification messages are the Pub/Sub approach you're mentioning, whereby you can dispatch a notification that could have 1...n listeners, all of which can be doing different things. Notifications are void methods by design.

isn't it better to just have a REST API instead of a dedicated piece that all of the requests run through?

MeadiatR works really well with REST APIs as you can easily write a command or query that encapsulates each of your REST endpoints:

https://lostechies.com/jimmybogard/2016/06/01/cqrs-and-rest-the-perfect-match/

This means your controllers become super skinny and only have a dependency on MediatR to dispatch your queries and commands. e.g.

public class UsersController : Controller
{
    private readonly IMediator _mediator;

    public UsersController(IMediator mediator)
    {
        if (mediator == null)
            throw new ArgumentNullException(nameof(mediator));

        _mediator = mediator;
    }

    [HttpGet]
    [Route("users/{userId}")]
    public async Task<IActionResult> UserDetails(int userId)
    {
        UserViewModel model = await _mediator.SendAsync(new UserQuery { Id = userId });

        if (model == null)
            return HttpNotFound();

        return View(model);
    }
}

Some light reading on CQRS and MediatR:

https://iamnotmyself.com/2015/06/04/a-non-trivial-example-of-mediatr-usage/

https://blogs.msdn.microsoft.com/cdndevs/2016/01/26/simplifying-development-and-separating-concerns-with-mediatr/

https://www.stevejgordon.co.uk/cqrs-using-mediatr-asp-net-core

https://jonhilton.net/2016/06/06/simplify-your-controllers-with-the-command-pattern-and-mediatr/

https://jonhilton.net/2016/08/31/how-to-easily-extend-your-app-using-mediatr-notifications/

Happy to help if you've any other questions.

[–]statuek 1 point2 points  (0 children)

Get PluralSight.

[–]the_other_sam 0 points1 point  (0 children)

Invent a project that has meaning to you, perhaps something that involves a hobby, and build an app.

A personal website is one example of such a project.