• Hello Fabrik Community

    Fabrik is now in the hands of the development team that brought you Fabrik for Joomla 4. We have recently transitioned the Fabrik site over to a new server and are busy trying to clean it up. We have upgraded the site to Joomla 4 and are running the latest version of Fabrik 4. We have also upgraded the Xenforo forum software to the latest version. Many of the widgets you might have been used to on the forum are no longer operational, many abandoned by the developers. We hope to bring back some of the important ones as we have time.

    Exciting times to be sure.

    The Fabrik 4.0 Official release is now available. In addition, the Fabrik codebase is now available in a public repository. See the notices about these in the announcements section

    We wish to shout out a very big Thank You to all of you who have made donations. They have really helped. But we can always use more...wink..wink..

    Also a big Thank You to those of you who have been assisting others in the forum. This takes a very big burden off of us as we work on bugs, the website and the future of Fabrik.

Design Strategy

  • Views Views: 30,842
  • Last updated Last updated:
  • Creating applications in Fabrik (and in a larger context designing a database) can be a fun and rewarding exercise.... or can be a series of frustrations.

    Lets imagine that we want to make a shop application.

    Planning​

    The key to success is planning, so first of all - turn off your computer, get out a pencil and some paper. Having a diagram of what you want to achieve, is indispensable and will save you hours of frustration later down the line as it forces you to make decisions about your application before you start building it - a pencil and a rubber eraser are so much faster than getting half way through your application before you realize that a fundamental mistake has been made!

    Now with your drawn diagram you are going to try to describe what objects and relationships you are going to have in your application.

    Objects​

    Objects are fairly straight forward, the are things like "products", "customers", "manufacturers" and "orders", any noun in your model can be thought of as an object.

    Often when we think more about these objects we realize that they contain other objects. Customers contain "addresses" (they could have a credit card address AND a different delivery address). Orders are actual made up of "Order items" - each product that the customer has placed with any given order.

    So break down these objects as far as they will go. Then on your piece of paper draw a box labelled accordingly for each object.

    Relationships​

    Relationships are a little more abstract and take a little more thought about how we want our application to work. Rather than nouns, relationships are verbs.

    At their simplest they are defined by drawing a line from one object's box to another - so we could draw a line from products to manufacturers, which would indicate that a product is created by a manufacturer. Note how "created by" is a verb and hence a relationship.

    In this example a product is created by ONE manufacturer and manufacturers can create MANY products. This type of relationship is know as a "one to many" relationship and can often be created in Fabrik by use of a Database join element, or by adding a join to the Fabrik table.

    Now taking our shop example, lets say that "products" can go in "categories" BUT that any single product can be assigned to multiple categories. This is a "many to many" relationship and thus we need to create a table for it. This table will have a field to store the productid and another to store the categoryid.

    I tend to name these types of tables "product_categories" as its name describes the relationship it is modelling. A component like Virtuemart has a similar naming convention but adds "_xref" to the end of the table name.

    This thought process is referred to as database normalization - here's some further reading on it:
    Some of our tutorials deal with modelling these relationships​
    Tutorials in the Wiki:
    Tutorials in the Tutorials section of fabrikar.com don't exist any longer.
    But thanks to @startpoint who has saved them and even created new ones here https://www.youtube.com/user/startpointbg/videos
    they are still available. Keep in mind that "old" ones are showing old (and very old) versions of Fabrik (so "Lists" were called "Tables" in Fabrik2). But you can still see the principle.
    • help/tutorials/details/3/8 - Joining some data -
    • help/tutorials/details/3/24 - One-to-Many relationships -
    • help/tutorials/details/3/22 - Many-to-Many relationships -
    • help/tutorials/details/3/20 - Related data -
Back
Top