Re: [WebDNA] Was: wiki Now: Object-oriented programmng

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 103973
interpreted = N
texte = One can utilize object-oriented techniques while programming in any language. This doesn't make the language itself object-oriented, but that's ok. WebDNA does not need to be object-oriented, and in fact dealing with the overhead of object-oriented interpretation would slow down the execution of WebDNA code. Object-orientation benefits the programer in that s/he inherits extensive capability with relatively little coding, but it puts more load on the system interpreting the code. For a compiled application, this is great, as the interpretation only happens when the application is built. In a live-interpreted language such as WebDNA, more work would need to be done by the WebDNA engine every time a page is loaded, and that would slow down the processing. I use object-oriented techniques in WebDNA frequently, through careful implementation of function libraries. I have found that when done with care, this can be very effective, but when I get sloppy the system bogs down. I have spent a fair amount of time working through these issues in order to optimize my code and find the best balance I can between ease of development and web page performance. As an illustration, I have a series of very similar websites or sections within a website. These all use the same core function library include file. At the end of that function library, which is stored in a global directory, it looks in the local directory of the page being loaded for a local include file. If found, that include file is loaded, which may replace or add to variables and functions defined in the master include file. This provides the basic concept of "inheritance" that is core to object-orientation. Essentially, each implementation of a module shares a common class of properties (text variables) and methods (functions), then redefines the pieces that make the instance of the module unique. Changes to the parent class (the global include file) are automatically inherited by the child classes (local module implementations), and features of the parent class can be overridden by local implementations. WebDNA makes this possible because when you define a function or a variable, it replaces any previous definition using the same name. This is object-oriented programming using structured or procedural tools. Since it is not managed or enforced by WebDNA, that does not make WebDNA an object-oriented language, but that works for me because I have the choice to use these techniques or not, as the development and performance needs of a particular project dictate. Brian Fries BrainScan Software On Nov 6, 2009, at 8:30 AM, Matthew Bohne wrote: > I would argue that WebDNA doesn't *need* to be OOP, because much of > the programming that would be done in that kind of environment is > already built in. I spent over 300 hours creating a flat file > shopping cart class in PHP to emulate the cart functions of WebDNA. > It still just didn't cut it. Was it object oriented? Sure. Could > an include file full of functions be considered a "Class"... > possibly by loose definition. In my PHP case, it was neccesary... > but there aren't too many server-side web applications that I can > think of that *need* to be OOP. > > Donovan Brooke wrote: >> Patrick McCormick wrote: >> > An object-oriented language has a syntax consisting of objects, >> rather >> > than predominately procedural steps. Just because you can use those >> > procedural steps to make a piece of code that behaves like an >> object >> > doesn't cut it. >> > >> > Frankly, I'm not very heartbroken that WebDNA isn't OOP. I don't >> think >> > it would add much benefit. >> > >> > I think that WebDNA is perfect for web servers because the >> process of >> > creating and sending pages is pretty darn procedural. Although >> OOP stuff >> > like Flash and JavaScript can exist in a page and do things after >> the >> > page gets there, page assembly and delivery - especially when >> data is >> > being retrieved in rows and columns, seems more intuitive in a >> > procedural environment. >> >> >> Christer wrote: >> > The very foundation for OOP is the use of objects (instances of >> > classes which can have properties and methods, all encapsulated >> within >> > the class) and inheritance (subclasses of objects that can share >> all >> > or just some of their super's properties and methods). >> >> > Best, >> > Christer >> >> >> Christer wrote: >> > WebDNA is a great language but it's not object-oriented in any way. >> >> > Best, >> > Christer >> >> >> >> O.K., up at 5:30 AM so I can respond. :-) >> >> First, Ultimately I agree that, especially programmers of other >> languages, WebDNA will not be viewed as an OOP language by the >> larger public. I will >> delete that aspect from the wiki for that reason. I think Christer >> defines OOP in a way that most others will view it. However, I >> don't agree with Christers last comment that it is no way OOP. >> >> Here is some insight why I think this... >> >> As noted by Patrick, most WebDNA'ers create procedural code or even >> Non-structured code. >> >> http://en.wikipedia.org/wiki/Unstructured_programming >> >> However, this does not have to be the case. >> Non-structured programming, structured(procedural) programming, >> and OOP, are, for the most part, *styles* of programming and I >> argue that WebDNA has evolved to a point where it is (nearly) >> possible >> to code WebDNA in an OOP style. >> >> Referencing the wikipedia page "Object-oriented programing" (Main >> features), I've included a snippet that includes the usual >> characteristics of OOP. I'll make my arguments within! ;-) >> >> ---- >> Main features >> >> The attempt to distill OOP to a minimal set of features is considered >> futile by programming language researcher Benjamin Cuire Pierce. >> Nevertheless, he identifies the following as fundamental features >> that >> are found in most object-oriented languages and that, in concert, >> support the OOP programming style:[4] >> >> * Dynamic dispatch -- when a method is invoked on an object, the >> object itself determines what code gets executed by looking up the >> method at run time in a table associated with the object. This >> feature >> distinguishes an object from an abstract data type (or module), which >> has a fixed (static) implementation of the operations for all >> instances. >> It is a programming methodology that gives modular component >> development >> while at the same time being very efficient. >> >> >> [The WebDNA Argument: >> Though webdna does not have objects/classes in the traditions >> sense, I argue that the premise of an object can be hacked with >> WebDNA... >> An example of dynamic dispatch in WebDNA may be an include file >> that contains functions (methods), for example.. one of which >> decides what other functions (methods) to call. >> >> http://en.wikipedia.org/wiki/Dynamic_dispatch >> "In a small number of languages such as Common Lisp, methods or >> functions can also be dynamically dispatched based on the type of >> arguments. Expressed in pseudocode, the code manager.handle(y) could >> call different implementations depending on the type of object y. >> This >> is known as multiple dispatch."] >> >> >> * Encapsulation (or multi-methods, in which case the state is kept >> separate) >> >> >> [WebDNA Argument: >> This has to with limiting things, such as limiting the hackability >> of an >> app or object, by keeping non needed code "hidden". I attest these >> types of things can be accomplished with WebDNA using the scoping >> of variables that is also implied with WebDNA's [function] context. >> >> http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)] >> >> >> * Subtype polymorphism >> >> >> [WebDNA Argument: Since WebDNA doesn't deal with classes and >> superclasses, it would be an interesting challenge to convince >> someone >> from a C++ background that WebDNA has this capability :-).. but >> why not try.. >> >> http://en.wikipedia.org/wiki/Subtype_polymorphism >> "n programming language theory, subtyping or subtype polymorphism >> is a form of type polymorphism in which a subtype is a datatype >> that is related to another datatype (the supertype) by some notion >> of substitutability" >> >> Though the inheritance idea would not work in the same way as some >> other >> languages, I suppose a hack could be made in webdna to create a "S >> <: T" >> relationship. >> >> >> * object inheritance (or delegation) >> >> >> [WebDNA Argument: Since inheritance is usually defined more by the >> use of objects and classes in the traditional sense, maybe the >> *delegation* definition works better for WebDNA: >> >> http://en.wikipedia.org/wiki/Delegation_(programming) >> "Delegation is the simple yet powerful concept of handing a task >> over to another part of the program. In object-oriented programming >> it is used to describe the situation wherein one object defers a >> task to another object, known as the delegate."] >> >> >> * Open recursion -- a special variable (syntactically it may be a >> keyword), usually called this or self, that allows a method body to >> invoke another method body of the same object. This variable is >> late-bound; it allows a method defined in one class to invoke another >> method that is defined later, in some subclass thereof. >> >> [WebDNA Argument: WebDNA doesn't have a keyword for this and >> functions >> work a bit differently in WebDNA than in most OOP languages, but >> the basic principle is doable in WebDNA.] >> ---- >> >> >> Anyway, after looking into this, I wouldn't dare waste my time trying >> to defend WebDNA as an OOP language.. life is too short. ;-), so I >> will >> take that out of the Wiki.. but one point about all this is that I >> think the latest changes (derived from SMSI) help in making this >> language compete with the best of them in some of the latest coding >> techniques. As Patrick alluded... Who needs objects and classes on >> the web when you have [include] and [function] anyway. ;-) >> >> Happy friday! >> >> Donovan >> >> > > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > Bug Reporting: http://forum.webdna.us/eucabb.html?page=topics&category=288 Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] Was: wiki Now: Object-oriented programmng (Donovan Brooke 2009)
  2. Re: [WebDNA] Was: wiki Now: Object-oriented programmng (William DeVaul 2009)
  3. Re: [WebDNA] Was: wiki Now: Object-oriented programmng (Donovan Brooke 2009)
  4. Re: [WebDNA] Was: wiki Now: Object-oriented programmng (Brian Fries 2009)
  5. Re: [WebDNA] Was: wiki Now: Object-oriented programmng (Matthew Bohne 2009)
  6. [WebDNA] Was: wiki Now: Object-oriented programmng (Donovan Brooke 2009)
