![]() |
|
loftboy
Forum Regular
|
btw Scott, I got me a mac mini this week and it's pretty slick, i havent upgraded the ram yet but it can handle most of what i throw at it and I even loaded up wolfenstien and it ran it without a hitch.
|
||||||||||||
|
|
|||||||||||||
|
Josh
Forum Regular
|
What BS? And I didn't try to take out java. In fact I mentioned it because of the power that java gives to the developer. From the little bit of AS I've worked with it's very well organized... not always the best documented, but easy enough to figure out what's going on. Im not worried about that. Just saying that it may take me just a bit longer to figure out what's going on and what to do with it than you since you've been doing alot more with it. |
||||||||||||||
|
|
|||||||||||||||
|
loftboy
Forum Regular
|
well i gotta run so it will be later this afternoon.
.as is well organized, pretty close to java syntax. bottom line is that the technology is only as good as the person writing itm the major players can pretty much all do the same things. |
||||||||||||
|
|
|||||||||||||
|
bobum
Elvis Fanatic
![]()
|
Let's try something here - a little experiment.
Let's say we are making a baseball game website. We want to have a player object somewhere in our code that will contain stats about this player. We'll assume only field players and not pitchers for this test. We want to have things like: the players name (first, middle, last & suffix) how he bats (left, right, switch hitter - left/right throwing) how he throws (left/right) his positions played hits at bats his batting average doubles triples homeruns walks strikeouts slugging percentage steal attemps stolen bases Now in CF - what would that player class/object look like in code? We're not worrying about HOW that data gets into the object, just what the class structure would look like in ColdFusion - if you can even do something like this in ColdFusion...this may be where you have to leave CF behind and embrace Java...I dunno but I suspect we'll find out shortly. Any CF guys wanna take a stab at doing this? |
||||||||||||
|
Last edited by bobum on Mon Jun 27, 2005 7:28 pm; edited 1 time in total |
|||||||||||||
|
loftboy
Forum Regular
|
you write a cfc that basically does the query and cfcs return a structure of the data then you create an object which is a java object and output it.
something like the cfc
cfreturn qGI returns a structure of the data that can be directly called, manipulated, searched, remoted, web serviced, just about anything you want. then you can set it upon page entry to create your java object that can be called at anytime and is ready to go
then when you want to use it on a page or whatever you invoke it
at which point the info is again in a structure and you can output it anyway you want to.
Scott, thats childs play, I think you have a really distorted view of what cfm actually is |
|||||||||||||||||||
|
|
||||||||||||||||||||
|
cpnet
|
Actually, I think including pitchers might be quite revealing. My reason for suggesting this is that I'm fairly ignorant of CF. I'd like to see how if you were using CF, you'd handle this. (With C#, VB.NET or Delphi for .NET, you would probably use inheritence). |
||||||||||||||
|
|
|||||||||||||||
|
loftboy
Forum Regular
|
ok lemme revise that if you want to get info such as batting average and such or for pitchers you can put some logic in as well, i wont put it all but you will get the point, granted there are other factors and for this i will be using a rational db
and that will be an addition addition to the structure that you can call |
||||||||||||||
|
|
|||||||||||||||
|
bobum
Elvis Fanatic
![]()
|
If I have a distorted view of ColdFusion I will admit it. But I still don't see the object lofty.
And I didn't mean to show me how you pull it from the database. Populating the object has nothing to do with the creation of the structure of said object. Here is a stab at a stubbed version of the player object in C#...
In .NET you would access this player by doing something like...
I could easily add in the constructor logic to pull stats out of a database or XML and populate this player with stats so that when he was constructed, he'd have values in those fields. But you should get the idea... Now you can access all Barry's stats by using the properties like:
We can now take this player and make a 9 item array of players and we now have a team. Note that I calculated the batting average, slugging percentage and steal attmepts within the object and that the positions property is an ArrayList. If you're not familiar with what an array list is it's just a dynamically sized array. Can something like this class be replicated in ColdFusion? If so can you show me the code to do it? If we want to make this a REAL side by side comparison, I could come up with an Access DB or an XML file with some stats in it and we can both use the same data to actually make it work. |
||||||||||||||||||||
|
|
|||||||||||||||||||||
|
bobum
Elvis Fanatic
![]()
|
Yup - get the idea and that's cool Lofty but it's not really an object that we can work with and manipulate. It's just a recordset (which I know is an object itself but I think you see what I am getting at). How would I, in CF, create a player object that I can store in memory and manipulate etc etc etc? Or is that something that you would have to do in Java? |
||||||||||||||
|
|
|||||||||||||||
|
bobum
Elvis Fanatic
![]()
|
This should also be moved into the programming forum...not web design....
|
||||||||||||
|
|
|||||||||||||
|
Josh
Forum Regular
|
Perfect example of a very basic class. I was working on something similar, but it was a more complex example (methods for interfacing w/ a make believe XML schema). I was thinking too much lol... so that's scrapped. Like you originally said, nothing actually or working with the data per se, but just providing the basic object.
At that point, you can create a different class used for interfacing w/ the datastore and populating the data. Or it could just be an extension of the current class. True OOP is a beatiful, and overly simplistic, thing when your mind finally wraps around what's trying to be done and the best way to accomplish the task. And what's even funnier is that when you do start using OOP all the time, even though you invest alittle more code in the classes, you save SOOOO much time, organizational effort, and code in general when actually working with these objects. I've never seen a proper object in CF, and it's something that to date no CFer has been able to produce for me. I'm anxious to see what lofty pulls up, because if anybody can find these deep dark secrets in CF it's him. Should we pull in overloaded methods, too? |
||||||||||||
|
|
|||||||||||||
|
bobum
Elvis Fanatic
![]()
|
That's next...I want an overloaded constructor... But if this is Java stuff not CF then I understand...if CF can't do it - it can't do it. That's prolly why they built CFMX on top of the Java J2EE stuff so that if you NEED this kind of power and flexability, all you have to do is learn Java AND ColdFusion then get them both working together. |
||||||||||||||
|
|
|||||||||||||||
|
Josh
Forum Regular
|
Right... and why my original post that got Dave all fired up said NOT using java, just the CF stuff since most CFers don't use Java... but my thinking is always rejected by lofty
|
||||||||||||
|
|
|||||||||||||
|
bobum
Elvis Fanatic
![]()
|
That's 5 more revisions of CF than I have ever used... |
||||||||||||||
|
|
|||||||||||||||
|
bobum
Elvis Fanatic
![]()
|
I (finally) found a tutorial on using some simple OOP stuff in CFMX...I really hadda look hard. I was hoping just to find a simple "Here is how you make a class in CFMX" tutorial - but they don't exist. I think it's because they are called ColdFusionComponents instead of classes...
|
||||||||||||
|
|
|||||||||||||
| never ending discussion of .NET vs CF |
|
||
|



