CodeOpinion
CodeOpinion
  • 312
  • 5 290 397
Never rewrite code?
Is it a bad idea to rewrite code or an entire system? As developers at some point we want to rewrite for various reasons. Often times it's because we simply don't understand the existing codebase or think it's a tire fire. But is the benefit there? Sometimes, yes. Sometimes, no. It's a pretty nuanced topic around cost/benefit.
🔗 EventStoreDB
eventsto.re/codeopinion
🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html
💥 Join this channel to get access to a private Discord Server and any source code in my videos.
🔥 Join via Patreon
www.patreon.com/codeopinion
✔️ Join via UA-cam
ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.htmljoin
📝 Blog: codeopinion.com
👋 Twitter: codeopinion
✨ LinkedIn: www.linkedin.com/in/dcomartin/
📧 Weekly Updates: mailchi.mp/63c7a0b3ff38/codeopinion
Переглядів: 5 765

Відео

OpenAPI with a sprinkle ✨ of Hypermedia
Переглядів 6 тис.19 годин тому
OpenAPI is great for describing your HTTP API. It's used at design time when you're developing to understand how interact with an HTTP API. But on the other side is more runtime considerations that allow evolvability with Hypermedia. Here's how to use both. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get access to a ...
You're not as loosely coupled as you think!
Переглядів 6 тис.14 днів тому
When you hear tight coupling or being loosely coupled, what does that even mean? There are many aspects to coupling that you need to think about. Temporal, Data Schema, Location, Technology. Removing one aspect usually involves having to deal with a whole new set of problems. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel ...
My First look at .NET Aspire. What's with the Hype?
Переглядів 12 тис.21 день тому
Follow along as I take a look at .NET Aspire. I've been hearing a lot about it, but is it worth the hype? Good question! I haven't used it or really read much about it in detail so here's my first look and first impressions. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get access to a private Discord Server and any so...
Your customers don't care about JS
Переглядів 11 тис.Місяць тому
Your customers do not care about the technology behind your app. What programming language, frameworks, libraries, or whatever tooling you're using, they don't care. They care about it providing them value and that it has certain characteristics. They want it to work. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get a...
One concept plaguing software architecture and design (Part 3)
Переглядів 6 тис.Місяць тому
Is all the chaos with microservices and "modular" monoliths really because there's a lack of distinction between logical and physical boundaries. I think so. The industry and software architecture as a whole would be better served making this distinction rather than trying to force a one-to-one or abstracting network calls and pretending the coupling doesn't exist. 🔔 Subscribe: ua-cam.com/chann...
HTTP APIs don't magically remove Coupling (Part 2)
Переглядів 4,3 тис.Місяць тому
What used to be a method call in-process turned into an HTTP call over the network. You have the same amount of coupling. Possibly worse off because you've now introduced the network. All for the need to deploy independently. Did you really have that need? 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get access to a private Discord Server and any source co...
Did we learn anything from Microservices? (Part 1)
Переглядів 7 тис.Місяць тому
The industry moved from monoliths to microservices. Now we're in full swing back to a modular monolith. Has the industry learned anything along the way? Or is it just a bunch of over correction because we're not focusing on the actual problems. I'm joined by William Brander from Particular Software (makers of NServiceBus) to talk about all of this and more! 🔔 Subscribe: ua-cam.com/channels/3RKA...
HTMX: What's Old is New Again
Переглядів 15 тис.Місяць тому
What's old is new again, kind of. HTMX fits into that motto for me and it's getting pretty popular, but at the same time It gets a lot of pushback. I'm going to take a step back and explain how we got to where we are in current web dev, which will explain what HTMX is. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get ...
API Error Messages for a GOOD Developer Experience
Переглядів 8 тис.Місяць тому
Debugging and troubleshooting are a big part of a developer's day-to-day. Because of this, when designing your APIs, provide good API error messages as well as guide developers down a path of success and makes it easier for them to understand issues when they need to troubleshoot. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this cha...
Web-Queue-Worker Architecture Style for Scaling
Переглядів 10 тис.2 місяці тому
Web-Queue-Worker is an excellent architecture pattern you can add to your toolbox. It's just a pattern and can work with a monolith, modular monolith, microservices, or whatever. It provides many benefits for scaling by moving work into the background and if you have long-running jobs, workflows, or even recurring batch jobs. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channe...
Keep your project structure simple!
Переглядів 16 тис.2 місяці тому
What should your project structure look like? How should you structure and organize your HTTP APIs? Here's one way by Jono Williams and my thoughts and insights about some misconceptions about Domain Driven Design. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get access to a private Discord Server and any source code ...
Debunking Kafka Top 5 Use Cases
Переглядів 15 тис.2 місяці тому
Infographics are easy and quick to look at and they are posted everywhere. But are they actually correct? Not really. Here's an example of the "Top 5 use cases for Kafka" that aren't actually valid use-cases at all. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get access to a private Discord Server and any source code...
Event Sourcing Core Concepts
Переглядів 7 тис.3 місяці тому
What is event sourcing? Often, many terms are thrown around that can be pretty confusing. I will explain the core concepts and the terminology used around Event Sourcing so you can better understand what it is and what some of the benefits might be. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 Join this channel to get access to a private ...
My WORST Mistakes as a Software Developer
Переглядів 9 тис.3 місяці тому
Drop a database by accident? Write some horrible bug that caused all sorts of issues? Sure but that's not the one's that had the most significant impact on the code I write. The worst mistakes as a software developer are the ones that blinded my thought about how to write and design software. 🔗 EventStoreDB eventsto.re/codeopinion 🔔 Subscribe: ua-cam.com/channels/3RKA4vunFAfrfxiJhPEplw.html 💥 J...
Feature Flags are more than just Toggles
Переглядів 11 тис.3 місяці тому
Feature Flags are more than just Toggles
"Serverless sucks!"... or does it?
Переглядів 7 тис.3 місяці тому
"Serverless sucks!"... or does it?
Stop leaking and implying logic in your Frontend
Переглядів 9 тис.3 місяці тому
Stop leaking and implying logic in your Frontend
What Kind Of Software Architecture Is This? Monolith or Microservices?
Переглядів 7 тис.4 місяці тому
What Kind Of Software Architecture Is This? Monolith or Microservices?
Battle Of The Software Architectures: Which One Reigns Supreme?
Переглядів 15 тис.4 місяці тому
Battle Of The Software Architectures: Which One Reigns Supreme?
Avoiding long running HTTP API requests.
Переглядів 14 тис.4 місяці тому
Avoiding long running HTTP API requests.
Tips for Production Ready Database (Query) Design
Переглядів 6 тис.4 місяці тому
Tips for Production Ready Database (Query) Design
Enums aren't evil. Conditionals everywhere are
Переглядів 17 тис.5 місяців тому
Enums aren't evil. Conditionals everywhere are
Goodbye long procedural code! Fix it with workflows
Переглядів 23 тис.5 місяців тому
Goodbye long procedural code! Fix it with workflows
Beware! Anti-patterns in Event-Driven Architecture
Переглядів 14 тис.5 місяців тому
Beware! Anti-patterns in Event-Driven Architecture
The Bulkhead Pattern: How To Make Your System Fault-tolerant
Переглядів 10 тис.6 місяців тому
The Bulkhead Pattern: How To Make Your System Fault-tolerant
Locking In On Concurrency Control
Переглядів 8 тис.6 місяців тому
Locking In On Concurrency Control
Is AI coming for your Developer Job?
Переглядів 6 тис.6 місяців тому
Is AI coming for your Developer Job?
How to (and how not to) design REST APIs
Переглядів 49 тис.7 місяців тому
How to (and how not to) design REST APIs
Vertical Slice Architecture Myths You Need To Know!
Переглядів 12 тис.7 місяців тому
Vertical Slice Architecture Myths You Need To Know!

