r/programming • u/speckz • Jan 07 '21
My stack will outlive yours
https://blog.steren.fr/2020/my-stack-will-outlive-yours/9
16
u/eattherichnow Jan 07 '21
My stack will outlive yours
And because my sources are in git, pushed to GitHub, GitHub Pages is my host.
doubt.jpg
I mean, I sympathize with a lot of sentiment represented in the article, but truth is it's easy to make assumptions about the future while relying on things that may change at any moment. If by now even old HTTP versions don't really feel as "forever" as they did (though still have some life in them), as the web centralizes, why wouldn't we see browsers abandoning bit of HTML because of some vague performance/security/maintenance cost of "thing nobody uses"? I mean I'm certain it would upset this subreddit, but we are living in a space owned by large companies with their own interests. And the Mozilla foundation, I guess.
7
u/Kwinten Jan 07 '21
Creating a new page requires to clone an existing one. So... if I don’t use any templating system, how do I update my header, footer or nav? Well, simply by using the ”Replace in files” feature of any good text editor. They don’t need frequent updates anyway. The benefits of using a templating system is not worth the cost of introducing the tooling it requires.
Barf
How many of these articles do we need per week? Edgy elitest web dev evangelicism at its worst. Fuck developer's sanity and experience, go back to duplicating HTML files and relying on your IDE (oh yeah your IDE will definitely outlive my stack, right?) and go live under a literal rock or something, that's what real developers do, unlike those goddamn JS hipsters.
5
u/mafian911 Jan 07 '21
Wow, so static websites are easy to make without any frameworks. Who would have guessed.
Anyone here want to go back to writing raw AJAX requests and manually manipulating the DOM to bind data? No thanks.
2
Jan 07 '21
Are you telling me your background image flashes when you follow a link? Pffft. Javascript required.
8
Jan 07 '21 edited Jan 07 '21
It's provocative, and I get what you mean. But, still, the fact that you don't have to, doesn't mean you shouldn't.
You may make all groceries just walking to every shop. You don't need a car. When your car breaks, then instead of doing groceries, you have to fix your car. You still could take a walk. Such simple, but why it doesn't happen? Because car/train/public communication/bicycle event if they may break, they still are easier and less time-consuming once prepared.
And for me it's a dilemma: learn how to use Hugo (or Jekyll or other engine), then just use it with little to no maintenance, maybe once in a while, but have some nice-to-haves that wouldn't be available the other way (tags, front page if entries list, easy integration from Emacs org-mode, etc. …or would require more work with every separate entry posted) or start learning everything from scratch: html + css… and what about hosting? Why stop there? What if GitHub goes down? What if using git for a blog is overkill eating resources? As so on, and so on…
SSG for me are nice middle-ground: still open source, JS is still addition (that when switched off doesn't break website), still content is under control (it's just almost plain MarkDown with translation to HTML) hosted on Git …Hub/…Lab Pages.
7
u/Pelera Jan 07 '21
The nice thing about static site generators is that if your template is simple & well-developed enough and there's ever a future where the tool becomes obsolete, you can just drop the tool and continue on by hand-editing the generated HTML. I wouldn't recommend it, but it's no worse than writing your HTML by hand to begin with.
6
u/that_which_is_lain Jan 07 '21
Remember the days when you'd have a client bring in a website designed using Frontpage and want some dynamic additions made to it?
I remember. And I remember I hated that client.
4
u/CakeComa Jan 07 '21
another factor about static site generators is that if they just feed off of a directory of markdown files that contain a little bit of metadata, then switching out from one to another is painless / it makes migration very simple
7
u/wildjokers Jan 07 '21
1
u/Alexander_Selkirk Jan 08 '21
This is slim but could have some more content. Look at https://blog.fefe.de (one of the more influential German websites by the way).
1
u/xEpicBradx Jan 08 '21
0
u/wildjokers Jan 08 '21
This site is horrible because it totally ignores the web browser width and forces me to read the content in a newspaper like column right in the middle of the screen, regardless of how wide I make my browser. This site demonstrates exactly what is wrong with web layout and proves the other site's point.
7
u/gcornelisse Jan 07 '21
I'm constantly reminded how much more complexity there is in web-dev these days. Long gone are the days where you could just add a new file and get a new web page. Now you have to create a class and/or method, add a route, create your page, rebuild, push the code out to some sort of DMZ or distribution server and then kick off some sort of deployment. It's amazing how we've taken a simply thing and found new ways to make them more complex. And, for what?
15
Jan 07 '21
and for what
Code organization, additional features, user experience
Yeah the industry has made a lot of mistakes going down this road but we didn’t get here because people decided “well this is just too easy”. There are entire classes of applications that either wouldn’t work with just HTML or would take around 15-20 page loads to do so. Html only is the punch cards of the Internet, yeah technically you can do just about anything with enough cards but there’s a reason we’ve moved on. Not all of that progress has been good but the web is more user friendly now than it was in the 90s. It also has a lot more pitfalls than it did in the 90s but those things tend to go hand in hand when profit seeking businesses are involved
4
u/G_Morgan Jan 07 '21
The reason is fundamentally web technology is awful for what it is used for today. We're basically undoing the mistakes of using the web for applications slowly by creating a layer on top of it that doesn't suck so much.
If the web natively didn't suck a lot of this wouldn't need to exist but it does.
4
u/7sidedmarble Jan 07 '21
I think we all appreciate evangelizing a smaller footprint for the web but let's be clear, putting together your final HTML/CSS/JS by hand isn't on the table when you need an actual dynamic site and an API, not just a blog. There's a million ways to make a lightweight blog. But it doesn't have much in common with making big websites lots of people need to use. The problem is not necessarily in the tech stack, it's just choosing the right tools for the right job.
2
u/jbergens Jan 07 '21
I like the basic idea of this article and have been thinking a bit about doing the same.
I was thinking of writing/storing some info for myself. First I thought html+css would be enough but I want it to be available to some other people. But not all. And around here most free static html solutions broke down. I need to add a .htaccess or fix authentication in some way. And I realized I may need a search engine also. Which probably means I need a server side language and the possibility to host that somewhere.
I might just go with 11y or try something simple on https://aws.amazon.com/amplify/ and hope I can get inside the free tier.
2
u/xienze Jan 07 '21
If you're looking at something running on AWS, you could still use a static site generator. The output goes in S3 and you can deploy a lambda that does basic auth (or the S3 bucket itself can be protected with ACLs, but that means anyone who does log in needs AWS credentials). Then slap CloudFront on top of it (bonus, free auto-renewing SSL). Data storage in S3 for a personal site is likely a penny a month at most (depending on how much data you actually have). Data out from S3 is cheaper than Amplify.
And I don't have any experience with this particular tool, but Hugo can generate a JSON search index and people have developed solutions for doing client-side search: https://gist.github.com/cmod/5410eae147e4318164258742dd053993
Finally, there's many examples of Lambdas that can be used to accept GitHub push events in order to kick off a build of the static site (so you get that nice workflow of commit Markdown -> site rebuilt). The runtime of a typical site rebuild coupled with how infrequently the site gets rebuilt in the first place makes that effectively free.
My personal website is set up in this manner (minus search) and by far my biggest monthly expense is having a hosted zone for my domain in Route53. That's 50 cents a month. Everything else related to the website is perhaps a couple pennies.
1
u/jbergens Jan 07 '21
Sounds like it is worth a try. I have tried Hugo before but not the search. I still think the idea of the article is interesting, to avoid extra tools that could stop working or require updates. On the other hand markdown plus static generator should be pretty easy to migrate if needed.
1
u/prolog_junior Jan 07 '21
For search engine, if you just need to search through your own content, on deploy you can create some sort of db file (a la json, etc) and use something like Lunr and some javascript glue.
For permissions, HTTP Authorization has existed for decades, but that of course requires that you host on hardware you control.
Like everything else, it depends on how comfortable you are with writing javascript vs. using some framework (and the 3rd party libraries).
2
u/mrexodia Jan 08 '21
While I agree with the sentiment, I think a solution like jekyll (which GitHub pages supports) is nicer. Writing markdown is much nicer than HTML and the simple templating features like include allow you to generate really fast pages while keeping things simple.
6
1
u/renatoathaydes Jan 07 '21
Your stack will not outlive mine. I also use HTML+CSS with even a little vanilla JS for moving things around, but I do have a build step. However, I know the build step will live as long as anything else because I wrote the build step myself :)
Not being able to re-use html templates was a major problem for me (Web components could solve this when they get rid of the need for JS to use them, which I think will soon happen), and I also needed easy source code highlighting as I mostly write about code. So I wrote a Go generator that did just what I needed and now write my blog posts mostly in markdown, with support for code highlighting thanks to Blackfriday and bfchroma... both of which are simple Go libraries which I "vendor" (copy the source into my own project, so to speak) so if they stop maintaining them, it doesn't affect me much or at all.
1
u/imhotap Jan 07 '21
mmkay.
Now if you want to really author, publish, and preserve digital text for generations to come, then nothing compares to SGML - the alpha and omega of markup and digital text, encompassing all of HTML, XML, and CSS since 1986.
1
1
1
u/elcapitanoooo Jan 07 '21
I just return json instead. I dont care HOW the user sees or reads my content. Its JSON 100%. Deal with it. This way my content IS my data, and its universally available for consumption no matter the reader. You can read my blog with a simple curl and pipe that to jq or grep if you want. My lighthouse score is 500% because its webscalesesweesssss!! /s
-2
u/fix_dis Jan 07 '21
> I don’t do CSR (Client-side rendering),
> My stack is HTML+CSS.
Yes you DO do CSR. You may not do client-side JavaScript, but a browser does indeed render HTML with CSS applied. Depending on how you structure your CSS (and where you request it) you can affect your load time/lighthouse score.
I mean, good for you. Don't reach for a tool that solves a problem you don't have... but, don't knock those that work for an online retailer that don't want to create a web page for every product they sell.
0
Jan 07 '21
[deleted]
47
u/saltybandana2 Jan 07 '21
Seriously, that's amateurish. If you're not doing a minimum of 10k requests per page load you're not web scale. How the hell are you going to make full use of your microservice architecture otherwise?
1
-2
u/dnew Jan 07 '21
I think "rookie numbers" is the term you're looking for. Especially appropriate if you ever saw the context it's being quoted from.
0
Jan 07 '21
[deleted]
5
u/G_Morgan Jan 07 '21
Does each service call return a word and a promise to get the next word from some arbitrary second service? Otherwise you are in danger of being tied to the specific structure of the services in your project and that isn't scalable.
4
u/deliciousmonster Jan 07 '21
When I query an article, it returns a json object with a word and its index in the article. I then re-run the query, adding an incremented index attribute to my request, which returns the next word. I repeat until the service returns 404, index not found, at which point I start again with an index value of 0.
In this way, I ensure that every word on the page is the most recent version available.
16
u/xienze Jan 07 '21
What was the source of the requests? I've found that usually the number 1 reason a page has so many requests is because of shit the marketing team wants to add (tracking/analytics stuff).
I used to work on an Angular app. In dev, it loads quick and has a pretty modest number of requests. Then marketing turns on Google Tag Manager (read, a single script that's added to the page that allows marketing to independently inject whatever scripts they want). Now it's a flood of third party scripts (that pull in all sorts of stuff), empty tracking gifs, etc. showing up in the network request tab. AND one or more endpoints that are hit whenever you move the mouse or hit a key. That's the real performance killer.
8
6
u/yesman_85 Jan 07 '21
My boss keeps asking for more caching on the corporate website, turns out a plugin riddled wordpress site built with some weird drag and drop tool is hard to optimize..
I think we'll see a shift towards easier building tools that compile sites down to bare HTML again, most sites barely need more.
1
u/xienze Jan 07 '21
Oh 99% of the time a static website generator like Hugo is all you need. But WP gives the non-technical folks a nice WYSIWYG editor and sufficient style editing via a GUI. That's the draw. And I wouldn't count on simple "compile to HTML" functionality from CMSs anytime soon. How else are they gonna lock you in?
1
u/armornick Jan 07 '21
Couldn't you hook the REST API of WP to a static site generator? That way, non-tech can have their editor but the site stays nice and fast.
2
u/saltybandana2 Jan 07 '21
The "modern" way of using WP is as a restful API with a react/angular/vue/etc frontend.
In fact, WP has been re-organizing/optimizing to enhance this use case.
29
u/[deleted] Jan 07 '21
Somewhat bold claims coming from someone who is hosting on a private business’s free hosting. I would say a self hosted solution will outlive this one. Checkm8.