The Right way to write Nest.js & Typescript clean-code - SOLID

preview_player
Показать описание


⭐ Timestamps ⭐
00:00 Intro
01:18 SRP - Single Responsibility Principle
04:51 OCP - Open-Closed Principle
08:20 LSP - Liskov Substitution Principle
11:59 ISP - Interface Segregation Principle
14:24 DIP - Dependency Inversion Principle

📕S.O.L.I.D blogs to get a better grasp on the principles

-- Special Links

✨ Join Figma for Free and start designing now!

👉 ✨ Join Figma For Professionals And Start Designing with your Team ✨

-- Watch More Videos

🧭 Build Login/Register API Server w/ Authentication | JWT Express AUTH using Passport.JS and Sequelize

🧭 Turn Design into React Code | From prototype to Full website in no time

🧭 Watch Tutorial on Designing the website on Figma

🧭 Watch Create a Modern React Login/Register Form with smooth Animations

🧭 Debug React Apps Like a Pro | Master Debugging from Zero to Hero with Chrome DevTools

🧭 Master React Like Pro w/ Redux, Typescript, and GraphQL | Beginner to Advanced in React

🧭 Learn Redux For Beginners | React Redux from Zero To Hero to build a real-world app

🧭 Introduction to GraphQL with Apollo and React

Made with 💗 by Coderone
Рекомендации по теме
Комментарии
Автор

Loved the explanations and everything. Quick thing to add and probably a lot of users do it differently. Using your service as the "Business layer" doesn't mean you write bad code or not clean code. My humble opinion is that, "controllers" should take care only for input and output of the application, nothing else. Service is actually the business part and the clean code should be there. You have to think also about the architecture and controllers should not do business logic. Ofc repository, dao or whatever for the data layer.

Keep with the great stuff :)

ivanvelinov
Автор

I really love this NestJS series. Please keep going!!

permanar_
Автор

I think logic is not handled on the controller, the controller only forwards requests from view to service and receives response and forwards to view.

cheng
Автор

Fantastic way of teaching these concepts and one I have hoped to see for years now: real world issues people create constantly, why they are mistakenly created, how to avoid them, and how best practices (SOLID, etc.) guide us to avoid making such mistakes along the way to creating more composable code. Thank you for the video!

reidyoung
Автор

Thank you for including good and bad examples! By far the best way for me to learn

TheBeastDispenser
Автор

It's the first time I see an exemple of Record type in real world, thank you!

miguecast
Автор

that was facinating. please provide more nestjs videos

abolfazljalildoost
Автор

Amazing as always, thanks for the tips!

MichelVersianiDev
Автор

nice bro please keep updating us with your awesome knowledge about backend specially nest js

wfmomxk
Автор

very helpful. thank you and keep doing great stuff

mohamedsba
Автор

I am confused with example on GitHub for open closed principle. Should we call registerPaymentGateway in controller? Will this object (paymentGateway) always have only 1 payment method at a time? I thought paymentGateways (the one in paymentService) should have all our relative payments options inside the object, so that when we call processPayment it checks payment method against the one we have. I am just confused the way it’s organised in your GitHub repo) I didn’t even see where you are calling processPayment Method in your code

georgy
Автор

Great content, really learnt alot from this video

danielosariemen
Автор

Dude you are very amazing developer, I was just looking around to improve my coding structure and make it more readable, reusable and maintainable, This is the video anyone who wants to look first before writing nest js code. Thank you!!

yohanneskindu
Автор

Excelente video. Just a comment, at 4:09 ordersService should only receive a DTO, how the service implements the solution is not concern to the controller.

CharlesDv
Автор

basically OCP, LSP and DIP are very similar, as per video in OCP payment methods can be added, LSP different payment strategy can be used, and DIP allows using one line to switch between different class implementations, all examples are pretty close to each other

EllisDosAU
Автор

In OCP you can extend if the subclass is the same as the base class but with an added functionality. e.g A cock is a bird that can crow. Cock class can extend the bird class which has the fly functionality and then implement its own crow functionality.

geebsayshi
Автор

amazing, thanks for the tips. +1 subs

muhammadsalmanagustian
Автор

Would love to see a good course of Nest.js with these clean-code - SOLID principles.

belkocik
Автор

Nice video man. However, I prefer to use extend, and then make the method in the base class an abstract method as well.

ubonginyang
Автор

Good video. Since the PaymentGateway and StorageFactory do not share code across their respective implementations, they would be better suited as interfaces as opposed to abstract classes. A good general rule to follow is that, if there is a need to share code across multiple implementations use an abstract class to achieve this, otherwise an interface is all you need.

craigsmith