Hacker News new | ask | show | jobs
by askonomm 759 days ago
I just wish WordPress actually adhered to development standards, not actively tried to break them.

Using globals everywhere and encouraging spaghetti code with its classic themes, and with its new themes it evidently learned nothing and is encouraging JSON inside HTML comments which obviously has no editor support, is very prone to errors, besides being just plain stupid (like seriously, some senior engineers I assume decided to have templating inside HTML comments as JSON?). If I had my tinfoil hat on, it's almost as if they actively try to kill the freelancer or digital agency market and push everything to its WYSIWYG site builder on WP.com.

7 comments

They encourage lots and lots of bad practices. I mean, just look at themes and how they are built by default. Comments in a CSS file describe the theme metadata. Using concattenation instead of composition everywhere, so that parts of HTML are not reusable. CSS, inside JS inside HTML inside PHP ...

Part of it is this implicit structure it defines, which file it loads adter ehich other file to make a whole page. It seems convenient at first, if only you know it, but it encourages people to not properly finish all their HTML elements on the same file, but split them up stupidly and end them in other files, never to be reused.

It all seems very beginner-mistake like. But I guess they are stuck with this now, because thousands of themes rely on this, instead of having a structure based on composition. Contrast this for example with how one uses Jinja2 templates rendering blocks and macros.

Their mantra of ‘never break backwards compatibility’ is a double-edged sword.

It makes them extremely friendly to non-technical users, which I think is the majority of their userbase.

However, it makes it impossible for them to change technical decisions made in the past.

That would be fine, imo. But seeing as their new development efforts (Block/Gutenberg themes) are also making horrible decisions when they no longer have to (such as putting templating markup inside of HTML comments as JSON)[1]

E.g:

    <!-- wp:latest-posts {"postsToShow":4,"displayPostDate":true} /-->
    <div class="posts"></div>
I've lost any faith I had in their core development teams competence. I would understand if development choices made 20 years ago weren't all that great by todays standards, and never breaking backwards compatibility would be the reason it still is bad today, but their new themes can be used independently from their old themes as an entirely different implementation, so they had a chance to finally do what is industry standard, and they chose to again make it horrible to write theme markup code that is prone to errors, has no editor support (what editor supports JSON in HTML comments?) and enforces more spaghetti to be made.

[1]: https://developer.wordpress.org/block-editor/getting-started...

I think there's some confusion in your comments. The HTML comments aren't a templating language, there's no (or little) post processing when displaying this content.

They're annotations that indicate where a 'block' of content starts and ends.

The JSON data stores some values set by users for a block that can't easily be parsed from the HTML content.

The content is stored as HTML as most content a user creates is static HTML, so when displaying content much of the HTML is displayed verbatim (but without the HTML comments), and then there's only a little bit of progressive enhancement for dynamic content.

I think you're also conflating some terms, like 'themes' and 'blocks', these are two different things and launched years apart.

Not the GP, but I still remember, when I was looking for where one could set an abbreviated version of a text (I don't remember, if it was a whole post's text or some description or what.). I must have searched for 30 minutes or so, until I gave up and searched in a search engine. Imagine my disbelieve, when I saw, that they use friggin HTML comments, to indicate where to make the text cutoff. In terms of storing data cleanly in the database, this is a bad design. Also sooo unintuitive. There is a field or button for everything, but suddenly I need to put HTML comments into text. What.
You've got some pretty compelling arguments for why WordPress shouldn't work, it's I think even more interesting to figure out why it has. Especially on a site like HN, which has "terrible" UI and code, it even still uses single-pixel spacers! :)
I have not looked at the code of HN. Is it public? And what parts of it are terrible?

I think single pixel spacers and such things are of a different quality than the design (code) flaws brought up about WP though. Their impact is different. One merely influnces the layout of things while the other for example influence how whole themes are structured and how many pitfalls WP developers set up for themselves by writing unmaintainable code.

Kill the freelancer? I'm a freelancer and my favorite thing to tell cheap potential clients for the past 15 years is do their site with Wordpress and to go find a Wordpress "expert".

It exists for the broke and the cheap who are under the illusion that they need a simple website, which itself is a dead letter.

Why do you think they might be wrong when they want a simple website?
Because then he couldn't justify why these companies should continue hiring freelancers
I'm not saying they're necessarily wrong... there are certain things where a website should just be dead simple. I built a site for my mechanic, in trade for work on my car. It's like three static pages. Just something to backstop a link on Yelp and Google Maps.

