Avoiding booleans
In an older but still relevant post, Jeff Atwood shares why you shouldn't use boolean parameters and how this translation to UI.
Read more [blog.codinghorror.com]
In an older but still relevant post, Jeff Atwood shares why you shouldn't use boolean parameters and how this translation to UI.
Read more [blog.codinghorror.com]
Matthew Rocklin reminds us that sometimes you shouldn't extract code.
However, there is also a cost to this behavior. When a new reader encounters this code, they need to jump between many function definitions in many files. This non-linear reading process requires more mental focus than reading linear code.
Read more [matthewrocklin.com]
Join 9,500+ smart developers
Get my monthly newsletter with what I learn from running Spatie, building Oh Dear, and maintaining 300+ open source packages. Practical takes on Laravel, PHP, and AI that you can actually use.
No spam. Unsubscribe anytime. You can also follow me on X.
"Always fresh, useful tips and articles. Carefully selected community content. My favorite newsletter, which I look forward to every time."
A nice little tip to clean up your code base from boolean flags (is_active, is_deleted, is_subscribed) is to switch to nullable timestamps instead.
— Marcel Pociot ? (@marcelpociot) July 2, 2019
You remain the same flag functionality, but get the point of time for free. pic.twitter.com/86iHt6ow0X
Read more [twitter.com]
In a new blogpost, my colleague Seb explains why you should and how you can use useEffect.
React recently introduced a new way to deal with side effects: the
useEffecthook. Translating lifecycle methods touseEffectcalls can be confusing at first. It’s confusing because we shouldn’t be translating imperative lifecycle methods to declarative useEffect calls in the first place.
Read more [sebastiandedeyne.com]
Matthias Noback wrote down some thoughts on the Laravel container
Laravel's service container looks great. I like the idea that it can figure things out mostly by itself. I like that it's PHP-based, and that its syntax is quite compact. I think that most of the convenience functions (e.g. resolve()) and exotic options (like $this->app->resolving()) should be ignored. The best thing you can do for your application in the long term is to let all your services use dependency injection, and to inject only constructor arguments. This keeps things simple, but also portable to other frameworks with other dependency injection containers, or other architectural styles, when the time is there.
Read more [matthiasnoback.nl]
My colleague Brent wrote another excellent blog post, this time on tests and types.
So while strong types can help us to ensure program correctness, some tests will always be a necessity to ensure business correctness. It's a matter of "both and", not "either or".
Read more [stitcher.io]
Nuno Maduro, engineer at Algolia, explains what is the value of the @internal tag
The PHP @internal tag can be used to denote that the associated class/method is internal to the library. It's supported by PHPStorm and it warns people that those classes/methods are not meant to be used
Read more [nunomaduro.com]
Konstantin Kudryashov, one of the speakers at the upcoming Full Stack Europe conference, makes the case for sharing new insights early.
When you build new feature as a team, and it requires a lot of new learning, do not hoard new knowledge in your head. Instead, incrementally commit each unit of learning into working code. Hide that partial logic behind a feature flag. The feature would be incomplete, but work-in-progress outputs will expose meaningful and demonstrable progress. To increase team’s awareness of outputs, add links into the feature tracker or documentation.
Read more [stakeholderwhisperer.com]
I always knew the browser was pretty smart about dealing with what I thought was incomplete HTML, but I didn't know the HTML5 spec actually defined a bunch of tags as optional ?
— Adam Wathan (@adamwathan) May 18, 2019
Google actually recommends writing your HTML this way:https://t.co/t3fu98s5IM pic.twitter.com/v2RAr5Whl9
Read more [twitter.com]
At the Clarabridge Developers blog, Toon Daelman wrote a good post on how to improve your exceptions.
You've made it to this post thinking "Why do we still need to talk about Exceptions?". Well, they're used everywhere in OOP codebases, but sometimes they're used in a way that make debugging a bit difficult. Let's look at some ways to make debugging exceptions a bit more fun!
Read more [engagor.github.io]
? PSA: <title> tags matter (especially for people browsing the web with screen readers)
— Caleb Porzio (@calebporzio) May 28, 2019
ICYMI: https://t.co/g7IdUkEjiQ pic.twitter.com/ANIjMZUMDN
Read more [twitter.com]
Emily Shaffer makes the case for commenting regular expressions.
It’s probably not a good idea to encourage your coworkers to think critically about what life would be like if you got hit by a bus, but the good news is that you can simultaneously document your regular expression and teach your coworkers some regex basics, if you comment them carefully!
Read more [nasamuffin.github.io]
In a Laravel app policies are a great way to organize authorization logic that revolves around models.
For the longest time, I've been using Gate::before to allow superadmins to do anything they want. While working on a new app, it finally clicked how Gate::after can be useful too. I'd like to share that knowledge in this blog post.
In this blog post, I'd like to highlight two tips to make controllers in Laravel feel much lighter.
?? Laravel Core Adventures - Did you know?
— Christoph Rumpel ? (@christophrumpel) April 17, 2019
In Laravel, we can access related data as if we would call a class property. But in fact, this is just a shortcut/hack for using the relationship method we have defined.
The second approach has one advantage, your IDE can follow it. pic.twitter.com/OjL4zNqUnp
Read more [twitter.com]
It's a bit of a click baity title, but reading it I learning that all PHPUnit's asserts have a function equivalent.
During the preparation of TDD workshops, I began to think about how to write assertions. It turns out that there are several possibilities, but is there the only correct one?
Read more [arkadiuszkondas.com]
My colleague Brent offers some more details on the intricacies of Laravel's query builder.
I recently learned that not all query builder functionality in Laravel is "safe". This means that user input shouldn't be passed directly to it, as it might expose your application to SQL injection vulnerabilities.
Read more [stitcher.io]
KH. Jebran Ali lists a few cool Laravel tricks
Laravel is full of hidden gems that I have discovered during working on different tasks. Some of these gems were less-known or un-documented features, functions parameters and hacks. In this blog post I will share those hidden gems with you, let’s get started.
Read more [meramustaqbil.com]
React lead dev Dan Abramov makes the case for naming your ideas and projects.
The problem it’s solving might be so ingrained that we don’t even notice it. It’s the elephant in the room. And we can’t discuss what we never named.
Read more [overreacted.io]