Re: Euphoria being OO Survey.
- Posted by fred at jordah.freeserve.co.uk May 15, 2003
- 684 views
Matt wrote: > Fair enough. But that doesn't mean that there's not a different way to do > it. Of course, the only thing I know about Swing or JPanels is how to spell > them. It's not obvious to me why an OO implementation is necessarily better > or prettier than a non-OO implementation, though I do admit that GUI's tend > to lend themselves to OO. > > In fact, I'm writing one right now (wxEuphoria), which actually sits on top > of a ton of OO (C++) code, but I don't have your understanding, or perhaps > we don't share the same definition of cleaner syntax. One of the points in > the article was that the author thought problems were often best oriented > around tasks (verbs), as opposed to things (nouns). In general, this fits > my way of thinking. It's often clearer to me when a function sits on its > own than embedding within a class. Of course, this is probably a very > personal preference, but I prefer: > > do_it( to_this ) > > over: > > to_this.do_it() Matt, think of it this way. You are attempting to write a cross-platform GUI library. To make this library readily cross-platform you'll have to code your own widgets...eg lists,menus With time you go to look at all your widgets and see a lot of repeated code, then u have to clean it up. Clean up ends up introducing bugs, with time, u go to notice that it gets annoying trying to modularise your code as it grows bigger...etc. With OO, i would create simply a class with eg default properties,virtual functions,methods. Say, CWnd Class like in MFC, then to all other controls eg when coding the button class. i would simply create a class that inherits from the CWnd class, then overide certain methods and have a button control. I dunno how to explain it since i'm not an experienced OO user but i think u get what i'm getting at...(i think polymophism). Anyway, have u used MFC? See how easy it is? what is better, is that, coding ur custom controls is simply involves extending certain classes eg CWnd Another issue is when you have function names/proc names that are similar but different in function...eg Incase you look at win32lib, If you look at his setText() proc, u'll notice he uses the if switch lots to adjust for it to work for different controls eg If class=Menu then --code here elsif class = window then --code here end if wouldn't it be easier to do eg in java JFrame mw = new JFrame(); JMenu me = new JMenu(); mw.setText("blah"); me.setText("xxg"); mw.setVisible(1); > The frequency of discussions doesn't mean anything. The fact that there is > rarely a real conclusion or consensus reached says a lot more. Even your > own poll has 50% (one vote being mine) saying that OO should be left out of > Euphoria (and only 25% with a strong opinion in favor)--at the time I write > this, anyway. True,.....the votes speak for themselves...but i'm not convinced yet > If you're interested in OpenEuphoria, you can do a search for OpenEu on > Topica and on Sourceforge. > > Matt Lewis > > > > TOPICA - Start your own email discussion group. FREE! > >