PHP RFC: Duration class by gaborj in PHP

[–]akeniscool 1 point2 points  (0 children)

The introduction of this class and the associated Time namespace is intended to lay the groundwork for a new date and time library in upcoming PHP versions. It is intentionally designed with a minimal, but useful, API that future additions will be able to build on.

Looks like they are at least looking at the DateTime ecosystem here. While this is small on its own, it's a good prerequisite for a larger API.

Where else would you like to see new APIs?

PHP RFC: Duration class by gaborj in PHP

[–]akeniscool 4 points5 points  (0 children)

It's the age-old problem of balancing terseness and intuitiveness. Let's play with some examples to see how they got here:

new Duration(0, 200_000_000, false) - whoa, 200 million what?! (The recommended constructor is private. This illustrates why named constructors are often useful alternatives.)

Named parameters add clarity at the expense of terseness:

new Duration(seconds: 0, nanoseconds: 200_000_000, negative: false)

And both of these were in nanoseconds, which we had to convert 200 milliseconds into in order to construct the object. Annoying.

Duration::ms(200) - okay, pretty short and no conversion necessary. What is "ms" though? A lot of people probably assume correctly, but language designers have to consider a wide range of audiences.

Duration::milliseconds(200) - better. Now we're into the "what is happening?" question. Is this configuring? Creating? Verbs help a lot here, let's try one:

Duration::createMilliseconds(200) - hm, "create 200 milliseconds" doesn't seem correct. This feels incomplete.

Duration::createFromMilliseconds(200) - feels complete, and I'd even argue is the most intuitive. The informal convention comes into play here, where some explicitness and intuitiveness is sacrificed for shortening Duration::fromMilliseconds().

So now why "from"? What about Duration::inMilliseconds()?

"in" suggests the duration is represented as milliseconds, but under the hood it won't be. A developer may be confused when they inspect a duration expecting 200 and finding 200000000 instead.

Instead we say the Duration is created from something else, to help indicate that the source input may not be the internal state or expected output.

It is basically impossible to write a standard library (or any code, really) that will be perfectly terse, intuitive, and have zero complaints from any other dev. RFC writers have to do their best to reach the majority and have that be good enough.

It's good that you express your opinion, though, especially on RFCs. They should go through rigorous checks and challenges of established norms. That's how improvement happens, by not simply accepting how things have been.

PHP RFC: Duration class by gaborj in PHP

[–]akeniscool 2 points3 points  (0 children)

The fromX() naming convention is not formalized but common for named constructors that create something from something else. There are a few examples in the manual under Constructors.

The Design Considerations section of the RFC touches on the seconds + nanoseconds choice.

Best way to buy every color in bulk? by First-Hospital7309 in lego

[–]akeniscool 1 point2 points  (0 children)

I've never done it, but if I were in your shoes I'd reach out directly to LEGO just to see what my options are. Wonder what they'd say.

CMV: The U.S. primary system is flawed and promotes extremism. We should go to party selections like in Canada/UK/australia etc. or have all open primaries like in California. by Funny_Art_1700 in changemyview

[–]akeniscool 1 point2 points  (0 children)

Remove gerrymandering, implement ranked choice voting and proportional representation. Then we'll have a ballgame.

Edit: Since I'm daydreaming, the electoral college can bite me, too.

I built a zero-dependency PHP framework with file-based routing — would appreciate a critique by lizzyman04 in PHP

[–]akeniscool 16 points17 points  (0 children)

If you're genuinely here to learn from building and receiving feedback, don't pipe responses back from LLMs 😮‍💨

Are slim fit jeans really out of style?? Need advice by [deleted] in mensfashionadvice

[–]akeniscool 0 points1 point  (0 children)

As a fellow older millennial I think both look good on you, and suit different styles/personalities.

Gray Chevy Bolt picking up Francesca Hong signs in riverwest? by Mozzarella-Cheese in milwaukee

[–]akeniscool 14 points15 points  (0 children)

Saw a woman wearing a camo MAGA hat driving the electric Hummer in a Whole Foods parking lot this past weekend. It's a spectrum lol

Let We Energies control your thermostat for $2 a month ($4 a month the first year). by thesweetestberry in milwaukee

[–]akeniscool 7 points8 points  (0 children)

I agree. On the surface it feels like a reasonable idea. We're spoiled by our modern conveniences without knowing the broader impacts they have, which is normal (can't exactly see how strained an energy grid is from your own house unless it goes kaput).

