Portable code for frameworks?

We decided to work with "Insert Framework Here"

We'll likely move on to the next major framework release as they come, but the top management concern is "What to do" if the "platform" flips and dies and the code becomes wasteful? The chances of this are very low, but I still have to defend this position.

I deliberately left out the structure in order to keep all the answers at a general level, as I know the forum discussions here are mostly all opinion.

So now to the question I ran into:

What can we do to move our code into the framework?

+2


source to share


5 answers


If possible, try to separate your business logic from the "interaction layer". Basically, this interop layer wraps calls to the underlying framework, so your application talks about this layer, which is then used for discussion with the framework.

So you can save something by simply rewriting the interaction layer with a different structure.



Alternatively, you can recommend that you do not update frameworks just because you are leaving a new version or because the framework is no longer supported. Often the decision to upgrade is made by technical specialists and has no real justification for supporting it; Look at the number of COBOL and VB6 applications that are still running with little or no maintenance.

+4


source


Theses can isolate you as much as possible from the problems with the framework.

I'll give you an example. Recently I started working with Codeigniter. I appreciate some of the things that framework does, but I'm not a fan of other aspects of it. One special thing that I don't like is that you pretty much have to use a separate copy of the CI for each application you write. If CI comes out with a newer version, I need to go back and update several applications.

Because of this, I created a separate directory called "base" in my CI installations and configured the PHP autoloader to be able to load classes from it. I have things like "Base_controller", "Base_service", "Base_model", etc. and I use this in all my CI installations. These classes extend the regular CI classes, and in turn my applications extend these base classes. For example, in app number one, instead of writing a controller class that extends the Codeigniter class Controller

, I extend my own Base_controller

, which in turn extends CI Controller

.



This gives me one level of separation between CI and my applications. If the CI ever changes, I can manage it by updating only my "base" layer. I can also have a lot of basic functionality in this layer and only write once, rather than renewing a fresh CI installation every time.

Abstraction requires careful design because you don't want to go beyond it. But it is definitely a useful tool for branching your code from framework code.

+2


source


  • Explore your alternatives.
  • Choose a pair based on:
    • Similarity (template code, architecture, javascript libraries)
    • Variety (not supported by the same people, of course)
    • Simplicity (the simpler your frameworks are, the less portability problems you will get)
  • Explore your two alternatives and prepare the migration paths (i.e. we'll have to rewrite this and that and then set up the database layer here)

That said, if PHP is your language, then I really doubt Zend Framework will die :-)

+1


source


Choose an open source framework? Then, if the original maintainer remains, you can still save the code.

0


source


Some remedies might be:

Adapter diagram

-If it is an open source framework, you can develop or develop it yourself. A framework that isn't developed anymore doesn't mean the code disappears.

- Depending on the structure, the models are separated from the structure. For example, Zend Framework does not indicate that you are using active entry. Therefore, your models should be separate from the database layer. Since models are the most complex part of your application, changing it to an alternate structure is not that difficult if the model is decoupled from the framework (controller, view and db layer).

0


source







All Articles