Refactoring JavaScript with pipeline style programming

  Рет қаралды 14,843

Dev Mastery

Dev Mastery

Күн бұрын

Пікірлер: 34
@DevMastery
@DevMastery 5 жыл бұрын
Did you learn something new? What would you like to see next?
@antoinelb8509
@antoinelb8509 5 жыл бұрын
This question is not about code but more of a lead dev position: You are a experience developer that has being called by a company that is having a hard time with the codebase. The entire project has been done by inexperienced developers, and to put it in a simple way everything is bad about the code; messy, inexplicable bugs, no documentation, no tests... a total mess. The thing is that the app is quite a big and is already running in production with third parties relying on this program. So the question(s) would be: what are the first things your are gonna look for? what are the things that will shape the most your decisions? what would you recommend anyone to do? has this happened to you? Is starting from scratch the entire project an option you would consider? advice for companies to avoid ending up there? or any thing else you want to share about it I believe it would be very interesting. Thanks, I'm following your videos from very close
@DevMastery
@DevMastery 5 жыл бұрын
Thanks for your question. I wrote an article called “How to Conquer Legacy Code” that touches on a lot of the topics you’ve raised. Here’s a link: link.medium.com/EcrEQ344ZT I hope you find it useful. I’ll also look for opportunities to talk more about this in upcoming videos. In the meantime, to answer some of your questions more directly. As a consultant, I face the situation you’re describing very often. In fact, I’ve had clients hire me specifically to deal with this kind of problem. Completely throwing away and replacing a mission critical app is rarely practical or even possible; no matter how satisfying we think it might feel. So, in my experience, the winning strategy (as I described in that article) is one of incremental improvement. Every time you touch the code to fix a bug or add a feature, you need to leave the code in better shape than you found it. Sometimes that’s just a matter of a simple refactor and a bit of documentation, other times it requires you to build new features in a way that is decoupled from the legacy code and connect them via an adapter pattern or microservice, so that you’re effectively replacing the app in small increments. Hope that help.
@antoinelb8509
@antoinelb8509 5 жыл бұрын
​@@DevMastery Amazing article, Thanks!
@wsh4and
@wsh4and 5 жыл бұрын
@@antoinelb8509 This is exactly what I am facing right now :). But instead of developing from a current project, I am tasked with migrating a desktop app to a totally new web app with a mess code from the desktop app!
@LindseyandCaleb
@LindseyandCaleb 2 жыл бұрын
I found your channel and have been watching and rewatching everything you've posted. I looks like you've retired this project but thank you for what you have. As someone who is entry to mid level and hasn't seen much production code, these videos are extremely valuable and will help me level up. I'm a fan and I hope you start posting again!
@DevangPatil
@DevangPatil 3 жыл бұрын
11.09 can't we do it using method chaining?
@jacsurfing
@jacsurfing 5 жыл бұрын
please make a video about. RabitMQ or Kafka in NodeJS
@helmialfathseptiana6383
@helmialfathseptiana6383 4 жыл бұрын
this is truly gold.
@pablocba90
@pablocba90 3 жыл бұрын
really good example!
@afiiiiiii
@afiiiiiii 5 жыл бұрын
man i have been in ur newsletter for years, ur the best, love what u r doing!
@DevMastery
@DevMastery 5 жыл бұрын
Thanks!
@KrishnaList
@KrishnaList 2 күн бұрын
Register dependency with IOC and resolve runtime
@nromancarcamo
@nromancarcamo 5 жыл бұрын
I'm writing my code in sort of imperative + FP but more FP using currying to have referential transparency and now I'm adapting the code to pipelines style and it looks really well, hell that operator will change my code style a lot, can't wait!.
@radvilardian
@radvilardian 4 жыл бұрын
Hey man, thank you so much for this piece of tutorial. You're so awesome.
@enzoferey
@enzoferey 5 жыл бұрын
Hi there ! Unfortunately, I’m never able to make it to the live, but this show is in my weekly TODO list every week :) Already shared it on Twitter and I have been subscribed to your newsletter for a while, hope more people will come to learn. Thank you !
@DevMastery
@DevMastery 5 жыл бұрын
Thanks Enzo! I hope to see you next Monday.
@benpurcell591
@benpurcell591 4 жыл бұрын
Good stuff, I like the way you code
@amazekhashaa7309
@amazekhashaa7309 3 жыл бұрын
Did you use face powder?
@producdevity
@producdevity 5 жыл бұрын
Great explanation! One comment, if I'm not mistaking your custom pipe function wouldn't work if the promise returns a falsy value. Maybe a video that expands on this would be something to consider since this is a very interesting topic!
@producdevity
@producdevity 5 жыл бұрын
Oh I think it probably does work since the value is wrapped in a promise. Not sure tho
@DevMastery
@DevMastery 5 жыл бұрын
+Yassine Gherbi it doesn’t evaluate the promise it just checks for the existence of a “then” property which is always truthy in the case of a promise.
@BertoldSzekeres
@BertoldSzekeres 3 жыл бұрын
I like this pipe method, it's kinda how mongo queries work. You could also have created a class for the process and chain the class methods together. Nice video btw, well explained!
@ayoubhr77
@ayoubhr77 4 жыл бұрын
Im a novice to programming and this was really easy to grasp thank you!!
@alexanderommm
@alexanderommm 4 жыл бұрын
Why don't you check situations when there is no string?
@marcusbrsp
@marcusbrsp 4 жыл бұрын
Good stuff, keep it up! Is that a Boston dialect btw?
@sweetfigs1
@sweetfigs1 4 жыл бұрын
great topic
@igor_cojocaru
@igor_cojocaru 5 жыл бұрын
Thank you for useful tips!
@thatchipmunksings
@thatchipmunksings 4 жыл бұрын
Aren't functions in general expensive? As in it would require far jump in assembly level instead of the regular stepwise flow to invoke and execute a function. But then again, our systems have become significantly faster than when this was a concept to care about. Also it would be a performance vs quality trade off. But I would like to hear your opinion on this point.
@jurepustoslemsek7882
@jurepustoslemsek7882 3 жыл бұрын
this is only a concern if you're a C programmer that develops for old embedded microcontrollers. and even then, many function calls are inlined by the compiler, so that they execute as if the function wasn't there. I even read somewhere that trying to manually minimize the number of function calls could actually make your code run slower, not faster. it's always better to write quality code first, and only optimize later if it turns out that it's causing performance problems
@thatchipmunksings
@thatchipmunksings 3 жыл бұрын
@@jurepustoslemsek7882 makes sense! Thank you
@fatphilg
@fatphilg 3 жыл бұрын
Very clear explanations, thank you. I noticed you're using something that evaluates your javascript after each line (or keypress?). Is that just you debugging in the browser console?
@DevMastery
@DevMastery 3 жыл бұрын
I used a little app called RunJS for this video, which I like for quick experiments. runjs.dev
@fatphilg
@fatphilg 3 жыл бұрын
Cool. I’ll give it a shot! Thanks.
The Ultimate Coding Workflow
20:26
Dev Mastery
Рет қаралды 18 М.
Being Competent With Coding Is More Fun
11:13
TheVimeagen
Рет қаралды 81 М.
The Joker wanted to stand at the front, but unexpectedly was beaten up by Officer Rabbit
00:12
отомстил?
00:56
История одного вокалиста
Рет қаралды 7 МЛН
Brawl Stars Edit😈📕
00:15
Kan Andrey
Рет қаралды 56 МЛН
Javascript Code Review - Reviewing and Refactoring Students Code
15:05
Monsterlessons Academy
Рет қаралды 4,6 М.
The purest coding style, where bugs are near impossible
10:25
Coderized
Рет қаралды 977 М.
JavaScript Visualized - Closures
11:34
Lydia Hallie
Рет қаралды 41 М.
When should you refactor larger React components into smaller ones
8:50
JavaScript Promises  -- Tutorial for Beginners
37:05
ColorCode
Рет қаралды 124 М.
The Weird History of JavaScript
12:09
Fireship
Рет қаралды 1,2 МЛН
5 MUST KNOW JavaScript Object Functions
10:42
dcode
Рет қаралды 28 М.
Premature Optimization
12:39
CodeAesthetic
Рет қаралды 810 М.
Node.js is a serious thing now… (2023)
8:18
Code With Ryan
Рет қаралды 650 М.