КОМЕНТАРІ

  • @Alex-hs8xj
    @Alex-hs8xj 5 годин тому

    I prefer a "if it isn't broken, don't fix it" approach. However, sometimes the code is written so poorly that you can't make changes without rewriting part of it. Often, I have to refactor the code incrementally, cleaning it up in small steps. Every time I've decided to quickly rewrite everything, it ended up in overtime for me and explanations of where I spent my time. I try to avoid making such fatal mistakes.

  • @matterhart
    @matterhart 10 годин тому

    I wonder if we could create some metrics to gauge how much a rewrite could be worth. Perhaps fail rate, time to bug fix, how long it would take a mid full-stack engineer to ship a brand new form in the most complicated part of the app, how long it'd take to ship a feature that required data migrations as a result of db schema changes. I could see code bases (and eng orgs) having wildly different answers for each. Though I'm assuming we have an active code base, sounds like the cold fusion thing nailed it with essential functionality and does need to worry about any of the above.

  • @tarreislam
    @tarreislam 17 годин тому

    make it work, when it's slow, optimize it, when its optimized enough, scale it.

  • @DKLHensen
    @DKLHensen 17 годин тому

    I strongly feel like the general engineering answer applies to the question "Should you do a rewrite?", which is: it depends. Over the past 16 year I've been involved in many rewrites (unfortunately, because I like greenfield better). No rewrite was ever the same. The existing legacy product always worked "fine", but there was always a reason to rewrite: code was unmaintainable, refactorring took more than rewrite. Worked fine at small scale, but over X users performance took a nosedive, nobody understood the system anymore because all domain experts left. No confidence in building extra features, because the codebase was already too big and there were zero automated testcases written, every change would break the system in ways you would not have guessed. Deciding on doing a rewrite is not a developer-only decision, enough stakeholders must be involved. I like this video because you consider the context of the situation.

  • @tommysmith5479
    @tommysmith5479 19 годин тому

    I think to begin with, we need to define what "requires a rewrite" means. Do we mean when the code is not perfect. Do we mean when the code is not fit for purpose? Do we mean when using newer technologies would be more appropriate? Etc, etc. Then, once we establish that, then we can factor in things like value added by doing a rewrite, etc, etc. There should never ever be any hard and fast rules, such as "never do a rewrite" or "always do a rewrite".

  • @clementdato6328
    @clementdato6328 23 години тому

    Rewrite is fun but not profitable. Profit is not everything. Rewrite is not the only fun. Ideally, code should be in a state that any change will incur fmt, linter or compiler or test suit to warn or err or revert the change. Then, your current code should be the unique solution of such specification.

  • @517nickyj
    @517nickyj День тому

    I am not in IT in my company, but I do make apps on the side. My company was bought by a bigger player and I have used multiple software solutions for my industry. The parent company's software is shit... all shit... from a user perspective and all written in old code meant to be used on a PDA and the stuff that is meant for web was cold fusion. They wanted to do a rewrite of all of it. The previous software solutions I used combined pretty much ALL of our systems into one very flexible UI on the browser and in a phone app. I suggested to do the same. They then decided to keep everything separate as it is (the boomer founder decided this without ever digging deeper or asking anyone as far as I can tell). I now represent my company as the client and our internal IT is recreating every bit from scratch with separate teams working on each system (I only represent one app). We are 14 months and about 2 million dollars in for "my" application and it isn't much better than the original, in fact I'd argue it is worse except with the phase 2 (scheduled to be done after 18 months from start date) which is is my defined scope, not that Boomer CEO's. I believe with the current way it is being handled a re-write was not needed. But I do believe they could have done a rewrite and been justified if they'd only done it right and made a cohesive software. Now we are really stuck and if it is going to be changed later there will be a sunk-cost-fallacy thing going on. If you can't tell I am super annoyed, but glad to finally be apart of the process.

  • @andrefellows3702
    @andrefellows3702 День тому

    it depends......................................

  • @JobertoDiniz
    @JobertoDiniz День тому

    However this is still a naive viewpoint. What really mattered was that after our nine months of beautiful architecture and coding work we were making approximately 10k/month more than what our stupid production prototype made for all of its shortcomings. I did not understand this statement. What did they mean? Was it worth to rewrite?

  • @7th_CAV_Trooper
    @7th_CAV_Trooper День тому

    Oh, a large rewrite. For sure this can be problematic. I thought this was going to be a discussion of refectoring or tidy-first mentality. This talk is a mature look at tradeoffs. I'm in the middle of a major rewrite and planning the migration makes me cry. Other systems are coupled to the original system through its database. I'm trying to decouple them and it's a house of cards.

  • @guai9632
    @guai9632 День тому

    ua-cam.com/video/xCGu5Z_vaps/v-deo.html

  • @krumbergify
    @krumbergify День тому

    You might be forced if the language or framework you are working is losing traction and is not / no longer supported on your current platform.

  • @krumbergify
    @krumbergify День тому

    But do you know for sure that the other 80 % of the features are not used by any of your customers?

  • @christianibendorf9086
    @christianibendorf9086 День тому

    In my experience usually the question is not whether to rewrite or not, but how to isolate the broken parts you need to rewrite without losing connection to the rest that is still working (and maintainable!).

  •  День тому

    Dude stop it with the hypermedia already 😅 A lot of great stuff in this channel but pushing this is just bad.

    • @CodeOpinion
      @CodeOpinion День тому

      This is a 6 month old short. The YT algorithm must be working well!

  • @djglxxii
    @djglxxii День тому

    We've had two rewrites. Our main application was in a VB6 desktop app that we needed to bring to the browser. So we had the brilliant idea to go with Microsoft's shiney new Silverlight framework 😂. Fast forward a few years later, rewriting that shit again...

    • @fernandoacorreia
      @fernandoacorreia День тому

      Yes, Microsoft screwed a lot of developers by abandoning technologies that they promoted. One of the main reasons that led me to abandon their platforms altogether.

  • @DuraanAli
    @DuraanAli День тому

    How did you know? I needed this NOW, I have a SAAS application built in PHP, it's being used by clients but I'm thinking of rewriting in new technologies but I'm thinking WHY? I have few reasons but it takes a lot of work to rewrite.

  • @alabamacajun7791
    @alabamacajun7791 День тому

    I say rewrite, Take what you have. 1) Document the design. 2) Build UNIT TESTS, 3) Use newer constructs. 4) After putting them behind unit tests, reuse your best objects and routines. 5) Take advantage of better OO, SOLID and DRY principles. 40+ years of experience here. I'm tire of falling into sh*t code because few want to rewrite.

    • @CodeOpinion
      @CodeOpinion День тому

      Curious, would you do a rewrite for free and only if it generated more net profit than before, then get paid?

    • @alabamacajun7791
      @alabamacajun7791 10 годин тому

      You don't always get a buy in to be paid to do it. In some cases it proved valuable to do some extra time after hours to get a proof of concept. If successful you have most of the pattern laid down to get the project going quickly. Sometimes promotions are surviving the next layoff is how you get rewarded.

  • @luxeave
    @luxeave День тому

    rewrites are taking times 1/10th of what it used to in the past bro. we got LLMs to do much of the work these days

  • @GnomeEU
    @GnomeEU День тому

    If you don't understand the code thats a total valid reason to rewrite it. How can you support a code base that you don't understand? (from a retired dev, for example)

    • @jonathangalliher4474
      @jonathangalliher4474 День тому

      It's also some of the highest-risk code to rewrite. After all, if you don't understand what it does, how do you know what your rewritten code needs to do? There are ways to manage that risk, but a big category of methods is to develop a thorough understanding of what the current code does.

    • @GnomeEU
      @GnomeEU День тому

      @@jonathangalliher4474 yes but if you never dare to touch any old code then you can throw away your app after a few years, Cuz nobody is able to maintain it anymore. This is what happens in many projects, that only get bigger and bigger and we never dare to touch anything.

  • @GnomeEU
    @GnomeEU День тому

    But you gained a lot of knowledge since you first wrote the code. You now have the whole picture, you know which parts you don't need etc. You know the business logic and requirements much better. After 5 years every dev can write much better code. Sometimes even after 6 or 12 months.

  • @robotrabbit5817
    @robotrabbit5817 День тому

    Have you ever wondered if you would have gotten to your skill level as a developer if you wouldn't have rewritten stuff? I wonder if you mostly read code and merely do little changes here and there you miss out of great learning experiences building a complete system. Any thoughts?

  • @abogdzie
    @abogdzie День тому

    I’ve been doing rewriting of entire projects a few times with full success. Extremely painful process, so only for experienced. You may be surprised how many details is covered in old code. I rewrote iOS app from OBJC to Swift in 5 years and backend system from plain PHP to Laravel in 3 months. And a few others in my 15 years career.

    • @jonathangalliher4474
      @jonathangalliher4474 День тому

      That Obj-C ==> Swift rewrite seems like an example of one of the major cases when a rewrite is more likely to be appropriate than not. Specifically, Apple is replacing Obj-C with Swift it's getting harder to hire devs to work on the old code. Companies with a sizeable Cobol code-base are an even more extreme example of the same thing.

  • @awright18
    @awright18 День тому

    I remember reading and referencing many Joel Spolsky articles back in the day. I think the most memorable content for me is "Why I hate frameworks". Something Ive suggested to colleagues over the years is if you think something is ugly that you have a reason to change, isolate it and rewrite that piece. Usually I would be referring to a smaller section of code that maybe is tangled in a god class or something. I say write what you want that code to look like and have it called instead. Do that enough times as changes are required and eventually you'll be happier. The intent is to do this in the small and typically for a single branch of logic, to avoid doing to much at once. I realized long ago developers would much rather write new code than maintain old code. This technique can allow for small improvements over time while empowering developers to do what makes them happy.

    • @GnomeEU
      @GnomeEU День тому

      Some frameworks are good, some bad. Net framework for example is more a giant library where you can just take whatever you want.

    • @awright18
      @awright18 День тому

      @@GnomeEU if you haven't read the post, you may look it up. It's pretty entertaining

  • @AsifAlli
    @AsifAlli День тому

    This opinion is stupid. People dont rewrite arbitrarily. Engineers rewrite because they want to refactor. The way to rewrite is to refactor small parts of a system. Add Tests, Repeat until you're done. And you only do this if you need to. I.e. if the system has code smells or arch smells, if its failing and there are no unit test, or if its a legacy system without any tests.

    • @CassioRogerioEskelsen
      @CassioRogerioEskelsen День тому

      "Engineers rewrite because they want to refactor." This alone is not sufficient reason for refactoring, unless the engineer also happens to be the owner of the company. Refactoring is only justified if it brings real benefits to the company. If it does not, it's merely vanity on the part of the engineers. Refactoring typically introduces new bugs and may disrupt things that were already working due to a lack of understanding of the legacy code. This is why tests alone will not guarantee the quality of the new code.

    • @GreyDeathVaccine
      @GreyDeathVaccine День тому

      @@CassioRogerioEskelsen You are right. You can have 100% code coverage but... with stupid tests 🙂

  • @cosorxndrw
    @cosorxndrw День тому

    So according to you, if you have a codebase that you understand and someone else gets onboarded and he sees the mess you created (that only you and/or a few other team members understand or partially understand) and he's struggling to understand and he won't fully understand it ever... this code is good enough? What if the ones who understand the code leave? What happens then?

    • @LeMustache
      @LeMustache День тому

      I think his point was just to be cautious about it and not to jump on the rewrite hype train recklessly. If a codebase is complex, there is a good chance it's because the business logic is complex, and you won't do much better during a rewrite. Or at least not good enough to justify the cost. So understanding the codebase is important before deciding you should do a rewrite, and make sure it's actually the code quality that's the problem. Or you'll end up with what you started with.

    • @Timelog88
      @Timelog88 День тому

      If the code works it's good enough yes, the documentation around it could suck though and that *might* be a good reason to rewrite but not necessarily. But I do think some context is missing in the video. When talking about rewrite, does that include (small) refactoring, or not? Because the boy scout rule also still exists "Leave your code better than you found it" :)

    • @cosorxndrw
      @cosorxndrw День тому

      @@Timelog88 Some projects tend to place pressure on the developers to ship fast, which has an impact on the quality of the code. The developers keep stating that the code works, but it needs refactoring (not a rewrite) and tests, but the focus is again on new features. In this manner, after (let's say) two years, the project becomes a mess and almost nobody understands everything without a lot of mental effort and jumping through hoops. I am against rewrites overall, but disagree with the statement "it's good enough". So the ideal solution (if you're not thinking about switching the tech stack) is to refactor using tests, so you can get the code in a stable and sane state, so existing/new developers have an easier process when changing or adding new features without the fear of breaking something.

    • @jbeaudoin11
      @jbeaudoin11 День тому

      @cosoranxdrw I feel like you're saying exactly what Derek is saying. Use you jugement based on your context. If you need to change the code and add feature but no one is able to do it, clearly something needs to be done. Is it a rewrite ? progressive refactor ? The strategy is your's to take, there's no magic solution, just do what works for you. Not all devs are made equals, some have different background and skill sets. You have to work with what you have. We just need to keep in mind the cost of a full rewrite and if it outweighs the benefits. Rewriting/refactoring something you don't understand is always a bad idea and sometime we devs are quick on the refactor/rewrite trigger when all you had to do was to take the time to understand the code and add a couple lines.

    • @Timelog88
      @Timelog88 День тому

      @@cosorxndrw You're literally describing a project I have been working on... for two years 🤣 And yeah, most parts of that codebase are currently "good enough". We don't need to change them now as there are no new behaviors planned for those features, so we don't touch them, no matter how much 💩💩is written there. And when we *do need* to change that code, we refactor and add test first, before extending it. And I think that is the message Derek is also trying to send, look at the context of why you want to change it and make sure that is a good reason, if not, don't touch it no matter how many issues the code has. If it ain't broke, don't fix it!

  • @modernsanskari4398
    @modernsanskari4398 День тому

    Context matters 🔥🔥❤❤

  • @kf5268
    @kf5268 День тому

    Ugh I'm sick every time developer are pulling Kafka to be used as queue for their 20 mesaages/h because "it's fast and persistent"

  • @ThomasValadez-tv
    @ThomasValadez-tv 2 дні тому

    Isn't UTC a timezone. Why can't you store them with that timezone? The client needs to parse the time and apply the offset whether you supply Eastern Time or Universal Time. However universal time will likely not change it's timezone ever.

  • @DevCycleHQ
    @DevCycleHQ 3 дні тому

    They definitely are! (more than just Toggle that is!)

  • @ydkumar
    @ydkumar 3 дні тому

    Thanks, we had similar situation, so we created boundary in our db, schema for each microservice. it can read but not able to write to schema where it doesnt own .

  • @aj.arunkumar
    @aj.arunkumar 3 дні тому

    awesome video... have a question... imagine i have an app with 10 features and 5 of them requires sending mail. do i duplicate the mail functionality in those 5 places ? doing so is bad right , because fixing a bug in mail sending logic will require fixing it in 5 places right ?

  • @conradtaylor29
    @conradtaylor29 3 дні тому

    Fantastic video and I enjoyed how you focused on the high-level concepts here. Bravo!!!!

  • @sanglin9387
    @sanglin9387 4 дні тому

    it simple wait till 100 tables 😂 or 400 real project then headache

  • @mariuszcyranowski6136
    @mariuszcyranowski6136 5 днів тому

    That is exactly how this should be done. It seems to cover majority of the logic in one place making the changes cheaper. Good job!

  • @zonegamma8197
    @zonegamma8197 5 днів тому

    thanks for the videos

  • @majormartintibor
    @majormartintibor 6 днів тому

    Lovely! Thanks for this video!

  • @javisartdesign
    @javisartdesign 7 днів тому

    Hi! I just missing OpenAPI specification in the video, just seen swaggerUI. OpenAPI allow Hypermedia to be added into the specification with links, etc.. that's what i was expecting

  • @zonegamma8197
    @zonegamma8197 8 днів тому

    Thanks for the video

  • @Tony-dp1rl
    @Tony-dp1rl 8 днів тому

    03:14 being pedantic, but the original logic for checking if the user is admin was on the server-side as well in the Razor html syntax.

  • @jbeaudoin11
    @jbeaudoin11 8 днів тому

    @CodeOpinion When you say "It [the client] just need to understand what operations are possible and how to perform them", i'm mostly interested in the "how". Have you found a good way to remove the "how" or at least a standard that inform the client on how to perform an operation ? In your example of UpdateUser, you have the route & method but what is going to be the payload ? Have you found a good way, ideally a standard, to define that in a json api ? Maybe exposing a schema with the operations ? Might be overkill to always have it so maybe you can have schema endpoints or a special Accept header on the same endpoint ? At the end of the day, maybe i'm trying too hard to shift as much as possible to the backend/api... If we want a nice UX app, we still need someone for the UI code and to learn how to interact with that api. Maybe with something like htmx, even if the json api isn't 100% hateoas, some of that logic can define by the same dev building the backend, thus hopefully increasing the cohesion of the features. At least starting to define which operations are available is the bare minimum imo. I still need to figure out how to build a proper hateoas json api.

  • @GabrielSoldani
    @GabrielSoldani 8 днів тому

    Even in this simple example, you don’t use the URL from the OperationViewModel in the front-end code. So is that still hypermedia? I don’t see the difference between that and a much simpler “CanUpdate” flag in the response in terms of coupling. You’re not actually allowing the front-end to perform arbitrary operations that it can discover at runtime. Should you tell the front-end which subset of operations it can or can’t do in a given context, rather than duplicating the logic (in this case, checking the user’s role)? Absolutely. I would just call it good API design, though, not hypermedia.

    • @ahupond
      @ahupond 8 днів тому

      The video also misses the most important part: deciding on whether logic should go client or server side

    • @MurtagBY
      @MurtagBY День тому

      It has exactly the same meaning as canUpdate flag. The difference is that you aldo provide URL of how you do it. Seems excessive in simple case, but this should scale well when repeated and leaves no room for typos and desync of client and server

    • @MurtagBY
      @MurtagBY День тому

      ​@@ahupondI disagree, the logic is server side and it was clearly said

    • @GabrielSoldani
      @GabrielSoldani День тому

      ​@@MurtagBY The URL is hardly what I'm concerned is going to change. It almost never changes. When it's wrong, it's easy to notice. If it changes, you can simply redirect the old one to the new one. What I'm worried is going to change are the request/response models, which this doesn't address at all. And, imo, we _don't_ want to address, as it would make code less predictable and harder to test.

  • @eliudgerardo1152
    @eliudgerardo1152 8 днів тому

    What pattern are you using for your Blazor app? MVVM?

  • @duznt-xizt
    @duznt-xizt 8 днів тому

    Yay! More work for the backend guy 😅

  • @GigAHerZ64
    @GigAHerZ64 8 днів тому

    Let's extend this idea and assume Blazor (WASM) frontend. When i get list of items over API and each item contains set of operations, how should we eventually build the frontend? Should operation really direct the frontend to load specific Blazor component? (Sometimes another page, sometimes a modal-based component, etc) And sometimes it's a POST request that should be done and as a result a current view should reload its contents? How should it eventually work together? It's easy to zoom in and so it looks easy and logical. But once you bring in full-stack, how would you build it? I'm not saying that the idea here doesn't work. I just see that there's an elephant still in the room that i don't remember you covering. Maybe you could? I would be really interested in that...

    • @gruttewibe76
      @gruttewibe76 8 днів тому

      Maybe there are some generic hypermedia browsers, but with hypermedia it doesn't mean you have to make the *whole* frontend all dynamic based on the responses. Which superset of operations are available (implemented) in your frontend could be hardcoded. But the operations array of the response could control for which items, the delete or edit is available.

    • @GigAHerZ64
      @GigAHerZ64 8 днів тому

      @@gruttewibe76 well, there is an option that with each item you will also give a bunch of flags, what can be done with it. But is that now the solution? Is it the same solution as provided here in the video? I see it as a complete alternative.

    • @jbeaudoin11
      @jbeaudoin11 8 днів тому

      ​@@GigAHerZ64 I think there's pros and cons and it depends on what you're trying to achieve with this. If you just want to tell the client which ops are available, sure flags are probably good enough. An evolution of this concept is to send more data like the method & url to perform the operation so this way the client code can be somewhat simplified (at least for simple ops). If the url changes, your client won't break since the backend dictate the route (very useful when you don't control the client).

    • @GigAHerZ64
      @GigAHerZ64 8 днів тому

      @@jbeaudoin11 and what you describe is exactly the sterile simple scenario that I referred to in my initial comment. In real life, you don't have a "client" that does actions against any backend url or something. There are bunch of ui views, components and whatnot before any action will be taken from the backend perspective.

    • @GabrielSoldani
      @GabrielSoldani 8 днів тому

      @@jbeaudoin11 The thing is, using the received URL and method in the front end is _never_ simpler. What payload do you send? What do you do with the response? If the URL changes I’ll just make the old URL redirect to the new one. If literally anything else changes I’ll have to modify the front-end anyway. So what’s the benefit?

  • @dranon0o
    @dranon0o 8 днів тому

    Lowkey shilling hypermedia One day Derek will go straight shilling HTMX

    • @MurtagBY
      @MurtagBY День тому

      Now there are more players than htmx

  • @Aalii6
    @Aalii6 10 днів тому

    very helpful, thank you! 👍👍

  • @guai9632
    @guai9632 11 днів тому

    my rule of thumb is you never lose precision/metainfo. by storing utc you are doing exactly that

  • @guai9632
    @guai9632 11 днів тому

    there is a pgq extension to pg.

  • @zonegamma8197
    @zonegamma8197 12 днів тому

    Good video thanks