DEV Community

Discussion on: What’s an unpopular software opinion you have?

Collapse
 
tarialfaro profile image
Tari R. Alfaro • Edited

And yes, the modern URL routers usually use regular expressions and fancy stuff to make URLs pretty. While it does make it slower, a lot of these sites aren't going for performance, they're going for development speed, and I have both built and used "URL routers".

Their goal is to implement something in the language the developer is familiar in, making it easier for them to write code.

If you were expecting 10,000+ requests a second, then yeah, you wouldn't want a "URL router".

Collapse
 
rhymes profile image
rhymes

True, but the best routers should compile those regexps to have near zero overhead ✌🏾

Thread Thread
 
tarialfaro profile image
Tari R. Alfaro

Oh? You can compile regular expressions ... ?

Thread Thread
 
rhymes profile image
rhymes

Sure, for example:

Basically you turn the regexp into a cached internal object that has very little overhead during the pattern matching.

Thread Thread
 
tarialfaro profile image
Tari R. Alfaro

That's neat. Thanks! I didn't know you could do that. :D

Thread Thread
 
rhymes profile image
rhymes

It's very useful if you have to match a regexp in a loop for example. You only construct it once :)

Collapse
 
darkain profile image
Vincent Milum Jr

Both of those things above are directly related for me. There are better design patterns out there that are simpler, easier to implement, easier to understand, and significantly more performant. Yes, all of these, all at the same time.

I get why these tools work for others... but the whole point was "unpopular opinions", which mine is. ;) And it is based purely on 20+ years experience as a software engineer developing software at pretty much any scale (microcontrollers to fully distributed server clusters across multiple datacenters)

As time permits, I've been documenting all of my notes on this, but it is a very lengthy process. But it essentially comes down to attempting to create a zero-boilerplate-framework. Pretty much just create a new file, have the text "hello world" in it, nothing else, and it works. Need more? Simple enough to add more. URL Routers and MVC frameworks add additional and often unnecessary extra boilerplate to get the same job done.

I truly believe our ultimate jobs as software engineers should be to simplify tasks as much as possible, not add more barriers to entry with frameworks which get in the way of simple tasks.

Thread Thread
 
tarialfaro profile image
Tari R. Alfaro • Edited

Hmm, that's very interesting. How would you go about making a framework that simple, but flexible at the same time?

If you're working a project like this, I'd love to see it.