Giter Club home page Giter Club logo

Comments (6)

BennyJake avatar BennyJake commented on May 18, 2024 2

No problem! I've looked at #22, and personally, getting a routing library in place is the first step. The second step would be adding a container. Adding a container would allow you to remove all your static methods/classes, and set your parameters dynamically. Doing ALL of that would allow you to remove your globals - but it would be a pretty big undertaking. I'm not sure you could take a shortcut in doing #22, but it wouldn't be very pretty or long-lasting.

I'd really like to help you out, but in the list of ways to modernize this app, #22 might be towards the bottom of the list. Towards the top would be finish setting up a routing library and forwarding all routes/urls to index.php. Your second step would probably be creating dedicated classes for certain routes/actions, like 'games' and 'profile', etc. Cut out all the if/else logic in your code based on what route a user is taking or which form is submitted - that can get really confusing, and is hard to maintain.

Let me know if you're interested in any of this - I'd be happy to set up tickets for these things. I would like to help with #22, and I've tried in my own development, but it's going to be pretty near-impossible without these other updates.

from phparcade.

shrink avatar shrink commented on May 18, 2024

You would usually use an ID in a URL like this to explicitly allow for the possibility of the non-ID part of the URL changing. For example, if you rename a game from The Weakest Link Beta to The Weakest Link you do not want previously used game/1613/The-Weakest-Link-Beta.html links to produce a 404.

The solution to ensuring there is only one single path to a game is to generate and store a canonical path (e.g: game/1613/The-Weakest-Link-Beta.html) and 301 redirect any request from a non-canonical path to the canonical path. This means that if the canonical path changes (e.g: game/1613/The-Weakest-Link-Beta.html becomes game/1613/The-Weakest-Link.html) all existing links will continue to link to the intended page (through a single redirect).

from phparcade.

BennyJake avatar BennyJake commented on May 18, 2024

I can come up with a routing solution for you. Would you prefer @citricsquid's approach?

from phparcade.

Sageth avatar Sageth commented on May 18, 2024

That would be an amazing help. That approach sounds fine.

from phparcade.

Sageth avatar Sageth commented on May 18, 2024

Thanks for the contribution. This has an interesting (positive) side effect where it seems that it "bypasses" the score submit page, but the score still submits. Maybe this just made it ultra fast? In either case, scoring still works, but anything that reduces wait time is a good thing.

I'll have to look into phroute more, but I think I'd like to do something similar with the profile/ and page/ pages, ideally to eliminate the massive array that it uses now (which is a holdover from when the app was first written in PHP3). Something we can look at more in #22 but if you don't mind, I may reach out to you around that change. Unless you want to take that one on too.

Thanks again for the help here. In my mind, this is a big step in making the code more flexible for the future.

from phparcade.

Sageth avatar Sageth commented on May 18, 2024

Yep, I fully agree with your assessment. I haven't worked too much with routing libraries (other than just plugging them in with something like CI or Laravel), so this is a bit new to me. It's been on my list for a long time -- long before I got permission to make this open source, so I'm not in any rush. Though repo corruption caused me to lose most of my commit history and I can't really prove it, it's come a long way. For example, at the start of this year, there were no classes anywhere and nearly all functions in the entire codebase required globals (I removed/refactored most of them).

The code base has a long way to go to get it to be where I'd like it, but the ride to get there has been a great learning experience.

My other life commitments only allows me to do work on the project in spurts, so I'll definitely take any help offered (whether it's just idea generation, one line, or 10,000 lines) and truly appreciate your contributions thus far.

from phparcade.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.