Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Guidelines for writing a framework

Tags:

frameworks

I'm faced with writing a framework to simplify working with a large and complex object library (ArcObjects). What guidelines would you suggest for creating a framework of this kind? Are static methods preferred? How do you handle things like logging? How do you future proof your framework code from changes that a vendor might introduce?

I think of all of the various wrappers and helpers I've seen for NHibernate, log4net, and code I've read from projects like NLog and NetTopologySuite and I see so many good approaches, but honestly I'm at a loss where to start.

BTW - I'm working in C# 3.5 but it's more about recommended approach rather than language.

like image 294
Dylan Avatar asked Aug 27 '08 02:08

Dylan


People also ask

What is an example of framework?

The definition of framework is a support structure or system that holds parts together, has something stretched over it or acts as the main structure. An example of a framework is four posts supporting a deck cover. An example of a framework is an outline created before writing an essay.

What is the purpose of a framework?

In general, a framework is a real or conceptual structure intended to serve as a support or guide for the building of something that expands the structure into something useful.

What is the writing framework?

The writing framework prompts you to think about the opportunities you're providing for students to strengthen their writing in different curriculum contexts. The framework's illustrations suggest ways you can provide opportunities for students to write for different purposes in different contexts.

What are the framework design guidelines?

These guidelines are excerpted from the book Framework Design Guidelines: Conventions, Idioms, and Patterns for Reusable .NET Libraries, 2nd Edition, by Krzysztof Cwalina and Brad Abrams. Provides guidelines for naming assemblies, namespaces, types, and members in class libraries.

How do you make a good list framework?

The second step in creating a good framework is to develop a way to represent the list visually. While a talented designer can add tremendous value to communication power of the framework, there are a number of simple ways to organize a list.

What are the intended uses of your framework or model?

Describe the intended uses of your framework or model of change: To convey the purpose and direction of your initiative or effort (i.e., the outcomes sought and how you will get there) To show how multiple factors interact to influence the problem or goal. To identify actions and interventions more likely to lead to the desired result.


4 Answers

Brad Abrams' Framework Design Guidelines book is all about this. Might be worth a look.

like image 124
Matt Hamilton Avatar answered Oct 13 '22 16:10

Matt Hamilton


Try to write code to be more flexible. For example, if you have a method that accepts an array as a parameter, would you be able to accept an IEnumerable or IList instead?

like image 20
Joel Coehoorn Avatar answered Oct 13 '22 15:10

Joel Coehoorn


I think that you're consistent is more important than what conventions you go with. As far as future-proofing yourself, that's a matter of the code that you're making a framework for. It's a lot easier to build on a brick house than a sand one.

like image 22
Jason Baker Avatar answered Oct 13 '22 16:10

Jason Baker


Writing code for framework is absolutely very different from writing application code.

I have always consulted (and have others consult) the Design Guidelines for Class Library Developers when writing framework level code.

like image 42
Samuel Kim Avatar answered Oct 13 '22 15:10

Samuel Kim