5

I just came to that problem that, in a multisite solution we need to deliver the same feauture but with different Controller and View.

As we are implementing features indepently for Projects how should I split the Features independently?

For example

I have a Header for both sites but I need different data template, Model, View, Controller for site A and site B.

Use Areas for that inside the Features or create a new layer between Features and Projects or any other suggestions? I think it is a common problem with multisite solutions based on Helix.

2 Answers 2

3

If you consider the basics of the Helix principles that features should not be aware of the project layer, you could decide that the "Header" feature you are developing should have 2 sets of contoller-model-view. In my opinion, a feature can have multiple implementations of something that might seem similar. If in your case the header is so different between site A and site B that you cannot fix it in the project layer (as it seems), you actually have 2 cases. You could even decide to create 2 features for it, but that would seem real overkill. So I would create one feature and have 2 possible header implementation in that.

As a comparison, just consider an event feature. You might re-use that event feature over multiple sites. But what if one site want to display the events in a calendar view and the other one just as a flat list? I assume in that case you would also just have a calender view and a list view in your event feature. Just as you would do if those views were wanted in 1 site. The feature doesn't care where you use it. For events this might seem obvious, so I don't see why that would be different for a header.

To resume: I would create 1 feature with 2 options for your header.

2
  • It can work out, the hardest thing in this case is the naming. It depends on the Feature to find out more specific name. Commented Feb 5, 2017 at 9:09
  • 1
    Naming is sometimes the hardest part of development :)
    – Gatogordo
    Commented Feb 5, 2017 at 9:14
1

If the two features are so different they need a different view and controller, then they are not the Same feature. Just create the feature in each project layer.

If you would like to create a model, interface and functions in the feature layer and share that, that is fine. But the feature should never call code in the project. Only the project can reference code in the features.

2
  • What would you do if you have a feature that needs a list view and a detail view? Create 2 features? According to your first sentence you would.. but I actually doubt that.
    – Gatogordo
    Commented Feb 5, 2017 at 9:15
  • 2
    I would create one feature in your example. Same data with different view. But in your question you have different data. That's the reasoning for separate features.
    – Chris Auer
    Commented Feb 5, 2017 at 13:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.