Skip to content

[Discussion] Consider using some (MVC) framework for the web-interface and API? #198

@nickygerritsen

Description

@nickygerritsen

While talking to @tuupke about some DOMjudge ideas (mainly for the still WIP online judge rework thingy of us), we ended up in a discussion about why we are not using some framework for the web interface and API.

I partially know the answer myself (no experience and it grew this way), but I think we should start considering it. Last weekend during the hackathon our great friend Jan already noticed the current code is mixing UI and controller code like it's nothing. This worked for simple pages, but we are getting more and more complex pages, like the testcase page. Jan started working on trying to get Twig integrated for that page, but perhaps we should move it a step further and use some framework like Symfony or Laravel (or another one...).

I think the web interface and API of DOMjudge are not too difficult: I think the difficult part is in the judgedaemon and related things.

This issue is to discuss whether we even see this as an option :).

To start of some discussion, let me add some advantages and disadvantages which I see.

Advantages:

  • We can use the strong base of a framework to do a lot of stuff. For example a framework has a coupled templating engine, database wrapper, etc. lib.database.php served us well for a long time but I think for most things some ORM would make more sense.
  • It is easier for (external) developers to add code, because we use some (well-known) setup.
  • Separating UI and logic is a thing we already want to do and a framework will almost force us to do so automatically.
  • Doing something like the API we currently provide is almost trivial in a good framework.
  • So is doing authentication.
  • We can lift upon (security) updates from the framework.

Disadvantages:

  • There are some queries for which an ORM is maybe hard. I can image some of the scoreboard things to be hard. However, normally we could bypass the ORM for some specific things. Or for example Doctrine ORM allows you to write ORM-style selectors which are a close mapping to an SQL query.
  • It will be quite some work to do this: it won't be something we can do in a week. We need to rethink and/or rewrite a lot of our code.
  • During the "transition period" we will add features using the current structure which we need to re-do when the transition is complete.

Some might think the performance will drop using a framework. However, I don't believe this is the case for a good framework. Frameworks nowadays have a lot of mechanisms to have no or only a little performance impact and I think that using a framework will even speed up some things, because the framework can already have good support for caching stuff etc.

What do other people think about this idea?

I don't want to really discuss which framework etc. yet, as I think we first need to decide whether we want to use it at all.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions