Hacker News new | ask | show | jobs
by wpdev_63 2901 days ago
It would be amazing if they rewrote wordpress in C# using modern design patterns.
5 comments

You could take “C#” out of that sentence and still be accurate.

Wordpress is not and I imagine never will be anywhere close to “modern design patterns”.

It’s not even close to old design patterns, unless Heinz has a namesake software design pattern.

Wordpress uses practices that were considered a bad idea a decade or more ago, and still refuses to change.

You can also take "modern design patterns" out of that sentence and still be accurate. Its usually just a form of cargo-cult-programming that hasn't been found out to be terrible yet.
For clients and writing actual content nothing beats Wordpress. The editor is great and a lot of people have used it before so, from a developer point of view, I believe that with Wordpress you should give people what they want. The alternative of demanding they use some 'better' CMS means that the content never gets written or updated.

However, not to disrespect the work that has gone into Wordpress, how hard can it be to write something better for the frontend and get marketplace adoption?

I do not like the frontend 'coding standards' and mess of plugins. Starting straight from the raw wp_ mySQL tables is a less insurmountable task than hacking some theme and bloating it out with 'jQuery' plugins that should never have been plugins. It seems that it is the ecosystem of design agencies with their lorem-ipsum big-up-front-designs and allegedly 'agile' workflows that have made Wordpress into something I do not like working with. Particularly when the add-ins make the backend far removed from sensible, making it a nightmare CMS for clients.

Hasn't anyone written a decent frontend for it that is not a tacky theme with ten thousand lines of CSS of which 97% is not used and a megabyte of scripts to get the carousel and share links working?

> how hard can it be

Hard.

Very hard. Especially because you first have to pick something as well installed and supported on hosts as PHP to even get traction. Good luck there.

Then you need to be at least as good in most or all features on launch to get any mindshare. Hope you have a few years to work on this side project before you release...

There have been plenty of attempts and of them all Ghost is about the only one to be taken seriously it seems and it’s niche at best (and not yet at the same level of features or ease of use & configuration).

So yeah, the answer is hard. Harder than you think.

Just considering the wp text editing box in isolation, it's a hideous masterpiece of a thing, that, alone, would take forever to rebuild.
"refuse to change"? It's not easy to change something used by more than 50% of the internet.
Do you have any examples of the bad practices you are referring to?
Examples include: use of globals, inefficient queries, mixed templating, lack of namespacing, doesn't follow PSR standards.
They actively refuse to use parameterised sql queries, opting for their own home baked userland implementation instead.
Probably the use of globals etc. This might also be a backwards compatibility thing though.
Developing anything for wordpress is a nightmare, it's not only PHP-nightmare, but also plenty of bad practices, poor API, wired workarounds...
Then perhaps, in true open source fashion, you can put your time where your opinions are and either start another project or help the wordpress team to correct what you think is bad.
There are already lots of CMSes out there.

Changing WP to use more modern design patterns (whatever that would entail) probably means breaking all themes and plugins, which isn't acceptable (and even if that wasn't an issue, I doubt the WP maintainers would just accept a PR that completely rewrites everything). This isn't really a thing random contributors can help with.

In the sense that (IMO) most people don’t need Wordpress, I am, I am (slowly) working on (yes another) static site generator.

But, in response to your general theory: I can criticise a car as being fucking terrible without someone suggesting I “go build my own then”.

The first step should to be to rewrite in PHP 7 using modern design patterns. I don't think C# would add much there.
One of the major selling points of WordPress is its huge array of 3rd party plugins. You'd need to port the most popular ones before the C# version got any traction.

How's Linux for .NET hosting? Because Linux hosts are generally cheaper than Windows hosts.

> How's Linux for .NET hosting?

For .NET Core there are binary packages [1] for Debian/Ubuntu, Fedora, Red Hat and SUSE, so you can apt-get/rpm/yum hosting environment in a matter of minutes. I'd say it's easier to set up and run ASP.NET Core app with Apache or nginx as reverse proxy than with IIS. For "old" .NET you are stuck with Mono [2] which works okay-ish if you don't use Windows-only dependencies.

[1] https://www.microsoft.com/net/download/linux-package-manager...

[2] https://www.mono-project.com/

I've been having great luck with ASP.NET core / nginx. Very stable, low overhead with 40k req/sec served in a ubuntu VM. I hate MVC, so I've been using Nancy (Sinatra based) as the web framework. I'm highly confident in .NET Core being production ready.
The avantage of php for a self hosted bloging website is that php is installed in almost every hosted server and that makes WordPress easy to install.
Decompile the resulting library and start refactoring and adding comments?
Why would you start with a decompiled binary when the source code is available?
Because then you don’t need to look at the source code