It seems to me that there is a trend these days toward making ordinary projects into mini-frameworks. OOD has become as much about modeling the future is it is about modeling the immediate problem you're trying to solve.

If your company is profitable and has a reliable income, incorporating flexibility can save money if you do it right. If your company is a start-up however, making an extensible design may be a luxury you can't afford.

We've been discussing the front-end of the bad resue issue, but there's the back-end as well: overuse of otherwise good frameworks. With so many open source frameworks available, there is a tendency now to incorporate too many of them into a project.

Developers want to incorporate some functionality into their application and find an open source project that is a superset of that functionality and just incorporate the whole thing.

The result is explosive growth in the amount of code such applications have to support and a larger percentage of nearly dead code.

> I think this is exactly what is the advantage of Domain> Specific languages.

Why not build a Domain Specific framework?

If executed properly it can work as a simpler substitute of a language (which needs a lot of supporting artifacts: compilers, debugers, productivity tools, etc).

Back to the framework-itis, in the java and/or .net development contexts there is so much framework code readily available that it makes little sense to build frameworks for anything but Domain Specific. However, a lot of programmers suffer of the "not-written-by-me" syndrome. Therefore instead of focusing on results, they'd rather carve yet another framework, taking pleasure in re-inventing the wheel for over and over again.

Reuse derives from efficiency in development. IMHO, efficiency in development is what should drive code reuse and never the other way around.

> > I think this is exactly what is the advantage of Domain> > Specific languages.> > Why not build a Domain Specific framework? > > If executed properly it can work as a simpler substitute> of a language (which needs a lot of supporting artifacts:> compilers, debugers, productivity tools, etc).>

I think we differ on that term. I do not mean something even remotely that complex.

How about a document(oftimes JSON or XML) which describes the steps necessary to the task and the relevant details.

Then write a program to read the document and execute the steps.

At this point you can embellish the parameters available in the document.

> Another way to approach the problem is to write small> frameworks that are highly decoupled. If these frameworks are actually used independently, this may be a good idea.

However, if you just anticipate that these frameworks may be used independently, it is better to write one framework.You can still refactor it when there is a need to use just a part of it.

I have done this mistake myself. I wrote a XUL interpreter (a XML GUI language) with CSS support using Swing. I wrote the following independent layers:1) A generic CSS engine2) A mechanism that applies CSS to Swing3) A XUL engine using CSSThe separate parts seemed to be a good architecture at first - even though nobody used 1 or 2 independendly. The code is was well structured.

With additional requirements, however, I had to change 2 and 3 in a way that 2 could no longer be feasably used without 3 - in other words they are now tighly coupled.It might have never been practical to use any of the parts by itself, because nobody has tried it yet.

So now, I have the worst of both:1) Some requirements make me change more than one part, sometimes even the interfaces between the parts.2) The parts cannot be used alone, because they are hightly coupled.

Hm,... another occurrence of framework-itis is: Everybody in the team builds a framework for himself, but for the same problem. I am faced with that at the moment, organizing a meeting tomorrow to fix this. Another problem is, that these fraeworks are build to use a commercial application-framework. I should say: To build around it. I build one myself, showing it to the others, publishing it for the whole team, provindig examples, etc.

No I have to look, why they do not use it, but building their own, solving the same problems, sometimes the same way.

I don't like to use it my own, most the time, because I want to use the original framework directly:

Like every good framework, it had several possibilities to reuse code in different positions. So you can implement reusable components for the GUI/View or the controller (MVC). I walked around the team last weak an looked how everybody solves the common problems. There are some which build such an component for everything, but most the time they can not be reused without modifications, because they are so specialised. Others build super generic componets, which are hard to configure. (Like mentioned above by others.) There are also some colleagues which do not want to build an use potential resuable components at all.

Wierd? I think it's mainly because the main application framework, was never really documented. You cann do some nice things with a grafical designer, but everything beyond that is "guess, try and error". Yes, it is a framework, but it is hard to reuse. I think EJB are simplier to use, or may be, you can just get more documentation, tuturials, etc. about them.

I'll try starting to fix some of the (meta) problems tommorrow. I think this will be lift off towards a philosophic discussion ...

