Reply to topic
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
here is his example of a vehicle class (component)
Code:

<cfcomponent hint="I am a Vehicle">
   <cfset this.speedIncrement = 0>
   <cfset this.mph = 0>
   
   <cffunction name="increaseSpeed" returntype="numeric">
      <cfargument name="mph" type="numeric" required="yes">
      <cfset this.mph = this.mph + arguments.mph>
      <cfreturn this.mph>
   </cffunction>
   
   <cffunction name="decreaseSpeed">
      <cfargument name="mph" type="numeric" required="yes">
      <cfif this.mph GTE this.speedIncrement>
         <cfset this.mph = this.mph - arguments.mph>
         <cfreturn this.mph>
      </cfif>
         <cfset this.mph = 0>
         <cfreturn this.mph>
   </cffunction>
   
   <cffunction name="stop" output="Yes">
      <cfset this.mph = 0>
      Your vehicle has stopped.<br>
   </cffunction>
</cfcomponent>


Here is my stab at replicating his class in C#

Code:

using System;

namespace WebApplication1
{
   /// <summary>
   /// I am a Vehicle
   /// </summary>
   public class vehicle
   {
      public vehicle()
      {
         //
         // TODO: Add constructor logic here
         //
      }

      private int _speedIncrement = 0;
      private int _mph = 0;

      public int IncreaseSpeed(int mph)
      {
         _mph = _mph + mph;
         return _mph;
      }

      public int DecreaseSpeed(int mph)
      {
         if (_mph >= _speedIncrement)
         {
            _mph = _mph - mph;
         }
         else
         {
            _mph = 0;
         }
         
         return _mph;
      }

      public string Stop()
      {
         _mph = 0;
         return "Your vehicle has stopped";
      }
   }
}


Thoughts?
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
doh...dunno how that got posted twice...


Last edited by bobum on Tue Jun 28, 2005 5:04 pm; edited 1 time in total
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1029
Location: Felton, Delaware
Reply with quote
Dave I'm in no way opposed to using java... but you said that anything that can be done in Java can be done via the taggy stuff... so I wanted to see the taggy stuff. That's all... I even stated that I knew it could be done in Java. Get what I mean?
loftboy
Forum Regular

Joined: 24 Jun 2004
Posts: 1129
Location: Colorado
Reply with quote
scott, what you are asking for is there in the cfc, the method is the cfc function name and i don't think in the example I gace I put a return type which is where you declare if its public, private, remote, null, ect.

if i get some time today i will though one together and do a screen shot of the cfc direct out put which shows the methos being called and such, and good job on double posting.

and josh Im not quite sure what i said that made u think that maybe it was the cfscript deal
cpnet


Joined: 03 Nov 2004
Posts: 135
Reply with quote
The Pet Shop articles are interesting, but I have been taught not to believe benchmarks - regardless of who's reporting them. It's too easy to manipulate the tests to fit the code or vice versa. I'd have to look at the different apps more closely to draw a conclusion - unfortunately I don't have that kind of time right now.

Still, seeing the other posts here, I am impressed that CFC seems to support stuff like classes, inheritence and private/public members.

One thing that keeps tripping me up in these .NET vs. CF debates is that I have a strong aversion to Flash UI's. It's quite likely that CF provides a better backend to a Flash UI, than .NET does. Since CF and Flash are both Macromedia technologies, I'd expect CF and Flash to work better together than .NET and Flash. However, if I was working in .NET, I'm not sure I'd bother with Flash. So, when I'm talking about .NET vs. CF, I'm thinking of .NET with no Flash vs. CF that may or may not have Flash. In a situation like this, I'm not sure that CF/Flash would come out on top (but who knows)?

One interesting thing after reading through all this material (on the MS and Macromedia sites) is that all around there's a fair bit of spin and somewhat misleading info.
loftboy
Forum Regular

Joined: 24 Jun 2004
Posts: 1129
Location: Colorado
Reply with quote
interesting blog today
http://blog.newatlanta.com/

myspace is switching to bluedragon cfml.net

the good thing about bluedragon is that you can run coldfusion in j2ee or .net



http://www.newatlanta.com/products/bluedragon/index.cfm
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
cpnet wrote:
One thing that keeps tripping me up in these .NET vs. CF debates is that I have a strong aversion to Flash UI's.


AMEN HALLELUJIAH

Flash & Actionscript would totally own if Macromedia would come up with an IDE like VS for Actionscript instead of the cramped UI they have now. I understand WHY it is the way it is, I mean you only have so much real estate within the app - but if they could somehow separate out the Actionscript coding area form Flash and have a full blown sweet IDE - I could get into some hardcore Flash programming.
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
loftboy wrote:
scott, what you are asking for is there in the cfc, the method is the cfc function name and i don't think in the example I gace I put a return type which is where you declare if its public, private, remote, null, ect.


Ok - but I don't want a database select statement as a class. I want a new custom datatype, with all those fields, properties and methods available to me. Just like what that guy did for he "vehicle component".

And I'm sorry, but if what that guy did for his vehicle component is how you have to work with classes in CF...there ain't no way. That is a mess.

Here again is the link I took that example from...

http://www.macromedia.com/devnet/mx/coldfusion/articles/supsub.html

just in case you needed it
loftboy
Forum Regular

Joined: 24 Jun 2004
Posts: 1129
Location: Colorado
Reply with quote
there are several Ide's for actionscripting

heres what i use
http://www.sephiroth.it/python/sepy.php
Josh
Forum Regular

Joined: 01 Apr 2004
Posts: 1029
Location: Felton, Delaware
Reply with quote
WOW That's alot cleaner!!!
loftboy
Forum Regular

Joined: 24 Jun 2004
Posts: 1129
Location: Colorado
Reply with quote
i don't think thats a very good example (hals) but then again I don't use that much
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
loftboy wrote:
there are several Ide's for actionscripting

heres what i use
http://www.sephiroth.it/python/sepy.php


Now THAT is what I am talking about
loftboy
Forum Regular

Joined: 24 Jun 2004
Posts: 1129
Location: Colorado
Reply with quote
lemme ask on our cfm board about classes
truthfully I dont know

but most ppl are at the big cfm conference
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
loftboy wrote:
i don't think thats a very good example (hals) but then again I don't use that much


Are you saying that you don't do a lot of OOP in your webapps or are you just a "site" guy, meaning a few dynamic things here and there in the web sites, but nothing enterprise level? If so I can understand why CF might be attractive to you vs. .NET - quick & dirty type stuff - like Classic ASP & PHP.


Last edited by bobum on Tue Jun 28, 2005 6:51 pm; edited 1 time in total
bobum
Elvis Fanatic
Elvis Fanatic

Joined: 16 Nov 2004
Posts: 746
Location: Montgomery, AL
Reply with quote
loftboy wrote:
but most ppl are at the big cfm conference


Yea - is that CFUNITED or something? I heard about something like that.
never ending discussion of .NET vs CF
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
All times are GMT  
Page 4 of 6  

  
  
 Reply to topic