linkeddata / rdflib.js

Linked Data API for JavaScript
http://linkeddata.github.io/rdflib.js/doc/
Other
566 stars 146 forks source link

Identify core areas of code base #404

Open michielbdejong opened 4 years ago

michielbdejong commented 4 years ago

In order to maximise impact of code-cleanup, I want to find out which areas of the code base are "core" and which areas areas are more expendable (i.e. it would be possible to use rdflib.js without ever touching those).

michielbdejong commented 4 years ago

Under src/ there are 5891 lines of JS and 7259 + 446 + 135 = 7840 lines of TS. Some things we'll definitely need:

Total: 101 + 2124 + 935 + 119 + 187 + 1570 + 113 + (965 - 306) + (1137 - 95) + 132 + 102 + 214 =

7298

So that's 7298 / (5891 + 7840) = 53%.

michielbdejong commented 4 years ago

Sorry, as @megoth pointed out I forgot about src/update-manager.ts, so then the estimate would be (7298 + 1142)/(5891 + 7840) = 61%.

There may also be more parts we can skip, even in these files. For example, I already excluded statementsToXML and applyPatch from the count, but there may be more like that, so consider 61% to be an upper-limit estimate.

emmettownsend commented 4 years ago

Without going through it here, we already have the write up and so we know the recommendations we need to follow. But in general my thoughts on refactoring in this context:

There are many strategies that can be used but some of them are not on the cards for us at the moment because of time constraints. We have dates that we need to deliver dependent products by.

Some of the files are way too big and need to be broken up. We need to consider cohesiveness, loose coupling, testability and separation of concerns. I would not be in favour of refactoring a file at a time because

As we create the current product we should refactor rdflib like this:

Start:

This way we only need to refactor the code that we need right now. We will eventually refactor it all but we don't have the need or the time to do it all at once.

You will end up with just the code we need to refactor.