JSDisplomacy

Developers and contributors can find a link to our github page and engage in development project planning here.
Post Reply
Message
Author
alamothe
Bronze Donator
Bronze Donator
Posts: 2
Joined: Fri Jul 05, 2019 1:05 pm
Karma: 16
Contact:

JSDisplomacy

#1 Post by alamothe » Sun Aug 23, 2020 6:09 am

Hello,
Are there any plans to convert to JavaScript + React, like SPA?

The backend could also be converted to node.js.

What are your thoughts?

Claesar
Posts: 1965
Joined: Tue Oct 03, 2017 10:34 am
Karma: 1490
Contact:

Re: JSDisplomacy

#2 Post by Claesar » Sun Aug 23, 2020 7:26 am

I think I've heard React mentioned before, but we only have volunteer developers due to being available for free. If you wish to contribute, or just check our ideas and progress, look at our GitHub :-) https://github.com/kestasjk/webDiplomacy
1

A_Tin_Can
Lifetime Site Contributor
Posts: 283
Joined: Fri Sep 29, 2017 9:18 pm
Karma: 451
Contact:

Re: JSDisplomacy

#3 Post by A_Tin_Can » Sun Aug 23, 2020 7:31 am

tl;dr: What would such a rewrite achieve?

Longer answer:

There's not really a straightforward answer to this. Although I'm not really involved with webdip development anymore, this is something I've thought about a lot.

I think a gradual restructure of the front end is probably the way to go, long term. There are game concepts that it would be awesome to support that aren't well served by the current architecture. For example, I would love to have more granular player stats, interactive tutorials, a sandbox mode, and the ability to reason about general play patterns and openings. These are currently possible to implement, but not in a straightforward way.

As for technology choice, the real question is: why? I think there would have to be some very compelling reasons, as any introduction of any new tech makes it harder to maintain the current code. There is the nice feature that current code contribution requires only a working knowledge of html, php and SQL (very occasionally one of the JS scripts needs extending, but most changes don't touch those). Php is very well known, even if it is not well liked.

I think improving the separation between front and back end would be a win- it would allow for some creative uses like native apps and automated order improvements (for years people have been asking for forced orders when there's only one option - but in the current design, only the front end knows that there's only one option). If that separation were attempted, something like React would be a good choice - because it is well known, has a large community, and is generally an excellent choice for a web app. Critically, it isn't the hot new thing - it is clearly here to stay.

I sketched out a rough plan to uplift the front end once - I think it would be best to replace a page at a time, rather than try to redo the whole interface. This would be a nice risk reduction, as we could start seeing benefits quicker (and risks less if the project is not completed). However, if not done carefully, it could leave the code significantly worse than it is currently.

Changing the tech used on the back end is a bit harder to justify. Php isn't sexy, but it works and many people know it. It also allows webdip to keep hosting costs low, as it can be hosted on old-school colo boxes.

Ideally any new back end would support and expose the current game histories. However, this might not be as simple as moving the games over - webdip has had different rules over the years, so not all games were adjudicated correctly. Similarly, some games have only partial history. If we were to ask users to accept forgotten history, there'd need to be a reasonable benefit that they also see.

A rewrite is *significant* amount of work, even just rewriting the current implementation would be several months of full time work for one skilled and motivated person.

I'm not clear on whether you were offering to help, but my experience maintaining webdip's code base was that large projects like this have rarely been completed.
1

A_Tin_Can
Lifetime Site Contributor
Posts: 283
Joined: Fri Sep 29, 2017 9:18 pm
Karma: 451
Contact:

Re: JSDisplomacy

#4 Post by A_Tin_Can » Sun Aug 23, 2020 7:43 am

You may also be interested in this: viewtopic.php?f=16&t=934

bo_sox48
Site Admin
Site Admin
Posts: 3901
Joined: Thu Jun 08, 2017 1:01 am
Karma: 2785
Contact:

Re: JSDisplomacy

#5 Post by bo_sox48 » Sun Aug 23, 2020 9:44 pm

I’ll try and add to what ATC said from the perspective of the development team now, though I largely agree with ATC and he's right on the money with his major points.

The front end of webDip is rather complicated because of how tightly coupled it is with our server and its operations, so rebuilding it would be a bit of a challenge. Because of that, you cannot just pick a framework or library like React and go for it. Like ATC alluded to, breaking that coupled nature would be a big positive for us, particularly as an open source codebase relying on volunteers as it lessens the need to actually know how the server renders the front end to do something like create a new site theme, for example, something I did a year or so ago with dark mode. That means that rebuilding the front end would also require at the very least refactoring if not fully rebuilding the back end, which is a substantial investment.

Given that, I do not think that a true rebuild of the back end will ever happen on its own. PHP is popular, cheap to host, and obviously works well for our use here. More importantly in my opinion, it is among the easiest languages to learn. Anyone with any knowledge of code can learn PHP, whether experienced professional developer or not. That has to be our prerogative. Like ATC said, other than PHP there is very little to acquaint oneself to to assist with development on our site and that is to our advantage.

Now for a moment let’s assume that that hurdle is overcome one way or another and discuss React specifically. ATC and I diverge here; I do not believe that “it is clearly here to stay.” It is a very popular and persistent library right now, but it’s still possible that it could come and go just as Angular did when React came out and did what it did a little bit better. It is impossible to say whether React will still be a popular choice in 10 years, and if it isn’t, what do we do then? Our architecture driven by PHP isn’t the most desirable to work on for a resume necessarily, but it is a hard and fast fact that what we do will not use a strange language, nor will we be relying on a dying or dead technology, over the course of time rendering with PHP.

I also find React a little bit difficult for open source, volunteer-driven development specifically because of how quickly it evolves and how dramatically it moves. I was working with React every day for work up to January of this year and there are deprecations in their newest release that were brand new in my recent memory. As quickly as it moves, the site’s UI might be new to us and yet employ “outdated” strategies by the time it is coded, beta tested, and deployed. That scares me given how much investment it would require. Given this, in a hypothetical scenario where we were ready to take this task on, React would likely not be our first choice despite its popularity in the professional world.

For what it’s worth, I have built out some parts of the site on my own server using components provided with state as what is effectively a miniature single page application using vanilla JS. Realistically, you don’t want to construct an entire site that way, but you can use the principles that React employs in its bootstrapped code without actually using React.

Piggybacking again off of ATC, replacing individual functions or pages at a time would certainly be preferential above a total rebuild. It would require the same kind of commitment as a rebuild to keep things clean and maintainable going forward, but it could take place over an extended period and perhaps also incorporate unit testing to ensure its safety.

I also wonder the same that ATC did - are you up for helping with development?

User avatar
Chaqa
Bronze Donator
Bronze Donator
Posts: 13229
Joined: Fri Sep 29, 2017 7:33 pm
Location: Allentown, PA, USA
Karma: 7986
Contact:

Re: JSDisplomacy

#6 Post by Chaqa » Mon Aug 24, 2020 4:15 am

I do React day to day for work and I brought it up as a potential front-end solution and it was firmly put down by jmo, so there's not much point in speculation. Seems PHP is here to stay, so the focus for now if anyone has dev time would likely be the front/backend split with APIs to allow for future changes.

Post Reply

Who is online

Users browsing this forum: No registered users and 38 guests