473,396 Members | 1,877 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Is this a case for metaclasses?

Hi,

I'm currently implementing a tool for auto-generating webforms from a
desription file. The output should become a php-script, an asp-script,
zope-formulator or such. Each if it may (or may not) have javascript
additions. The output format should be defined ar runtime (php,
php+javascrip, asp, asp+javascript, etc.).

Currently I have a fixed class hierarchy:

generic : implements generic html widgets (input, radiobuttons)
php : "mixin" for adding php-specifi code to the widget,
eg. getting values from HTTP_POST_VARS/_POST
javascript : adds javascript scripts, eg. error checking

Obviously this does not scale as soon as I add more mid-layers (asp,
psp, etc.).

For me this sounds like I could benefit from using metaclasses here.
Before I start implementing such a beast, I want to be shure, there will
be a benefit.

Any suggestions?

--
Schönen Gruß - Regards
Hartmut Goebel

| Hartmut Goebel | IT-Security -- effizient |
| h.******@goebel-consult.de | www.goebel-consult.de |
Jul 18 '05 #1
1 1295
Hartmut Goebel <h.******@goebel-consult.de> wrote in message news:<41**********************@newsread2.arcor-online.net>...
Hi,

I'm currently implementing a tool for auto-generating webforms from a
desription file. The output should become a php-script, an asp-script,
zope-formulator or such. Each if it may (or may not) have javascript
additions. The output format should be defined ar runtime (php,
php+javascrip, asp, asp+javascript, etc.).

Currently I have a fixed class hierarchy:

generic : implements generic html widgets (input, radiobuttons)
php : "mixin" for adding php-specifi code to the widget,
eg. getting values from HTTP_POST_VARS/_POST
javascript : adds javascript scripts, eg. error checking

Obviously this does not scale as soon as I add more mid-layers (asp,
psp, etc.).

For me this sounds like I could benefit from using metaclasses here.
Before I start implementing such a beast, I want to be shure, there will
be a benefit.

Any suggestions?


Metaclasses are essentially syntactic sugar. You can do more or less
everything without them. For instance you can use a poor man function
to
format your classes as you wish. Then, you have to apply the function
to the every subclass by hand. If you use a metaclass, subclasses are
automatically reformatted, instead. So, using a function means
a bit more typing but greater expliciteness. Metaclasses are okay
if you want to hide to your users the fact that something magic is
going on.
Michele Simionato
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Stephan Diehl | last post by:
I have a question about metaclasses: How would be the best way to "merge" different metaclasses? Or, more precisely, what is the best way to merge metaclass functionality? The idea is basicly...
3
by: Mike C. Fletcher | last post by:
Slides from my PyGTA presentation on Tuesday, focusing mostly on why/where you would want to use meta-classes, are available in PDF format: ...
2
by: Santiago Aguiar | last post by:
Im trying to use AOP techniques on python but, even if I understand the idea behind metaclasses, I cant find a way to use AOP in a dynamic way. What im trying to do is to weave an aspect to a...
4
by: Michael Sparks | last post by:
Anyway... At Europython Guido discussed with everyone the outstanding issue with decorators and there was a clear majority in favour of having them, which was good. From where I was sitting it...
13
by: Jean-François Doyon | last post by:
Hello, I'm using MetaClasses to create classes. How do I make these new classes "globally" available? I probably just have to assign them to something magic, but I can't seem to figure out...
2
by: Paul Morrow | last post by:
....that they warrant an entirely new syntax? It seems that they are very similar in a very significant way --- they alter the default behavior of something. IMO, it's not a stretch to say that...
9
by: Steffen Glückselig | last post by:
Hello, I've been experimenting with metaclasses a bit (even though I am quite a newbie to python) and stumpled over the following problem in my code: class Meta(type): def __init__(cls, name,...
0
by: Jan-Ole Esleben | last post by:
Hi! I've just posted a question about metaclasses in ZOPE on the ZOPE list, and one of the replies said that metaclasses (at least "painless" metaclasses) cannot be used without new-style...
1
by: Alan Isaac | last post by:
Forman's book is out of print. Is there a good substitute? Thanks, Alan Isaac
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.