wiki:DocumentationForDevelopers

Version 1 (modified by kiesel, 13 years ago) (diff)

some coding hints

  • Threading model
    • There is just one big lock per user (the user's FactsDatabase instance); it's acquired immediately in de.opendfki.skipforward.ui.web servlets.
    • If you create a background thread or something similar, make sure you get the lock
  • MVC
  • RDF Beans
    • interfaces are in de.opendfki.skipforward.vocabulary
    • beans provide some convenience methods (e.g., getLabel(), etc.)
    • beans instances are built using FactsDatabase methods
    • beans are throwaway objects and do not have any internal state - every change using their setters is immediately persisted in RDF
    • beans are associated with their corresponding FactsDatabase so you cannot pass one bean instance to another user
  • non-binary features
    • non-binary features are somewhat nasty to handle since their (rather generic) feature type isn't very helpful ("Name") - you need a feature instance to know the full type ("Name: Miller")
    • when comparing feature types for equality, you should use feature123.getFeatureTypeId() instead of feature123.getFeatureType().getUri() - the ID is the feature type URI plus added values ("Miller" in the example above)
    • same for getting labels: feature123.getFeatureType().getLabel() is not very helpful (again, "Name") - use feature123.getFeatureTypeLabel() instead.
    • thus, writing code that uses something like Map<FeatureType, ...> is most likely a mistake.