views:

53

answers:

2

I'm trying to implement modularity in my POS system to allow 3rd parties to do some kind of modules/plugins/add ons. I have started implementing a SPI and an API, my question is: the access to the data on database has to be by this way or I need to provide a Service?

At this point you may have noticed that I have few experience in this, so any advice in this topic is well

Edit: A little more information. My system has an user's system theorically checking credentials to access any part of the system, mysql database, is written in Java. My modules securely need access to some tables in the DB, access to main menu, I don't know what else I can say, but my question is more about abstractedly how an api need be.

thanks in advance

PS Sorry if my english is bad

Octavio Ruiz

A: 

Maybe somebody can suggest any literature in this topic cause I really have searched but since english is not my natural lenguage I haven't find what I need or maybe I'm ignoring some key words.

ZooMMX
A: 

In general terms, software systems are (usually) broken up into "layers" (such as the User Interface (UI), Business Logic (BL), Data Access Layer (DAL) and so on). These layers also provide natural places to integrate with. So...

the access to the data on database has to be by this way or I need to provide a Service?

From what you've said I would think other systems should integrate via a service, or API. Giving direct access to the database means that they'll side-step the Business Logic that should apply to the interactions they want to perform. In your specific case it will probably also mean they'll side-step your security measures.

Modularity

There is two parts to this:

  • Architectural styles and design patterns which assist modular systems (specifcially regarding maintenance and extensibility); these are all technology agnostic (it doesn't matter what technology you're using).
  • Implementation and technology specific frameworks and techniques.

Design Patterns

Wikipedia is a great place to get an introduction into patterns, and StackOverflow has lots of great content around them too.

I's start off getitng to grips with what's known as SOLID, although it's all useful I think you'll find the S, O, I and D areas of most value.

Dependency Inversion (the "D") is going to be particularly relevant to you as far as modularity goes. By creating a "contract" via an interface, you create something that other parties can build on - for example: they can swap out your "default" implementation with one they have made.

Technology Specific

I can't speak specifically for Java (although it should be easy for you to find out) but .Net has a few frameworks that are specifically built for this kind of thing, e.g: the Managed Extensibility Framework (MEF).

The point is that most technology stacks will offer various frameworks, tools and approaches for building modular systems.

Adrian K
I'm studying your answer, I really appreciate your high quality response and is just the type of response I wanted.
ZooMMX
Currently the system is in general a big ball of mud, but some parts have implementations of strategic, proxy patterns and a couple of classes using inversion of control. My concern is refactor part per part, is a good idea refactor a project like mine? (200 classes, 4 development years, using in production for 18 months). I want to fix it for publish it open source.
ZooMMX
Refactoring one part at a time is fine. I suggest making a list of all the rtefactorings you want to do - prioritise them for value and effort, and also identify dependencies; this should help you work out the best order to do the refactorings :)
Adrian K
Really thanks for the information I didn't know the existence of SOLID and I was forgetting to do a list of refactorings. By the way I really like your 3D/isometric/objectified diagrams of morphfolia.
ZooMMX