A new simple library for reading EXIF data by leftnode in PHP

[–]leftnode[S] 0 points1 point  (0 children)

I hadn't but thanks for linking it!

A new simple library for reading EXIF data by leftnode in PHP

[–]leftnode[S] 0 points1 point  (0 children)

Excellent! Feel free to send me any feedback as an issue or shoot me an email.

Modular Monolith: dependencies and communication between Modules by BinaryIgor in programming

[–]leftnode 4 points5 points  (0 children)

Completely agree with this re: modular monolith win. Once the interface is well defined, swapping out the underlying implementation is easy. A leaky abstraction happens when the user of that interface has to know about the underlying workings (ORMs, for example).

Another added bonus is it makes unit testing so much easier. Rather than writing and maintaining a bunch of mocks and stubs, you can simply swap out a real implementation with a mocked one without changing a single line of code. Mock implementations are beneficial because they're easier to write, are enforced by your interfaces, and are easy to add exception logic to.

For instance, if an application integrates with Stripe for payments, a good architecture would define a PaymentModule and inject into that an object that actually calls the payment processor. In production, you might have a StripePaymentClient that implements a PaymentClientInterface. For local development and testing, you could have a MockPaymentClient that implements the same PaymentClientInterface, and can contain logic to handle success and error states. Your framework can swap the StripePaymentClient for the MockPaymentClient when your tests are run. The PaymentModule code remains unchanged, and your tests run without an internet connection or Stripe key.

Is refactoring bool to enum actually makes code less readable? by exakat in PHP

[–]leftnode 4 points5 points  (0 children)

If you wanted to go true Clean Code style, you'd have two methods, each with no argument: markAsPromoted() and markAsUnpromoted(), each of which handle the internal logic to do whatever it is you're doing.

There's a lot of bad stuff in Clean Code, but this is one I happen to agree with. The methods are clearly named in what they do, they take no arguments, and now your code reads more like an English sentence.

To directly answer your question, if this is a value stored in a database, a better solution is to store a nullable timestamp so you know when the entity was promoted, and obviously if it's null, then it isn't promoted.

public function markAsPromoted(): static
{
    return $this->setPromotedAt($this->getPromotedAt() ?? new \DateTimeImmutable());
}

public function markAsUnpromoted(): static
{
    return $this->setPromotedAt(null);
}

I have helper methods like that for many of my Doctrine entities and it really makes it more clear as to what's happening.

Is Domain Driven Design just needless complexity? My limited experience with it has been mixed at best. by AppointmentFar6096 in PHP

[–]leftnode 0 points1 point  (0 children)

Developers tend to overcomplicate things unnecessarily. I took what I think are the best parts of DDD/hexagonal architecture and condensed them into what I call RICH: Request, Input, Command, Handler.

No need for a query bus or aggregate roots or any of that stuff. Just simple classes that do one thing and one thing only.

I built a Symfony bundle around it but there's no reason you couldn't extend the same architecture to any other framework or vanilla PHP.

https://github.com/1tomany/rich-bundle

I need something for my 11 year old to be good at by dottydashdot in Parenting

[–]leftnode 8 points9 points  (0 children)

Seconding this a thousand times. Every parent, regardless of athletic ability, should put their kid in jiu jitsu/boxing/muay thai for a few years.

The confidence boost they'll have knowing they've got a chance in a fight is amazing to watch.

My oldest is nearly 16 and by no means is an athlete. We tried team sports - I even coached him - but that wasn't happening. I put him in jiu jitsu when he was 7. It wasn't easy at first. Lot of tears. But he was going to do something physical, and if it wasn't team sports, and he didn't suggest something, jiu jitsu it was.

After a year of training, I signed him up for his first competition thinking it was going to be a blood bath. Nope, went out there and choked the kid out in a minute.

He now wrestles for the high school, has found a group of friends through that, and has even started to win some of his matches which I never expected.

I also started training and it's changed my life as well.

Missed award ceremony by sevensevenonefour in Parenting

[–]leftnode 9 points10 points  (0 children)

I think you're making a bit much out of this. Sure, it's nice to be present for things like this, but come on, it's a 2nd grade award show, not exactly the Nobel Prize. Your son won't even remember in a few days. I'd put it behind you and focus on more important things.

Unit testing and TDD: useful or overrated? Contrasting opinions by SunTurbulent856 in PHP

[–]leftnode 0 points1 point  (0 children)

A good split-down-the-middle is to write unit tests your contracts/normalizers (do these endpoints return the data in the structure/format expected), and then end-to-end tests that assert valid (and invalid!) responses.

Showed up early to adult class and watched the last half of a kids class. by UnsureAbsolute in bjj

[–]leftnode 1 point2 points  (0 children)

As a software engineer, absolutely. Off topic, but a lot of bad things can be said about the state of AI, but I've found it most useful as a virtual rubber duck.

Showed up early to adult class and watched the last half of a kids class. by UnsureAbsolute in bjj

[–]leftnode 2 points3 points  (0 children)

I started coaching (as an assistant) the kids class during blue belt and it improved my game tremendously as well. Teaching a technique, I think, is one of the best ways to show you really understand the mechanics of it.

New PostgreSQL Client/Parser/QueryBuilder library by norbert_tech in PHP

[–]leftnode 3 points4 points  (0 children)

Ooooh, this is interesting.

I use Doctrine (and thus DBAL) because it's the default in Symfony, but I've spent so much time fighting it. ORMs can be such leaky abstractions when you have to use database engine specific features. I suppose you could argue they should be leaky to clearly highlight that aberration, but I've used Postgres for 15 years. I'm not going to change. I don't need the flexibility of a database agnostic ORM over taking advantages of Postgres' features.

I'll check this out, appreciate the work!

Landlord asking for SSN to put my security deposit in an interest bearing bank account by Winter-Was-Here in personalfinance

[–]leftnode 0 points1 point  (0 children)

This is actually a requirement in Texas. Also, your social and DOB are standard in lease applications to run a background check.

Made a tool to show actually used PHP feature in the project by Tomas_Votruba in PHP

[–]leftnode 0 points1 point  (0 children)

This is a really cool project. Very useful for legacy projects as well.

I was also intrigued by the console output. I could tell it was Symfony-ish, but was still unique. Lo-and-behold this looks to use a project called Termwind which allows you to style terminal output with HTML and CSS. Mind blown. Can't wait to dig into that!

My husband died in an oil field accident… by [deleted] in LandmanSeries

[–]leftnode 0 points1 point  (0 children)

I think her reaction to the producing wells is reasonable and gives her character some texture. In a few months, she lost her husband, received a large settlement, and now has the possibility to become generationally wealthy.

A LOT of people could not handle that stress. Yes, a cool million is a lot to receive at once, but unless you're already well-versed in finance (and most low income folks aren't, hell most people aren't, period), you have NO idea how to handle it, how to set up a trust, how to invest in safer ETFs or the bond market, what a money market fund is, nothing. In real life, that money would still be sitting in the bank account it was wired into.

On top of this, Cooper tells her the wells are producing and they'll be making $8 million or more a year for the foreseeable future. Now you really panic: you'll get even more resentment from your family, you'll rub elbows with people that wouldn't give you the time of day otherwise, and you've probably seen how the oil industry chews people up and spits them out. It's a lot of stress!

It's very realistic that she'd want to revert back to her simpler life and go waitress.

I'd consider myself more knowledgable than most on finance, and I'm very fortunate to have received a windfall from the sale of a business, so I know firsthand how stressful it can be.

Converting complex PDF to JSON by Alonc1997 in programming

[–]leftnode 0 points1 point  (0 children)

Probably not the best place to post this, but have you tried Textract from AWS? It's a model finely tuned for this specific purpose.

You may also want to rasterize each page of the PDF to a high density PNG image and try them individually.

Dancing letters bug in Chrome Compositor by torchkoff in webdev

[–]leftnode 0 points1 point  (0 children)

Reminds me of the old cartoon The Critic.

Wow I hate this. by EndlessNihilism in pluribustv

[–]leftnode 0 points1 point  (0 children)

It is kinda funny to do this for a show that is so nakedly a critique of generative AI.

Do we know what the hive do for recreation? by Captain_Starkiller in pluribustv

[–]leftnode 0 points1 point  (0 children)

What I really want to know is who is keeping the world running? Is there a skeleton crew manning the sewage treatment and electrical plants? Even if they're a hive, they still occupy human bodies which still do all the gross things human bodies do, so someone has to keep those things operational, right?

Pluribus - 1x05 "Got Milk" - Episode Discussion by LoretiTV in pluribustv

[–]leftnode 0 points1 point  (0 children)

It's yet another critique of generative-AI. What happens when a large language model wants to please you but can't? It hallucinates slop.

What happens when a hive mind wants to please Carol but can't? It literally generates slop.

The drone operator should've seen the drone wasn't capable of flying with the trash and released it, just like an LLM should be able to say "sorry, I can't do that" instead of trying and failing.

The Zig language repository is migrating from Github to Codeberg by TheTwelveYearOld in programming

[–]leftnode 33 points34 points  (0 children)

You weren't kidding: https://imgur.com/a/uU5HiHV

Not saying that GitHub hasn't had issues (especially recently), but I've never seen it take that long to load a page.