0

I am trying to solve an issue with reusing components. I have some UI components (a mix of JS, CSS, and HTML) that are not specific to any application. These UI components need to be able to be used in multiple applications. One is a RoR application, the other is an ASP.NET MVC application. How can I maintain these components (e.g. with version control, distribution) and still make them accessible to the different platforms that need to consume them?

For example, ApplicationA and ApplicationB use UIComponentA, which is not natively a part of their projects or repositories, because UIComponentA lives in its own repository. How can these projects get the dependencies they need while keeping the components reusable and hosted in their own location? Does anyone have experience with a similar situation, and if so, how did you tackle it?

If you need further information, don't hesitate to ask, I will update this question.

9
  • Interesting concept, across languages and platforms there are tens if not hundreds of such similar HTML, JS, CSS solutions however I have never heard of a multi-platform one yet. I am just not sure exactly what your question is however. What do you mean by maintain? How can we answer a question about how to maintain such a thing if we don't even understand the architecture behind it? Commented Dec 16, 2011 at 19:46
  • 1
    Easiest solution is implement a templating / component mechanism that works with all these platforms. Commented Dec 16, 2011 at 19:49
  • I guess that is the main thing, the client-side and the templating of the UI will be done on the client. But these pieces need to be shared between these different applications. What can help with that? Commented Dec 16, 2011 at 19:52
  • Raynos has the right idea. The more that's done on the browser side the more it can be platform independent. If you use the framework to send data and let the client render it via templating the client won't have a lot of dependency on the framework. You could even mix and match components that work that way with framework stuff if you need to use existing framework stuff. Maybe look at Backbone.js for some examples. Commented Dec 16, 2011 at 20:01
  • I understand the technologies, I guess what I am more concerned about is integration pain points. For example, let's say the UI components are hosted in a git repo. RoR application is in mercurial, and the .NET in TFS. Should the UI components be on their own webserver, and the applications make calls to go get them to embed in their page? Is there some other mechanism to embed the UI repo in the application repo so the app can deliver the components and still pull updates? These are the problems I am trying to solve. Commented Dec 16, 2011 at 20:05

3 Answers 3

3

I think you can look at any number of publicly available client-side frameworks like jQuery and YUI and see how they are deployed. Any particular project may be dependent on a specific version of the UI lib. It can either copy the relevant version to it's own repo or grab as part of the deployment process. Another option is CDN approach where the UI components are actually hosted independently and are just pulled in client-side.

1
  • So far I think this is a pretty good solution. Commented Dec 16, 2011 at 20:30
0

One option would be to host the packages (JS, CSS, Static Images, etc) on a publicly accessible URL and just reference them where needed by the url. This is how jQuery and all the big libraries do it.

0

From reading your question, the most significant issue seems to be "bolting down dependencies in a technology agnostic way". To be able to resolve this you could create a service facade that provides you with the reuasable elements as mentioned by @Mike Brown and also provide data and functionality by exposing some implementation of RestFull services. This introduces an extra layer in your system by which you isolate the top level(UI) components from the implementation of the components it depends on.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.