Martin Baun
Martin Baun
  • 137
  • 38 582
DRY Software Principle makes you CRY
You’re building software
and now you want to make it more maintainable
some would even say make the code great, again
One way to do this is DRY
But usually, DRY is overused
AND DRY will make you CRY
Here’s how to use DRY well
Let’s get to it
Problems with DRY
The DRY software pattern is a dangerous one
The reason is pretty simple,
How do you balance DRY?
Well, the opposite of DRY is...
WET
Write Everything Twice
So the balance is between
something bad and something good
With this, you tend to go too much in one direction
In other words,
So how do we balance DRY and WET?
When to use DRY
The DRY software principle is hard to administer correctly
Senior developers might even argue for or against
Experience will teach you when it was a bad idea to use it
Because that’s how it works with DRY
Mostly, you’ll figure out when it wasn’t supposed to be used
When you have a function that can do everything and is impossible to refactor
I have some rules of thumb you can follow here
If you’re in doubt, don’t use DRY. Copy-paste is often better.
Use DRY when you truly do repeat. Not when things are similar. You can usually see this if there are if statements in the DRY entity
Only use DRY when you’re repeating yourself at least 4 times
They’re not perfect,
so take them with a big grain of salt
Do this instead
Before you even start using the DRY software principle
you should probably just make utility functions
How to use DRY
Here’s the secret sauce on how to use
the do not repeat software pattern
Keep your DRY abstractions simple
Then when you get to refactor or add
it should be a lot easier
Favor functions over classes
Again, simplicity.
Classes and other data structures will complicate your functionality
instead, just make a function
Inject behavior instead of complicating the DRY entity
For example, we have a runcron implementation
Instead of accepting a type of corn, it should run
or what database it should use
we just inject these dependencies.
This makes it extremely versatile
as our runcron code can run on many different projects
using different databases and functions
def runcron(db, name, func, on_error):
zhlédnutí: 66

Video

SaaS 02 Simple Business Plan - Lean Canvas
zhlédnutí 58Před 9 hodinami
You want to build a SaaS, or optimize your workflow? Then you’re in the right place, my friend. In today's episode, we’ll go through the thing nobody wants to do The dreaded Business Plan. but I am going to show you an easy way We’ll use Pareto’s law and make something in a day instead of spending 3 months on some business bullshit bingo Let’s get to it Business Plans Business plans are intimid...
Bad Optimizations in Business and Life
zhlédnutí 90Před dnem
You’re probably doing optimizations you shouldn’t. Here I’ll go through some of the typical Business optimizations that are actually terrible If you like that, then consider subscribing And let’s get to it Bad Optimizations in software businesses? Bad Optimization do they even exist? Yes they do in both business and personal life. Let’s say you have diarrhea all the time and the way you optimiz...
SaaS Building Episode 01 Concept & Idea
zhlédnutí 267Před 14 dny
You want to build a SaaS, or optimize your workflow, then you’re the right place my friend Todays’ episode we’ll go through the conceptualization and ideation of my mini SaaS It isn’t actually a SaaS as I wont try to sell it but all the steps are illustrative of how to build a SaaS So you’ll see how to improve your own work flow or guide through the your own creation of a SaaS Simple Tools I li...
SaaS Building Episode 00 Intro
zhlédnutí 154Před 14 dny
You want to build a SaaS, Or get inspiration for your workflow? Then you’re the right place my friend. This is a no bs step-by-step guide on building an simple SaaS product you’ll see all the tools needed and how they’re used and mindset that helps you build faster Maybe this can inspire you to start your own thing It is not as hard to build the thing as you might expect and this video series i...
YouTube? How to start
zhlédnutí 113Před 14 dny
CZcams? How to start
Meetings Suck, what to do?
zhlédnutí 73Před 21 dnem
Meetings Suck, what to do?
Securing Servers 2024
zhlédnutí 150Před 21 dnem
Securing Servers 2024
SQLite in Production - Master Course
zhlédnutí 1,8KPřed měsícem
SQLite in Production - Master Course
Boost Productivity with Checklists
zhlédnutí 105Před měsícem
Boost Productivity with Checklists
Get What You Want #productivity #advice #colaboration #worksmart
zhlédnutí 75Před 2 měsíci
Get What You Want #productivity #advice #colaboration #worksmart
3 Terrible Advice #productivity #lifelessons #advice #lifeadvice #2024
zhlédnutí 38Před 2 měsíci
3 Terrible Advice #productivity #lifelessons #advice #lifeadvice #2024
What is Goleko? Manage Projects Better #productivity #projectmanagement #businesstools
zhlédnutí 258Před 3 měsíci
What is Goleko? Manage Projects Better #productivity #projectmanagement #businesstools
Golang is OG?
zhlédnutí 2,9KPřed 3 měsíci
Golang is OG?
SQLite is enough
zhlédnutí 7KPřed 3 měsíci
SQLite is enough
Micromanagement is great
zhlédnutí 70Před 3 měsíci
Micromanagement is great
Frontend JavaScript suck, here's why but not how to fix it
zhlédnutí 142Před 4 měsíci
Frontend JavaScript suck, here's why but not how to fix it
Cycle Off Coffee
zhlédnutí 113Před 4 měsíci
Cycle Off Coffee
The Cloud Sucks, and here’s why
zhlédnutí 176Před 4 měsíci
The Cloud Sucks, and here’s why
Best Project Management Tool Upgrade #projectmanagement #productivity #entrepreneur #productivity
zhlédnutí 40Před 4 měsíci
Best Project Management Tool Upgrade #projectmanagement #productivity #entrepreneur #productivity
1 Advice
zhlédnutí 48Před 4 měsíci
1 Advice
Almost died in Medellin, Colombia, not what you think #traveling #colombia #medellin #lifeistooshort
zhlédnutí 487Před 4 měsíci
Almost died in Medellin, Colombia, not what you think #traveling #colombia #medellin #lifeistooshort
7 Tips for Communication
zhlédnutí 51Před 5 měsíci
7 Tips for Communication
What Is Goleko? Manage Projects Easily - simple yet powerful
zhlédnutí 218Před 5 měsíci
What Is Goleko? Manage Projects Easily - simple yet powerful
Go super generics - less code, more done #golang
zhlédnutí 271Před 8 měsíci
Go super generics - less code, more done #golang
Mockups are terrible, do THIS instead
zhlédnutí 59Před 8 měsíci
Mockups are terrible, do THIS instead
Learnings growing my company the last 2 weeks | Build In Public 33
zhlédnutí 39Před 9 měsíci
Learnings growing my company the last 2 weeks | Build In Public 33
TWITTER IS BACK FROM VACATION | buildinpublic review week 31
zhlédnutí 47Před 9 měsíci
TWITTER IS BACK FROM VACATION | buildinpublic review week 31
TestingHelper.com Explained in 59 seconds
zhlédnutí 8KPřed 9 měsíci
TestingHelper.com Explained in 59 seconds
Build In Public Week 30
zhlédnutí 23Před 10 měsíci
Build In Public Week 30