Sounds like the "not invented here" syndrome, where a developer feels to need to reinvent something because they didn't create it in the first place. Indeed, I've done it myself, but since learnt to be more respective and open to other developer's efforts and being more focused on delivering something as a team rather than as a heroic single developer.

> > Another way to approach the problem is to write small> > frameworks that are highly decoupled. > > The danger here is in overly decoupling the design. When> do you know you have "decoupled" enough? It's easy to> create a totally decoupled framework that is hard to use> in context. This is why I think frameworks realistically> fall out of existing code rather than created afresh.

Components/modules are highly decoupled when they do not refer to each other...of course there should be an easy way to combine them. In other words, components of a framework should only be conceptually related, not algorithmically (if it is possible).

> Components/modules are highly decoupled when they do not> refer to each other...of course there should be an easy> way to combine them. In other words, components of a> framework should only be conceptually related, not> algorithmically (if it is possible).

The problem with that, which I'll guess is the case Bruce talked about in the original post, is that this is really hard to do in practice. I've never successfully built a framework. I've put together plenty of libraries and a couple of DSL's, but I hope to never build my own framework. I have two reasons for saying that.

1: There are a lot of good frameworks out there already. I'm more than happy to make use of other's work. One can see farther standing on the shoulders of giants.

2: I've yet to solve a problem that lends itself to a generic enough model that a framework would be at all useful.

I know there are plenty of people out there solving big problems that may require a framework. I'm just not one of them.

It occurs to me that one might learn a lot about the ideas behind frameworks and the design issues by building one or two. Before the C++ STL, I learned a great deal about collection classes by building them. However I was happy to give them up once the STL appeared.

Perhaps it's a good idea to build a framework or two, but to be very conservative about inflicting your first attempts on other people.

A) If you did not have to write the code yourself, and it exists without any pre-existing knowledge of your needs (that is, another member of your team did not write it because you asked them to), then you are reusing it.

B) If you write some code that someone else is able to reuse (again, without them specifically asking you to write it), then you have written reusable code.

> Perhaps it's a good idea to build a framework or two, but> to be very conservative about inflicting your first> attempts on other people.

It really is that "inflicting on other people" that scares the bejeezus out of me. I've taken a small crack at a couple of things that I think can be done better, the big one being a nice small OLAP database engine (Analysis Services has scaling issues and Essbase is anything but small) but it quickly spiraled into something I was trying to avoid. It may be worth another crack as I tossed it aside a couple of years ago and now have some more experience under my belt with OLAP datastores.

Also, I'm curious about the gray area in the matter discussed on this thread. Like the notion of a domain specific framework. Where is the line between that and a DSL? Would Rails be the current poster child for a Domain Specific Framework? I'm sure one or two of the things I've written fall into this nebulous gray area.

I'm not sure I entirely buy the "application with holes" argument, either. I've heard it many times and I've thought about frameworks like this from time to time but overall I think it is more than that. At least a good framework is more than that. The problem I have with it is that, to me, this is too high a level of abstraction to be of any real use. .NET, for example, seems to be a lot more than just an application with holes. What is "the application" in the .NET framework? Is it the runtime interpreter? If that's the application what about all the other stuff around it like security policy? The development environment? Is C# just a good DSL for writing windows applications? I think that's a gross oversimplification. Or maybe I'm just misinterpreting the statement.

Have we gotten off the topic of bad reuse yet? It feels like we have...

Mine is the above, then. I tried building a framework for OLAP datastores and it quickly spiraled out of control. I couldn't even use it easily so I can't imagine what others would have thought of it. It got very big very quickly.

I have much better luck with libraries, API's and DSL's. I've designed a couple of good libraries/API's for our products that can be called from Excel. I'm continually amazed at what people do with these things. They are very small, focused and flexible. They've been used in ways I never would have imagined.

As you postulated, the good designs I've done have been from use happening before reuse. I can't say anything much about the designs of done where the reuse cart went before the horse because I've thrown them out every time. I used to think I was just bad at designing stuff. But over the past couple of years I've seen lots of instances where people design stuff without knowing how it's going to be used for real and once it gets out in the real world there are problems. Maybe I'm still bad at designing stuff, but I've found that I'm certainly not the only one!