Live data from Hacker News

Ask HN: Is web programming a series of hacks on hacks?

news.ycombinator.com

161–170 of 688 posts

Re: Ask HN: Is web programming a series of hacks on hacks?

#161
The web world is just a new world of different problems. One of the most interesting things about this world is there are a LOT of participants. A big part of the web world is diversity, it's kind of like moving from the country to a big multi cultural city. Many many many ideas are being thrown around. Finding cohesion between ideas is tricky. Being a learner in this world is bewildering.

Understanding the browser is very important, perhaps start with http://www.html5rocks.com/en/tutorials/internals/howbrowsers...

If you are a good coder, javascript can be awesome. Put a lot of time into understanding the language. Don't stray into variants like typescript or coffeescript or elm or anything else till you are pretty happy with js. Prioritize learning ES6 over any variants. The bulk of information on the net and libraries, etc is standard js.

Get a good understanding of webserver, HTTP / Web sockets. Sniff packets and also understand HTTPS.

Invest a lot of time into HTML and CSS, there's a lot of advice on how to build your own CSS frameworks from the ground up, this is really worthwhile. But also spend a bunch of time with something established like bootstrap ( or any other UI framework ) so you can see what problems frameworks are trying to solve.

Language? Frameworks? This is where it gets tricky. I suggest understanding a Node stack, as it's popular, and a lot of examples use it as a backend. It may not be what you actually end up using. Checkout Angular2, React / redux as they are popular javascript frameworks that run in the browser to deliver application like UI. However, go for statically generated pages if you don't need that kind of UI, classic GET/POST delivered webpages still deliver a lot of value.

Security / Authentication - Can be very tricky and in some environments it's left to roll your own

Data - Can be super convoluted, often taught in a web context without much concern for security and authentication (depending on stack). In general avoid having too many layers between your data store and the UI. SQL / NoSQL / BigData Stores are all toys to play with (but each data store tech has its own problems and tradeoffs) and more often are getting mixed together.

Now, because you can pick and choose nearly any aspect of the above, it can become very hackish, especially as new toys are coming along all the time.

If I was going to recommend a single thing to start playing around with? probably meteor. It packages up a lot of modern web things for you, it's all javascript, it uses a mongo back end (which is a json store, not necessarily the greatest choice of DB though), has a easy package system, and supports a number of popular front ends. None of which is how you should choose a production stack, but it can be a good way to get started.

Re: Ask HN: Is web programming a series of hacks on hacks?

#162

Earlier quoted context omitted.

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.

> "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

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.

Re: Ask HN: Is web programming a series of hacks on hacks?

#163

Earlier quoted context omitted.

> The issue from what I've seen is that people think it as if it's a class based language instead of the prototypical language that is. This always gets trotted out as the issue. "It's not JavaScript that's bad for building large applications, it's just everyone is using it wrong." Prototype inheritance is even more brittle and hard to follow than class-based inheritance which is why developers, for their own sanity,…

We put people on the moon without benefit of "scalable" languages, we built entire operating systems in C which is notorious for quickly becoming unreadable, and we've somehow built an entire world of content using HTML and CSS. JavaScript is just a language, and while improvements to it are being made constantly, the biggest obstacle is not the language, nor the way browser makers support it, but the absurdly slow p…

> We put people on the moon without benefit of "scalable" languages

