DEV Community

Discussion on: What do you think about the idea that "there should be only one way of doing a thing" in programming languages?

Collapse
 
taillogs profile image
Ryland G

The idea of "one way to do things" originated from the Zen of Python. This quote has been taken out of context and distorted, here is the original

There should be one-- and preferably only one --obvious way to do it.

I think the rule makes sense as it was originally stated. Strive for one way, make it obvious, don't beat yourself up if it's not possible.

Collapse
 
pulljosh profile image
Josh Pullen • Edited

Creating one obvious way to succeed sounds an awful lot like designing a Pit of Success:

I've often said that a well-designed system makes it easy to do the right things and annoying (but not impossible) to do the wrong things.

Collapse
 
renegadecoder94 profile image
Jeremy Grifski

What a great link! I had never heard of a pit of success before, but I’m on board. In terms of pits of despair, C++ was the exact language that came to mind when I jumped in on this thread.

Thread Thread
 
jhuebel profile image
Jason Huebel

I personally would give C/C++ a pass. It's a foundational/architectural language, so it should be flexible and shouldn't hold the programmer's hand. I don't think C++ is a language that needs to be fixed. But I do think it's a language that not just anyone should use.

But for higher-level languages like Python, Ruby, PHP and the .NET variants, I would agree that having one obvious way to do things is the best policy.

Thread Thread
 
renegadecoder94 profile image
Jeremy Grifski

I’d definitely give C a pass! I feel like it’s a pretty straightforward language. You just have to do everything yourself. Haha

Collapse
 
jacoby profile image
Dave Jacoby

Snipe: if only they kept that philosophy to package management.

::ducks::

Collapse
 
taillogs profile image
Ryland G

That shit is a disaster. I don’t really use python and that’s definitely a contributing factor. Why should I have to use venv?

Collapse
 
autoferrit profile image
Shawn McElroy

Totally agree. I love python and is often my goto. But its been so bad for so long. It IS getting better. pyenv/pipenv make it way better for one. pipenv still isn't what you need if you are publishing libraries on pypi, but I think its a good start in the right direction.

The packaging should be built in. To me, Rust/Cargo so far has some of the best packaging around.