I said simple websites are a dead letter, because it's no longer the 1990s. There's no cachet in them. The web is littered with simple sites that don't rank and no one ever visits. Then the owners think 'maybe I should hire SEO' or 'add a blog' and the question is "wait you built me this site, why can't you just do that for $500"? And that's why I just refer clients like that to someone who does Wordpress now. I have no interest in learning the giant pile of PHP sludge that is WP for projects that barely pay. I hardly build websites at all anymore unless they're SPAs, and only if it's functionality that can't be done with off the shelf frameworks.

To the sibling who said I'm doing this to justify being a freelancer - quite the opposite. I'm telling potential clients of a cheaper way to get what they want, and turning away work that I know is a pointless headache.

Because most non-technical people greatly underestimate all the moving parts in a website, even a simple one.

And yes some websites truly are simple and can be managed with a few Markdown pages and a static site generator (even that can be a barrier to non-technical folk), but any kind of advertising or small business website - even if it's a single page - needs the ability to be updated or managed by a non-technical person and those parts are unknown/invisible at first.

Wordpress, for all it's problems, is one possible solution that can help those people have the website they imagine or want without the sticker shock that comes with the eventual realization that their website (as a whole) is not "simple".

WordPress is simple for the user.

It’s like a lightbulb. Of course, the manufacturing of lightbulbs is a highly technical topic. However, to the user, they present a simple interface (screw it in and flip the switch).

I feel like this is a point that devs often miss. Simplicity from the POV of a user and the POV of a dev are completely different things.

The dev finds a static site generator simple, and WordPress unnecessarily complex. The user finds WordPress simple, and an SSG unusable.

It's too bad you didn't go into using WordPress for higher-end sites. We're seeing huge growth on the enterprise side, which Automattic calls VIP, including taking significant share from Sitecore, Drupal, Magento, Adobe, and many others in sites with budgets in the seven-figures and beyond.

I would say the main gating factor is the number of agencies and developers who can handle bigger clients including governments.

If I have to work with WP I always use the timber framework instead of the block/classic version

https://timber.github.io/docs/v2/

I have worked with themes that used Timber and it has its own set of quirks.

I also have an opinion that using things like Timber in WP themes just adds to the inconsistency instead of helping it. Taking over website with Timber when you never heard of it is fun.

I don't want discourage, use what you like. Just my 2 cents.

Our choice for Timber is not about consistency, is about sanity and survival.
I am by no means a Wordpress expert, but I have had to deal with moving clients sites from time to time and I have vivid memories of hardcoded absolute file system paths in the database embedded in serialized PHP that broke when trying to move their installation to a new server with mildly different pathing.
Migration is horrible right now, making it better is part of the Data Liberation focus this year.
If I recall correctly, it was double the fun when it points to the original copy of your other wp install while it’s still running.
If you adhere to development standards your users aren't locked in to your platform. They could move to better working, more manageable CMSes instead of begrudgingly having to pay someone or, better yet, move to your hosted solution to keep the platform from tripping on its own feet.

Unfortunately that could negatively affect your "Our platform powers 43.4% of all websites" marketing pitch.

Actually market effects these days make it so that clients themselves demand WordPress, and are unwilling to try any alternative platforms at all. So either I decline the client and make no money or have to use WP.
I agree that WordPress has often failed to live up to development standards, but those aren't them, those are ones that can legitimately vary between platforms.
The use of comments alongside the HTML was the result of a very long (and honestly very public) discussion, ultimately, it boils down to those reasons:

- Comments exist to define a block boundary.

- JSON inside a comment exists to load up user preferences for things that can't be easily parsed from the HTML.

- HTML has to be the final result and representations, and it has to be the source of truth.

- The outcome has to be portable to any other platform or system, you can't move the website tomorrow and get a bunch `[xyz_shortcode]`.

I encourage you to read this post by one of the senior engineers who worked on the project since its inception:

https://lamda.blog/2018/04/22/the-language-of-gutenberg/

The documentation is in itself very expansive and throughout, you should give it a read:

https://developer.wordpress.org/block-editor/explanations/ar...

Gutenberg in itself is a very versatile tool and isn't locked to WordPress btw, you can build your own editor if you want (all JS, no PHP):

https://wordpress.org/gutenberg-framework/