0

I have been into the design pattern for quite sometime (say 4 months) and has implemented many in our project. I have gained knowledge(though won't say myself as a master at present) and I believe that I have good control over them.

I am thinking to gradually move this knowledge into framework design. But I donot have any experience on that.

Could you people please giude my in making atleast the initial steps.

Thanks

generaluser
  • 153
  • 3
  • 8

2 Answers2

2

The good framework will require using some design pattern, it might be essential for it.

Let's say - Spring MVC. It's quite obvious, you'll be using MVC.

Let's say GWT. GWT is best used with MVP.

Let's say Hibernate. You'll be using DAO. (Some say it's not real design pattern by core definition, but it's globaly considered as design pattern nowadays)

And so on. There is no real reciepe. I'll give you some of my thoughts, you might consider them as some 'steps' in using design patterns:

  1. Understand them, read a book.
  2. Understand every day libraries. For example, those in Java SE use plenty of design patterns. BalusC provided really great answer about this, check it out. I think this is particularly important step.
  3. Pick a framework you need, learn it. Read the docs, read the book. See recommendations of authors, of it's creators.
  4. Obey good practices. F.e. DRY, unit testing and so on. The real need of design pattern will just pop out. You wouldn't even notice :) It's not like 'oh Im gonna implement this cool pattern', it's like 'this sucks I need to improve it, oh well let's see this is what I need!'.
  5. Always keep things simple. Think of flexibility, reusability, but always think of simplicity. It's much better to work with clear and simple API, where it's behaviour is predictable.
Community
  • 1
  • 1
Xorty
  • 18,367
  • 27
  • 104
  • 155
1

Framework design is much more difficult than application design. I just wrote an article on my blog about it and came up with three ideals that I follow for framework design.

  1. Get design correct before a release
  2. Keep the visible sdk small & focused
  3. Make the sdk easy to use

Points 1 and 2 are important because once a release is made, refactoring the visible sdk results in breaking changes. Point 3 is important if you want developers to use your sdk. For me, these ideals govern every decision I make in my framework design. I had to consider them over and over throughout the whole process. I put a bunch of tips in my article to achieve these goals.

Framework/SDK/API Design Tips

In terms of design patterns, I think I followed a similar path to you. I learned about design patterns a few years ago and realized how powerful (and destructive) they can be. I used some in some programs, and eventually got to use some on a framework. I found that in my framework, I got a chance to apply new patterns that I did not get to use for applications (off the top of my head, I can only think of template method and I believe I used factories more in my framework than in an application. I can't remember all the details though).

Good luck. I think framework design is difficult but also rewarding.

Disclaimer: I am not an expert in framework design...just something I've dabbled in.

i8abug
  • 1,692
  • 3
  • 19
  • 31