The computer for the Apollo missions had approximately 64Kbyte of memory and operated at 0.043MHz. My wrist-watch is many orders of magnitude more powerful than that. But the programming effort that went into it was huge (literally: https://cdn-images-1.medium.com/max/800/1*qJnPOGdtk1q7dq17tx... ). If we were stilling coding things that way, we might be able to go to the moon but we wouldn't have self-driving cars.

> Pick a language, any language, and then restrict yourself to features only ten years old.

C# 2.0 in 2006 added:

    Generics
    Partial types
    Anonymous methods
    Iterators
    Nullable types
    Getter/setter separate accessibility
    Method group conversions (delegates)
    Co- and Contra-variance for delegates
    Static classes
    Delegate inference
Not to mention C# 1.0 already being statically and strongly typed, had properties and events, reference and value types, interfaces, namespaces, and a reasonably complete standard library. And that's just one language.

JavaScript is so far away from this it's not even funny. It doesn't even have proper numeric types. It's casting rules compare favorably with PHP!

So I don't buy the argument that JavaScript isn't suitable for large projects because browser makers aren't keeping up with the latest standards. JavaScript is a scripting language that's been pushed into tasks it's not suitable for because it is everywhere.

Re: Ask HN: Is web programming a series of hacks on hacks?

#164
post #24

Yes. I feel like we're in the dark ages right now. JavaScript - Dynamically typed, does not scale what so ever. Code written in it becomes 'read only' very quickly. Impossible to refactor. CSS - Also becomes impossible to manage. Who knows if the class you wrote is or isn't being used in HTML or JavaScript somewhere. Same problem, read-only, it only gets bigger and more unmanageable. HTML - At the heart of it, the fo…

CSS is not impossible to manage if you keep things modular and avoid specificity issue (basically, use something like BEM and pretend the "C" in "CSS" doesn't exist).

re: HTML: layout and positioning is the domain of CSS, not HTML. HTML's purpose is to provide semantic structure to the content and non-semantic styling hooks (divs and classes) for CSS.

It's true that layout has sucked for a long time (more accurately, it hasn't really existed in CSS), but with the coming grid spec, it will finally get a lot better. Flexbox is great for solving certain problems, but wasn't intended to deal with overall page layout. (Basically, flexbox is for laying out one dimension -- a single row or column -- whereas the grid layout spec will handle two-dimensions.)

Re: Ask HN: Is web programming a series of hacks on hacks?

#165

>Can you recommend any good resources to help me orient my mind to this new way of thinking? The thing about web frontend development is that it suffered from the browser wars and having to appeal to amateur developers. Amateur developers love "Worse is Better"[1]. Basically sacrifice all consistency in favor of simplicity and getting started quickly. "Worse is Better" makes things simple to the point of making ugly…

Angular feels clean enough, but how do you implement internationalisation properly? How do you switch to angular 2 now that angular 1 is obsolete? Same thing with bootstrap (v2 is largely incompatible with v3 which is mostly incompatible with v4)... Backend is okay; frontend really is a clusterfuck, because it seems all built for short-lived, one shot applications. I build professional applications that have to live and evolve for ages, and I'd rather not rewrite the 80000 LOC of code for every brand new shiny incompatible material design fully reactive 3D enabled VR compatible à la mode fashionable trendy JS+CSS framework that'll be obsoleted in 9 months.

At the moment, I really don't know what to do. Looking at the way people build applications nowadays (does somebody NOT use node.js and npm at some point?) with layers upon layers of languages, frameworks, 4 different module management systems, with READMEs that read like "install the dependancies using "gem install A B C; pip install E F G; npm install X Y Z; go install U V W; cargo install P Q R; then proceed with curl https://github/myshit/install.sh | bash" is really tiring.

Ghaaaaa!

Re: Ask HN: Is web programming a series of hacks on hacks?

#166
post #24

Yes. I feel like we're in the dark ages right now. JavaScript - Dynamically typed, does not scale what so ever. Code written in it becomes 'read only' very quickly. Impossible to refactor. CSS - Also becomes impossible to manage. Who knows if the class you wrote is or isn't being used in HTML or JavaScript somewhere. Same problem, read-only, it only gets bigger and more unmanageable. HTML - At the heart of it, the fo…

Languages don't scale. Systems scale. Without said, Javascript has never really been the language for programming in the large. But make no mistake about it, it's slowly getting there as is evident by huge applications, not just web but even desktop that are being built with it. It's not impossible to refactor. The issue from what I've seen is that people think it as if it's a class based language instead of the prot…

What huge application are built with javascript? Visual Studio Code is probably the biggest I can think of and I don't know what would be second.

Re: Ask HN: Is web programming a series of hacks on hacks?

#167
I think what saddens me with web programming, is constant rewrites of the same old projects, that pretty much do the same thing. As a community we'd be better to focus on a few core APIs like a web shop or a booking app.

A church or school could have a common underlying built platform. Where functions of outfits are unified, we could drop in one size fits all solutions.

In England (UK) you have about 24 thousand schools these could be aided/driven by a few competing platforms. Charities and small shops likewise.

Platform constraints can also help. Having fixed html, perhaps would let designers just swap out CSS and imagery - job done.

Much web work is a brain drain, and a lot of good talent in my eyes is being squandered on petty engineering problems, when there is still a world out there that needs putting right.

Re: Ask HN: Is web programming a series of hacks on hacks?

#168
post #24

Yes. I feel like we're in the dark ages right now. JavaScript - Dynamically typed, does not scale what so ever. Code written in it becomes 'read only' very quickly. Impossible to refactor. CSS - Also becomes impossible to manage. Who knows if the class you wrote is or isn't being used in HTML or JavaScript somewhere. Same problem, read-only, it only gets bigger and more unmanageable. HTML - At the heart of it, the fo…

> HTML - At the heart of it, the foundation is the layout engine and positioning

I'd oppose: HTML is particularly a Markup Language for (more or less) semantically structured static documents tied together with Hyper Text links (see the abbreviation?). It has with very limited (if any) amount of layout, positioning and visual hints incorporated; these things are supposed to be left for the CSS.

Re: Ask HN: Is web programming a series of hacks on hacks?

#169
post #24

Yes. I feel like we're in the dark ages right now. JavaScript - Dynamically typed, does not scale what so ever. Code written in it becomes 'read only' very quickly. Impossible to refactor. CSS - Also becomes impossible to manage. Who knows if the class you wrote is or isn't being used in HTML or JavaScript somewhere. Same problem, read-only, it only gets bigger and more unmanageable. HTML - At the heart of it, the fo…

While I agree with most of what you wrote, I also understand where it all came from. We have a handful of browsers which all implement w3c guidelines in their own way and there's no single de-facto standard of how one should write for web. Yet we write milions of different websites and they have to be properly displayed on at least a couple of popular browsers, no matter how bad they interpret the guidelines.

Yes JS is a major pain in the a and there are loads of various packages achieving the same things floating around, there's no agreement regarding which package manager to use and everybody uses different implementation or wrapper (es6, es7, typescript, flowscript, coffee), but if you look around you can find solutions that are actually really helpful to manage the mess. It helped me a lot when I started to write JS in a OOP fashion utilizing dependency injection and MVVM. The real trick is to realize which technology is really helpful and which is just bloat. I don't think this is much different from the backend programming.

In terms of CSS it's a whole world on its own and I keep repeating that managing it properly is well underestimated. It requires making lots of predictions about how you might extend your site in the future. Luckily, there is also plenty of great reusable boilerplates made by very smart people like bootstrap or materializecss. Bootstrap did change a lot how we write and think about our styles. Btw, leave classes for styling and use ids for js instead.

Finally, I don't agree with your opinion on HTML at all. It's super simple and you can build anything with it. I have learned the basics and built my "home page" when I was 12. These days kids are probably building sites before they even go to school. Also, as mentioned above you have to fit dozens of different browsers and hundreds of thousands of various devices. I find building UIs on iOS and Android not much easier, even though you build for a single system. Nonetheless I'm waiting to see how people could improve building UIs in the future, without falling into "everything looks and feels like wordpress" kinda world.

Re: Ask HN: Is web programming a series of hacks on hacks?

#170
post #58

Earlier quoted context omitted.

This post makes me sad. Javascript, CSS and HTML can all be used powerfully, performantly and in a managed way where anyone can come on board and contribute. Facebook, Google and Microsoft all use the web stack to run huge companies. To broadly paint this web stack that so many people poured countless hours into making, as 'impossible' to use is doing it a great disservice. But hey man, that's just like your opinion.

What's sad is the zillions of hours wasted by engineers on an inherently flawed stack. What's sad is how ridiculously complicated it is to create and manage relatively simple UIs. What's sad is an entire generations of programmers growing up and thinking this is normal. Programming is supposed to be about creating platforms for each other so we can continue solving higher (and higher) level problems. This web crap ha…

Interesting, what native UI system is in your opinion easier to work with than web? Why then so many devs choose to use WebBrowser wrappers to render their desktop/mobile UIs because it's way faster and easier to develop with?
Post reply on HN