In short, you cannot implement many OO design patterns in C because it lacks the fundamental OO capability of abstraction/inheritance.  Otherwise, you can fake some OO-like programming using structures and function pointers.  I wouldn't recommend it however.  What embedded platform (hardware and OS) is being used?  What sort of performance and determinism is required? 

I recommend looking up Embedded C++ (there is a standard a brewing), and perhaps consider one of the embedded C++ compilers (hate to suggest Greenhill's compiler because it is unnecessarily expensive, but it is fairly reliable).  Between Embedded C++ and say Greenhill, I think you can do a fairly decent job of implementing OO design using patterns (using C++) while not sacrificing performance - even maintaining some degree of determinism.

The C++ compilers have matured quite nicely, and so if designed well-enough, a C++ alternative to C can perform as well - but C++ done right can handle complexity better than C and so could prevent spaghetti and convoluted C code, leading to savings on resource usage, maintenance and even performance. 

Also, there are some C-like tricks you can do with C++ now that you couldn't do (with confidence) 5 years ago.  Such tricks can save on space and improve performance over their OOP alternatives. 

If you might need an expert to come in, I recommend Scott Meyers and associates (he has people that don't have his high profile and so are not as expensive, but they are up to snuff with his material.)

I also recommend "Pattern Hatching" by Vlissides.

Hope this helps.

Cheers!
Mark



----- Original Message -----
From: "Li Xinyi" <[EMAIL PROTECTED]>
To: [email protected]
Subject: [patterns-discussion] how to implement design patterns using c language
Date: Fri, 28 Apr 2006 10:15:28 +0800

Hi, guys

I am new to design patterns, and just start to learn it by picking up the book, head first design patterns.
I worked for an embedded software company. Unfortuantely here I dont have any object oriented programming language available.
I am wondering, is there any resource explaining how to implement the design patterns using c language.

Best Regards,
Ryan

_______________________________________________
patterns-discussion mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/patterns-discussion

_______________________________________________
patterns-discussion mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/patterns-discussion

Reply via email to