- 137
- 38 582
Martin Baun
Registrace 2. 04. 2023
CTO and company founder shows how it is done. Learn about software, business, processes etc..
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):
…
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...
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
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
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
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
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
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
Gotta raise some eyebrows 🤷🏾♀️
Yeah, memes are the future😂
💯💯
What's point number six?
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.
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.
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.
Very smart thinking. Nice!
Gracias Mercy
Soo true
thanks :))) Have an awesome weekeend
Dry makes you cry 😂😂😂
You got it ;)
🔥🔥
thanks Elvis!
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 :)
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 :))
cool, I like this approach👍
Thank you :))
The more you know👀 Great content!
Exactly!
Keep going man, good piece of info
🔥🔥
I enjoyed this video, but please get rid of these annoying subtitles
Thank you! We have gotten rid of this in the newest videos :)
very good)
FAQ - so cringe ))
I like it if it's an interesting person
Yeah, bigger accounts if there interesting can do faqs, probably not for you and me
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)!
looks great amazing job! you can really see the direction you are going in!
Thanks for the video and the recommendation!!!
Anytime, if you have any special requests or questions just write!
The last point was the best of all. Also great sense of humor!😅
Thank you :))
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!
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!
thanks for sharing your experience and great ideas
Thank you! :))
lean canvas is something people need to know
Yea exactly!
Yeah, waited for this one! ❤
Thanks!
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.
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.
@@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++.
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
@@erikslorenz that's exactly what I am saying. I will not use go, because I have no use cases for it, and never had.
@@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 :)
Why would you use Dorian develops CZcamsr as your thumbnail pic? Oh wait he’s a software developer that’s why, makes sense
hehe ;)
Great job balancing critique with appreciation!
Thank you! Tell me if you need more :)
Sooo many memes i love it. And htmx is the way to go 🎉
awesome!
php -_-
A lot gets done when you simplify 💯
Exactly! simple things get htings done
HTMX is the small beast.
Exactly ;)
❤❤❤
Thanks Mr Astro ;)
I'm still not brave enough to do a video of myself, you're doing good bro 😎
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
Smart, didn't think about that
yeah, that's the way to start it
🔥🔥
Thanks Elvis!
exactly)
Da!
Yeees!
thanks Kosta!
100%%%%
thank you, soon releasing the next version! Stay tuned The Techpreneur! PS. I love your name :)
Hey new video in this series ;) czcams.com/video/3R7LJC7pIUw/video.html
I want to have YAGNI tattooed on my team’s architect’s forehead.
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.
Starting is the essential step 😊
exactly Angela Palacios
Great tips!!
Great you like them!
God bless you Buddy ❤
Thank you Rudraksha!
so true
Gracias Nastya
Slow then suddenly works both with going bankrupt and going viral
Exactly!
you're a great motivator)
thank you Kristi!
true true!
Thanks Pinned :)
But what does Johnny Sins have to do with this 😭😭💀
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
That’s the programmer CZcamsr Dorian develops
@@UuU1001. yeeea don't think so hehe.
@@MartinBaun I’m such a troll in your comment section lol, I’m just teasing Dorian, he’s a good CZcamsr 🤣
@@UuU1001. You're always welcome trolling here mate :) What would life be without a little fun ;) Hence the Thumbnail hehe
🔥🔥
Thanks Elvis