Komentáře

  • @mercykavutha7892
    @mercykavutha7892 Před 42 minutami

    Gotta raise some eyebrows 🤷🏾‍♀️

  • @PinnedBeats
    @PinnedBeats Před 2 hodinami

    Yeah, memes are the future😂

  • @AnastasiiaSyrykh
    @AnastasiiaSyrykh Před 3 hodinami

    💯💯

  • @accessibleguidance
    @accessibleguidance Před 18 hodinami

    What's point number six?

  • @erikslorenz
    @erikslorenz Před 21 hodinou

    I was thinking a lot about this kind of thing and why I’ve decided to go all in with go for backend. It will continue gaining adoption because it just makes so much business sense.

    • @MartinBaun
      @MartinBaun Před 15 hodinami

      Yes exactly, the same here. I find it so boring to program, but the result I get is just so robust, easy to maintain and easy to deploy.

  • @RealDevastatia
    @RealDevastatia Před 2 dny

    SQLite and MySQL are both enabled in PHP by default, and there's a PDO interface for both. So there's little difference there as far as usability goes. You can also write SQLite aggregate functions in PHP and call them in your SQL queries.

  • @mercykavutha7892
    @mercykavutha7892 Před 2 dny

    Very smart thinking. Nice!

  • @thetechpreneur
    @thetechpreneur Před 2 dny

    Soo true

    • @MartinBaun
      @MartinBaun Před 2 dny

      thanks :))) Have an awesome weekeend

  • @thomasborg4442
    @thomasborg4442 Před 2 dny

    Dry makes you cry 😂😂😂

  • @elvismurseli9919
    @elvismurseli9919 Před 2 dny

    🔥🔥

  • @joshuabiyinzika2834

    Hey Martin, I counted the number of times you said "DRY" and they're upwards of 12. Don't you think your video is violating the DRY principle?? Ofc i'm kidding. #MessingWithYou xD I try to keep dry code at a minimum as much as I can. If I'm in a rush, I have a lot of dry, but I always come back and clean up. Thanks for the video :)

    • @MartinBaun
      @MartinBaun Před 2 dny

      hehehe, good one Joshua! I should have simplified it to "X" that sounds like a good solution, it's very similar to what I do. A little copy/paste is often better and when you need to expand on the code you can go back and refactor a little :))

  • @kristinakristina6426

    cool, I like this approach👍

  • @PinnedBeats
    @PinnedBeats Před 2 dny

    The more you know👀 Great content!

  • @mikhail_skvorchynskyi

    Keep going man, good piece of info

  • @elvismurseli9919
    @elvismurseli9919 Před 3 dny

    🔥🔥

  • @user-bw1uk9ow5h
    @user-bw1uk9ow5h Před 3 dny

    I enjoyed this video, but please get rid of these annoying subtitles

    • @MartinBaun
      @MartinBaun Před 2 dny

      Thank you! We have gotten rid of this in the newest videos :)

  • @kristinakristina6426

    very good)

  • @PinnedBeats
    @PinnedBeats Před 4 dny

    FAQ - so cringe ))

    • @thomasborg4442
      @thomasborg4442 Před 4 dny

      I like it if it's an interesting person

    • @thomasborg4442
      @thomasborg4442 Před 4 dny

      Yeah, bigger accounts if there interesting can do faqs, probably not for you and me

  • @thetechpreneur
    @thetechpreneur Před 4 dny

    here is some feedback: 1) Zoom out the camera angle is a bit awkard 2) Add full images with transition when making cutaway memes makes it look much cleaner 3) Add a more interestig background maybe in an office or somewhere else to create more authority? 4) I love the basic idea and where you want to go BUT what you gave is a bit plain in the way you gave it 5) Rather then talking about the business plan and the steps give real life examples Why did you start to use them? When did you realise you needed the structure? Give a story of how you failed without it? Give your light bulb momennt? Give a story of when you implemented the first and the results I think people like when they hear about your struggles and how the lightbulb moments help (Hope i wasn't too harsh)!

  • @thetechpreneur
    @thetechpreneur Před 4 dny

    looks great amazing job! you can really see the direction you are going in!

  • @vincentdrews4341
    @vincentdrews4341 Před 4 dny

    Thanks for the video and the recommendation!!!

    • @MartinBaun
      @MartinBaun Před 4 dny

      Anytime, if you have any special requests or questions just write!

  • @mercykavutha7892
    @mercykavutha7892 Před 4 dny

    The last point was the best of all. Also great sense of humor!😅

  • @joshuabiyinzika2834

    Many, many thanks for this vid. Lean canvas varies slightly from Business generation model canvas which I've used in the past. PS. "Girls with d**ks" this one killed me 🤣 That value prop is nuts!

    • @MartinBaun
      @MartinBaun Před 4 dny

      Hey Joshua! I think the people behind the Lean Canvas took the Business model canvas and adapted it to more "lean-software" based type of projects. Thanks! I try to make it as light hearted as possible and my editor is an absolute savage with the memes hehe. Next video is about how to apply it, I am working on it right now. You'd wouldn't want to miss it ;) And next next video will be finding the domain!

  • @kristinakristina6426

    thanks for sharing your experience and great ideas

  • @PinnedBeats
    @PinnedBeats Před 4 dny

    lean canvas is something people need to know

  • @thomasborg4442
    @thomasborg4442 Před 4 dny

    Yeah, waited for this one! ❤

  • @vitalyl1327
    @vitalyl1327 Před 5 dny

    Nah. I'm not going to use Go for anything, ever. It's got a GC, which disqualifies it immediately for most of the use cases I care about. It's a very low level language with zero capacity for defining abstraction, which makes Go code immediately overbloated, extremely verbose, so you won't see the forest behind the trees, you won't be able to see the business logic behind such a verbose code. Those new developers you're talking about will be absolutely perplexed by your bloated code base and will take a very long time understanding what it's doing. "Simplicity" of the language is a red herring, simple languages make code more complex.

    • @MartinBaun
      @MartinBaun Před 4 dny

      Hey Vitaly, , I would just caution this kinda thinking and instead try Go on a real project and see how it goes. Go is a special one yes, but for a reason. I just visited an medium sized project in Go that was structured terribly (my fault) and I also didn't do 90% of the code here. It took me no time to find and fix the thing I needed to do. In Python, good luck. In C# Good luck. In JavaScript... forget it.

    • @vitalyl1327
      @vitalyl1327 Před 4 dny

      @@MartinBaun yes, Golang tooling is exceptional and you can get a lot from it. But the language limitations unavoidably affect the code base quality even if all the best practices are followed. It is particularly harmful where the safety and reliability requirements are very high (and reasoning about the code is hard because of the low level and lot of ritual), where performance is important (and there are no ways to implement any zero cost abstractions), where problem domain itself is complex (e.g., scientific compute areas, robotics, etc.) and you absolutely need to express higher levels of abstraction. I tried Golang a few times, was very impressed by the tooling and then put off by the very quickly bloating code base and tons of unavoidable boilerplate on levels not seen even with C++.

    • @erikslorenz
      @erikslorenz Před 21 hodinou

      Why would go ever be a consideration for a use case that needs something that doesn’t have a gc? Go is a competitor to node, java, c#, etc

    • @vitalyl1327
      @vitalyl1327 Před 20 hodinami

      @@erikslorenz that's exactly what I am saying. I will not use go, because I have no use cases for it, and never had.

    • @MartinBaun
      @MartinBaun Před 15 hodinami

      @@erikslorenz Very good point, though the GC in golang is running quite reliable now. I am not so much in to low level stuff, but I read someone... from some random person... that Go could potentially be useful for even soft-real-time applications. don't quote me on that one though :)

  • @UuU1001.
    @UuU1001. Před 5 dny

    Why would you use Dorian develops CZcamsr as your thumbnail pic? Oh wait he’s a software developer that’s why, makes sense

  • @dagulya
    @dagulya Před 5 dny

    Great job balancing critique with appreciation!

    • @MartinBaun
      @MartinBaun Před 5 dny

      Thank you! Tell me if you need more :)

  • @thomasborg4442
    @thomasborg4442 Před 5 dny

    Sooo many memes i love it. And htmx is the way to go 🎉

  • @kristinakristina6426

    php -_-

  • @mercykavutha7892
    @mercykavutha7892 Před 5 dny

    A lot gets done when you simplify 💯

    • @MartinBaun
      @MartinBaun Před 5 dny

      Exactly! simple things get htings done

  • @PinnedBeats
    @PinnedBeats Před 5 dny

    HTMX is the small beast.

  • @astrozen28
    @astrozen28 Před 5 dny

    ❤❤❤

  • @goonnguyen
    @goonnguyen Před 6 dny

    I'm still not brave enough to do a video of myself, you're doing good bro 😎

    • @MartinBaun
      @MartinBaun Před 6 dny

      Thank you! :) well, it is all about practice. I wasn't in the start either... actually still aren't. But you get better at it :) and you can cut away the bloobers. I might ask my editor just to make a video of bloobers hehe

  • @thomasborg4442
    @thomasborg4442 Před 6 dny

    Smart, didn't think about that

    • @MartinBaun
      @MartinBaun Před 6 dny

      yeah, that's the way to start it

  • @elvismurseli9919
    @elvismurseli9919 Před 7 dny

    🔥🔥

  • @kristinakristina6426

    exactly)

  • @PinnedBeats
    @PinnedBeats Před 7 dny

    Yeees!

  • @thetechpreneur
    @thetechpreneur Před 7 dny

    100%%%%

    • @MartinBaun
      @MartinBaun Před 7 dny

      thank you, soon releasing the next version! Stay tuned The Techpreneur! PS. I love your name :)

    • @MartinBaun
      @MartinBaun Před 4 dny

      Hey new video in this series ;) czcams.com/video/3R7LJC7pIUw/video.html

  • @SM-ok3sz
    @SM-ok3sz Před 7 dny

    I want to have YAGNI tattooed on my team’s architect’s forehead.

    • @MartinBaun
      @MartinBaun Před 7 dny

      It should be mandatory at least as an tattoo on the forearm. It is easier to see when they start architecting their grand solutions that eventually becomes tragic problems.

  • @angelapalacios4274
    @angelapalacios4274 Před 8 dny

    Starting is the essential step 😊

  • @mercykavutha7892
    @mercykavutha7892 Před 8 dny

    Great tips!!

  • @rudraksha-8506
    @rudraksha-8506 Před 9 dny

    God bless you Buddy ❤

  • @AnastasiiaSyrykh
    @AnastasiiaSyrykh Před 9 dny

    so true

  • @thomasborg4442
    @thomasborg4442 Před 9 dny

    Slow then suddenly works both with going bankrupt and going viral

  • @kristinakristina6426
    @kristinakristina6426 Před 10 dny

    you're a great motivator)

  • @PinnedBeats
    @PinnedBeats Před 10 dny

    true true!

  • @mrkostya008
    @mrkostya008 Před 10 dny

    But what does Johnny Sins have to do with this 😭😭💀

    • @MartinBaun
      @MartinBaun Před 9 dny

      So many girls say to me > Don't I know you from some where? I say > Johnny Sin Immediately they say > YES! and then they get all red in their face :D

    • @UuU1001.
      @UuU1001. Před 5 dny

      That’s the programmer CZcamsr Dorian develops

    • @MartinBaun
      @MartinBaun Před 4 dny

      @@UuU1001. yeeea don't think so hehe.

    • @UuU1001.
      @UuU1001. Před 18 hodinami

      @@MartinBaun I’m such a troll in your comment section lol, I’m just teasing Dorian, he’s a good CZcamsr 🤣

    • @MartinBaun
      @MartinBaun Před 15 hodinami

      @@UuU1001. You're always welcome trolling here mate :) What would life be without a little fun ;) Hence the Thumbnail hehe

  • @elvismurseli9919
    @elvismurseli9919 Před 10 dny

    🔥🔥