Name that pattern or patterns...
-
You know that helper macro in MFC (pardon my ignorance but I haven't used MFC in probalby 6-7 years) that is used for creating object at runtime, used in Views, I think it's RUNTIME_CLASS or something??? What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory either, or is it? I am implementing (in another language) a object which does: 1. Prevents direct instantiation by virtue of a private constructor 2. The second object which is used to create the said oibject manages the instances to limit only one per class So I get the benefits of a singleton while still honoring inversion of control or DIP. Without the global introduced using a singleton. Cheers, Alex
-
You know that helper macro in MFC (pardon my ignorance but I haven't used MFC in probalby 6-7 years) that is used for creating object at runtime, used in Views, I think it's RUNTIME_CLASS or something??? What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory either, or is it? I am implementing (in another language) a object which does: 1. Prevents direct instantiation by virtue of a private constructor 2. The second object which is used to create the said oibject manages the instances to limit only one per class So I get the benefits of a singleton while still honoring inversion of control or DIP. Without the global introduced using a singleton. Cheers, Alex
XanderXP wrote:
What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory either, or is it?
I guess that it could be said that the MFC Doc/View architecture closely resembles the Model-View-Controller pattern[^].
XanderXP wrote:
I am implementing (in another language)
Sounds interesting. What language are you working with? Best Wishes, -David Delaune
-
XanderXP wrote:
What is the name of the closest pattern for that implementation, obviously it's not a singleton and it's not quite a factory either, or is it?
I guess that it could be said that the MFC Doc/View architecture closely resembles the Model-View-Controller pattern[^].
XanderXP wrote:
I am implementing (in another language)
Sounds interesting. What language are you working with? Best Wishes, -David Delaune
Randor wrote:
guess that it could be said that the MFC Doc/View architecture closely resembles the Model-View-Controller pattern
It could be, but more formally I believe MFC and Doc/View are refered to as MVP, unfortunately neither pattern are what I am looking for. I think I may have to discover my own name as it's one part service locator and one part singleton but removed of functionality in both to meet very specific requirements.
Randor wrote:
Sounds interesting. What language are you working with?
Only the best, most flexible language in the world. :P *cough* PHP *cough* Seriously though, while the language is responsible for some of the most naieve developers and most hackish projects, known to man, like any language if you follow best practices, patterns, etc. It's a real treat to work with. Cheers, Alex
-
Randor wrote:
guess that it could be said that the MFC Doc/View architecture closely resembles the Model-View-Controller pattern
It could be, but more formally I believe MFC and Doc/View are refered to as MVP, unfortunately neither pattern are what I am looking for. I think I may have to discover my own name as it's one part service locator and one part singleton but removed of functionality in both to meet very specific requirements.
Randor wrote:
Sounds interesting. What language are you working with?
Only the best, most flexible language in the world. :P *cough* PHP *cough* Seriously though, while the language is responsible for some of the most naieve developers and most hackish projects, known to man, like any language if you follow best practices, patterns, etc. It's a real treat to work with. Cheers, Alex
XanderXP wrote:
*cough* PHP *cough*
Heh, I remember the birth of PHP. I was not doing any Windows development in the mid 90's and was a Unix developer/sys admin. I haven't done any PHP development in over 10 years I would probably be lost in PHP5. The PHP language itself has come a long way. Good luck with your PHP project. Best Wishes, -David Delaune
-
XanderXP wrote:
*cough* PHP *cough*
Heh, I remember the birth of PHP. I was not doing any Windows development in the mid 90's and was a Unix developer/sys admin. I haven't done any PHP development in over 10 years I would probably be lost in PHP5. The PHP language itself has come a long way. Good luck with your PHP project. Best Wishes, -David Delaune
Randor wrote:
Heh, I remember the birth of PHP. I was not doing any Windows development in the mid 90's and was a Unix developer/sys admin. I haven't done any PHP development in over 10 years I would probably be lost in PHP5. The PHP language itself has come a long way.
So you remember it's birth as a series of Perl scripts and being called "Personal Homepage"? :P I started at the time PHP 3 was released... Back then I was learning/tinkering in C and C++ in the 1990's, it was only when I started thinking I'd like to make a career out of software development that I looked for an easy enterance. Web site projects were plenty and didn't require a BSc. so I started learning JS, HTML and ASP. I hated ASP, looked for an open source solution and started with Perl which led me to PHP (thank god). It's annoying to develop in, because of the lack of any standard framework (at least a few hundred available -- with new ones popping up each week) unlike MFC, to provide your application with some structure. When fixing or working on existing applications, it can be like finding a needle in a haystack. One guys interpretaion of MVC and a front controller, actually turns out to be a extremely tightly coupled application bootstrap, front controller, routing, dispatching and more, in one monolithic class over 1000 lines. Lots of bad practice in PHP but there is a small community dedicated developers trying to change that by introducing patterns, OO best practices, architecture and more. Zend framework is a good start, with it's design issues and all. Cheers, Alex