Lurker News
Been doing application development, primarily backend development, for a number of years. I've always found it quite easy to move up and down the stack and work anywhere from UI down to the bare metal in a number of environments and languages, and always the 'fast learner' who quickly knows the system inside-out, even when thrown into some area that I've never seen.

Lately I've been doing some web development on a fairly long-lived and large code-base, but I'm finding it MUCH harder to wrap my head around than application development ever was. I think my difficulty is that the whole environment feels so... HACKISH... everything is a horrible hack on top of a horrible hack. (yes, I'm familiar with the history, been using the Internet since before the web) I'm not even talking about the fact that everything has to be stateless, in fact I develop desktop apps as stateless even driven UIs as well, but just the fact that it really feels like there's no consistent way to do anything, there are 1000 different frameworks, all with their own way of doing the most basic tasks, and my experience is that they all ... well... suck.
Am I missing something? Is it me resisting change? Is web programming really that bad? Is it really just that I need a new mental paradigm?
Can you recommend any good resources to help me orient my mind to this new way of thinking?

Comments (661) 164 threads

Show all comments

Showing thread 16 of 164

jorblumesea3 replies#
While I hate css, sort of like js and hate html layout, a lot of the problems come from accessibility. In that, it's so accessible anyone can do "web". This means you get non-engineers with no engineering background put into situations where thinking about things from an engineering perspective would really help and might produce actual workable solutions.

Like wtf is this:
https://www.npmjs.com/package/string.prototype.endswith https://www.npmjs.com/package/ensure-string-endswith
str.slice, str.indexOf are standard lib. Adding another layer of complexity for basic string functions that could easily be done natively is very poor form. This kind of stuff happens all the time in the web world. There's a layer of "lack of competency" bootstrapped on top of what I would consider a non-intuitive base.

roblabla2 replies#
Errm...

- "test".indexOf("st") == "test".length - "st".length
- "test".enddWith("st")
Am I the only one who thinks the second one is WAAAY more readable? And that's a COMMON function. Using the former is bringing complexity UP.
Not to mention, endsWith is part of es2016 I believe. So this package is just a simple polyfill.

EnigmaticLion1 reply#
> "test".indexOf("st") == "test".length - "st".length

I don't think this is a correct implementation of "endsWith".
"testtest".indexOf("st") =/= "testtest".length - "st".length

roblabla3 replies#
Good point. Should have been

"test".substr("test".length - "st".length) === "st"
Or is it substring? Might there be an off by one in there? Anyway, this kind of reflexion only proves my point. There's no reason to question what endsWith does, because it's obvious. It's the correct abstraction in many cases.

Continue this thread — 3 replies

dbkaplun#
- "test".match(/st$/)
mashlol2 replies#
I don't understand the problem with those modules. Just because you can do something one way, doesn't mean you shouldn't add an easier and better to understand way. The intention of `string.endsWith('Blah')` is easier to understand then `string.indexOf('Blah') === string.length - 4`. Java String has both `indexOf` and `startsWith`, do you think that is also problematic?
jorblumesea1 reply#
It's added complexity because it's not std lib. Importing an entire module just to accomplish something you could easily do with 1 line of code. I'm not arguing that javascript shouldn't have `startsWith`, just saying there's a large overhead associated for a relatively minor performance increase. Thus going back to the debate about proper engineering. Just my 2 cents, feel free to ignore :)
Klathmon2 replies#
But it's not "An entire module", it could be as simple as one line.

I know people like to go on about how every module increases complexity by some massive amount, and how you are relying on X number of other developers and systems that can break now, but the NPM/javascript way is the unix philosophy taken to the extreme. Lots of small modules, extremely easy to use and install, that all do one thing and do it well.
There is no overhead to using a small module. It takes seconds to install, in some cases adds literally bytes to the output, and can take care of a lot of hidden complexity like defaulting to using the stdlib version if it exists, and being fully tested (because let's be honest, you aren't going to write 15 tests for a string-ends-with function).
Also, it's not as simple as 1 line of code. Look at the String.prototype.endsWith library. Look at the edge cases it supports, look at the way it does the search to be efficient. your one-liner might seem to work on the surface, but when you use it in a .apply it might blow up, when you try to get it to run on IE8 for some reason nothing works, when you go to run it on a million strings, the whole system bogs down.
There are benefits to using modules where someone has spent the time and effort finding and fixing those edge cases.

Continue this thread — 2 replies

sheriffderek#
I prefer writing instead of

:p

jorblumesea2 replies#
How well supported is ES6 across browsers? Chrome for sure. Not sure about FF or IE.
astrodust1 reply#
You can transpile to ES5 if you've got compatibility issues. Not really a problem.

Continue this thread — 1 reply