User:OliverCharles/MusicBrainz-Server Sucks

From MusicBrainz Wiki
Jump to navigationJump to search

A list of some of the more sucky aspects of MusicBrainz::Server that I'd like to fix at some point :)

SQL is written as plain strings

All of the SQL is written as strings with some helpers functions. This is problematic as strings are very rigid and hard to manipulate. The solution here is to use an SQL abstraction library - the best one I've found yet is Fey. This would require a new object MusicBrainz::Schema that uses Fey::Loader to load the schema. Then all verbatim SQL needs to be replaced with calls against this schema.

The problem stalled this being fixed is that it's a huge change, but also that Fey is very verbose to create queries. For example: WHERE ( foo = 5 AND bar = 7) is: $select->where('(')->where('foo', 5)->where('AND')->where('bar', 7)->where(')'). Yuck.

The hierarchy is in MusicBrainz::Server too much

Most of the stuff isn't just for the server, it's for MusicBrainz in general. For example:

  • MusicBrainz
    • CoverArt
    • Data
    • Edit
    • Entity
    • Report
    • Server
      • Authentication
      • Controller
      • Form
      • Model
      • Plugin
      • View
      • WebService

Makes more sense.

Poor use of types

We use string type names which are hard to work with - they cannot be re-aliased or parameterized. The solution here is to use MooseX::Types everywhere.