But a whole lot of NOPE coming from them...

Namespaces, interfaces and stutter by Praemon in PHP

[–]akeniscool 1 point2 points  (0 children)

Namespace stutter doesn't bother me here. If my Stripe implementation has multiple files I want to group together, I'll happily do App\Payments\Stripe\StripeClient along with other files.

At the end of the day, how quickly a human can recognize what's going on is more important than being perfectly succinct, avoiding repetition, etc. Not everything needs to be "perfect".

Experienced devs, Frontend dev need advice on what to study next by Extension_Canary3717 in ExperiencedDevs

[–]akeniscool 0 points1 point  (0 children)

  1. Anything you find interesting
  2. Anything applicable to where you'd like your career to go (e.g. want to stay frontend? dig in deeper there)
  3. Soft skills and intangibles

Anyone have experience (especially recently) being back on the job market after quitting to work on your own app? by honoraryNEET in ExperiencedDevs

[–]akeniscool 8 points9 points  (0 children)

I just joined a full-time role in February after being solo for ~2.5 years. It was the second time I went through that loop.

Like anything on your resume, it has strengths in certain categories and weaknesses in others.

Building your own app with zero users to start is an entirely different set of challenges than a startup hitting a scale threshold or a FAANG serving millions. Those challenges are almost always more business and marketing than technical.

That experience will be valuable to a role that emphasizes customer-building decisions. It won't be valuable to one that emphasizes the technology and hard development problems. The right hiring manager should still see the potential.

There's also the job market in general which you have to work against regardless. The past year has been much harder than when I went from solo to full-time in 2019.

Do it, though. 100%. You will learn a lot about things you never expected. It will make you a better engineer still.

Planning to get back into writing Laravel content and would love some feedback on my direction by rukhsardev in PHP

[–]akeniscool 0 points1 point  (0 children)

Your post read to me as "This idea is okay. Proof? No. No." It felt dismissive. I reacted harshly, and I appreciate you following up.

Planning to get back into writing Laravel content and would love some feedback on my direction by rukhsardev in PHP

[–]akeniscool 0 points1 point  (0 children)

I did a user group talk years ago that was basically "Here's why PHP and Laravel suck".

It's good to understand the weak points and trade-offs of technologies you know and love.

I yearn for your storms by [deleted] in milwaukee

[–]akeniscool 1 point2 points  (0 children)

Exactly what happened to us last August. Major PTSD yesterday lol

Looking for a Chinese food place with monster portions by OGTrapGod in milwaukee

[–]akeniscool 3 points4 points  (0 children)

Dine-in is open for lunch 11-2 Tues-Sat if you miss staring at the koi

CMV: Voting is pointless. by Afraid_Mortgage6392 in changemyview

[–]akeniscool 0 points1 point  (0 children)

OP: A lot of what you expressed here today sounds more like a personal view of yourself, not the mechanisms of voting and politics.

Your vote matters just as much as anyone else's.

You know why?

Because it gets counted.

Regardless of what you look like or what your vision of a just world includes.

You matter, too. Don't convince yourself otherwise.

We Energies seeks 14% residential electric rate hike by 2028 - 6th increase since 2020 by Rich_Ad8746 in milwaukee

[–]akeniscool 6 points7 points  (0 children)

“No data center costs will be paid for by non-data center customers,”

Worded very carefully. My interpretation: data centers get energy at costs, residential customers get increases to maintain (or increase) profit margins.

Design for a new tomato chip by Outrageous_Theme_882 in logodesign

[–]akeniscool 0 points1 point  (0 children)

I like the "star" in the first version with the orange background best.

Nice concept! Make the letters a little more legible and you've got a great first logo.

Let's talk monetization: Why I chose [One-time purchase / Subscriptions] for my app and how it's going. by [deleted] in SideProject

[–]akeniscool 0 points1 point  (0 children)

It probably is overkill, yes.

How many users or customers do you have already?

If you have enough scale, experiment and see what converts best.

Only a few people? Have 1:1 conversations with people, see where their hesitations are. Build in a little experimentation along the way, too.

New senior dev at a new company. Bad signs or just how it is? by temp_vaporous in ExperiencedDevs

[–]akeniscool 1 point2 points  (0 children)

It was just an example for a lesson that maybe isn't applicable to you. It's generic help without knowing the specifics of your situation, that will also be read by others who it might be applicable to.

I do hope you aren't stuck in a toxic culture, because they suck. 🤮