One can utilize object-oriented techniques while programming in any language. This doesn't make the language itself object-oriented, but that's ok. WebDNA does not need to be object-oriented, and in fact dealing with the overhead of object-oriented interpretation would slow down the execution of WebDNA code. Object-orientation benefits the programer in that s/he inherits extensive capability with relatively little coding, but it puts more load on the system interpreting the code. For a compiled application, this is great, as the interpretation only happens when the application is built. In a live-interpreted language such as WebDNA, more work would need to be done by the WebDNA engine every time a page is loaded, and that would slow down the processing. I use object-oriented techniques in WebDNA frequently, through careful implementation of function libraries. I have found that when done with care, this can be very effective, but when I get sloppy the system bogs down. I have spent a fair amount of time working through these issues in order to optimize my code and find the best balance I can between ease of development and web page performance. As an illustration, I have a series of very similar websites or sections within a website. These all use the same core function library include file. At the end of that function library, which is stored in a global directory, it looks in the local directory of the page being loaded for a local include file. If found, that include file is loaded, which may replace or add to variables and functions defined in the master include file. This provides the basic concept of "inheritance" that is core to object-orientation. Essentially, each implementation of a module shares a common class of properties (text variables) and methods (functions), then redefines the pieces that make the instance of the module unique. Changes to the parent class (the global include file) are automatically inherited by the child classes (local module implementations), and features of the parent class can be overridden by local implementations. WebDNA makes this possible because when you define a function or a variable, it replaces any previous definition using the same name. This is object-oriented programming using structured or procedural tools. Since it is not managed or enforced by WebDNA, that does not make WebDNA an object-oriented language, but that works for me because I have the choice to use these techniques or not, as the development and performance needs of a particular project dictate. Brian Fries BrainScan Software On Nov 6, 2009, at 8:30 AM, Matthew Bohne wrote: > I would argue that WebDNA doesn't *need* to be OOP, because much of > the programming that would be done in that kind of environment is > already built in. I spent over 300 hours creating a flat file > shopping cart class in PHP to emulate the cart functions of WebDNA. > It still just didn't cut it. Was it object oriented? Sure. Could > an include file full of functions be considered a "Class"... > possibly by loose definition. In my PHP case, it was neccesary... > but there aren't too many server-side web applications that I can > think of that *need* to be OOP. > > Donovan Brooke wrote: >> Patrick McCormick wrote: >> > An object-oriented language has a syntax consisting of objects, >> rather >> > than predominately procedural steps. Just because you can use those >> > procedural steps to make a piece of code that behaves like an >> object >> > doesn't cut it. >> > >> > Frankly, I'm not very heartbroken that WebDNA isn't OOP. I don't >> think >> > it would add much benefit. >> > >> > I think that WebDNA is perfect for web servers because the >> process of >> > creating and sending pages is pretty darn procedural. Although >> OOP stuff >> > like Flash and JavaScript can exist in a page and do things after >> the >> > page gets there, page assembly and delivery - especially when >> data is >> > being retrieved in rows and columns, seems more intuitive in a >> > procedural environment. >> >> >> Christer wrote: >> > The very foundation for OOP is the use of objects (instances of >> > classes which can have properties and methods, all encapsulated >> within >> > the class) and inheritance (subclasses of objects that can share >> all >> > or just some of their super's properties and methods). >> >> > Best, >> > Christer >> >> >> Christer wrote: >> > WebDNA is a great language but it's not object-oriented in any way. >> >> > Best, >> > Christer >> >> >> >> O.K., up at 5:30 AM so I can respond. :-) >> >> First, Ultimately I agree that, especially programmers of other >> languages, WebDNA will not be viewed as an OOP language by the >> larger public. I will >> delete that aspect from the wiki for that reason. I think Christer >> defines OOP in a way that most others will view it. However, I >> don't agree with Christers last comment that it is no way OOP. >> >> Here is some insight why I think this... >> >> As noted by Patrick, most WebDNA'ers create procedural code or even >> Non-structured code. >> >> http://en.wikipedia.org/wiki/Unstructured_programming >> >> However, this does not have to be the case. >> Non-structured programming, structured(procedural) programming, >> and OOP, are, for the most part, *styles* of programming and I >> argue that WebDNA has evolved to a point where it is (nearly) >> possible >> to code WebDNA in an OOP style. >> >> Referencing the wikipedia page "Object-oriented programing" (Main >> features), I've included a snippet that includes the usual >> characteristics of OOP. I'll make my arguments within! ;-) >> >> ---- >> Main features >> >> The attempt to distill OOP to a minimal set of features is considered >> futile by programming language researcher Benjamin Cuire Pierce. >> Nevertheless, he identifies the following as fundamental features >> that >> are found in most object-oriented languages and that, in concert, >> support the OOP programming style:[4] >> >> * Dynamic dispatch -- when a method is invoked on an object, the >> object itself determines what code gets executed by looking up the >> method at run time in a table associated with the object. This >> feature >> distinguishes an object from an abstract data type (or module), which >> has a fixed (static) implementation of the operations for all >> instances. >> It is a programming methodology that gives modular component >> development >> while at the same time being very efficient. >> >> >> [The WebDNA Argument: >> Though webdna does not have objects/classes in the traditions >> sense, I argue that the premise of an object can be hacked with >> WebDNA... >> An example of dynamic dispatch in WebDNA may be an include file >> that contains functions (methods), for example.. one of which >> decides what other functions (methods) to call. >> >> http://en.wikipedia.org/wiki/Dynamic_dispatch >> "In a small number of languages such as Common Lisp, methods or >> functions can also be dynamically dispatched based on the type of >> arguments. Expressed in pseudocode, the code manager.handle(y) could >> call different implementations depending on the type of object y. >> This >> is known as multiple dispatch."] >> >> >> * Encapsulation (or multi-methods, in which case the state is kept >> separate) >> >> >> [WebDNA Argument: >> This has to with limiting things, such as limiting the hackability >> of an >> app or object, by keeping non needed code "hidden". I attest these >> types of things can be accomplished with WebDNA using the scoping >> of variables that is also implied with WebDNA's [function] context. >> >> http://en.wikipedia.org/wiki/Encapsulation_(object-oriented_programming)] >> >> >> * Subtype polymorphism >> >> >> [WebDNA Argument: Since WebDNA doesn't deal with classes and >> superclasses, it would be an interesting challenge to convince >> someone >> from a C++ background that WebDNA has this capability :-).. but >> why not try.. >> >> http://en.wikipedia.org/wiki/Subtype_polymorphism >> "n programming language theory, subtyping or subtype polymorphism >> is a form of type polymorphism in which a subtype is a datatype >> that is related to another datatype (the supertype) by some notion >> of substitutability" >> >> Though the inheritance idea would not work in the same way as some >> other >> languages, I suppose a hack could be made in webdna to create a "S >> <: T" >> relationship. >> >> >> * object inheritance (or delegation) >> >> >> [WebDNA Argument: Since inheritance is usually defined more by the >> use of objects and classes in the traditional sense, maybe the >> *delegation* definition works better for WebDNA: >> >> http://en.wikipedia.org/wiki/Delegation_(programming) >> "Delegation is the simple yet powerful concept of handing a task >> over to another part of the program. In object-oriented programming >> it is used to describe the situation wherein one object defers a >> task to another object, known as the delegate."] >> >> >> * Open recursion -- a special variable (syntactically it may be a >> keyword), usually called this or self, that allows a method body to >> invoke another method body of the same object. This variable is >> late-bound; it allows a method defined in one class to invoke another >> method that is defined later, in some subclass thereof. >> >> [WebDNA Argument: WebDNA doesn't have a keyword for this and >> functions >> work a bit differently in WebDNA than in most OOP languages, but >> the basic principle is doable in WebDNA.] >> ---- >> >> >> Anyway, after looking into this, I wouldn't dare waste my time trying >> to defend WebDNA as an OOP language.. life is too short. ;-), so I >> will >> take that out of the Wiki.. but one point about all this is that I >> think the latest changes (derived from SMSI) help in making this >> language compete with the best of them in some of the latest coding >> techniques. As Patrick alluded... Who needs objects and classes on >> the web when you have [include] and [function] anyway. ;-) >> >> Happy friday! >> >> Donovan >> >> > > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > Bug Reporting: http://forum.webdna.us/eucabb.html?page=topics&category=288 Brian Fries

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Interfacing WC with mail server (1998) sendmail and attachments (2004) Help! WebCat2 bug (1997) TIP OF THE DAY (2004) slightly OT: advertising schemes (2004) RequiredFields template (1997) [WebDNA] El Capitan (2017) Merging databases (1997) Fun with Dates - revisited (1997) Help! WebCat2 bug (1997) PIXO (1997) [WebDNA] XML Https Issue (2017) WebCatalog f2 Installation (1997) WebCat2b13MacPlugIn - More limits on [include] (1997) I try hard to think positively (1998) [WebDNA] The phone home system is undesirable ... (2008) WebCat2b13MacPlugin - [math][date][/math] problem (1997) Orderfile Info is Dissappearing (1998) Pithy questions on webcommerce & siteedit (1997) Progress !! WAS: Trouble with formula.db (1997)