|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
CF vs PHP
Hey guys. I'm sure this questions has been asked before (couldn't find anything on it at devshed though). Anyways, I program in Java, C/C++ and PHP. I have my own company that does tons of PHP work for small companies and at the job I work at, we use Java and JSP. Anyways, ColdFusion sounds pretty good. I know you can incorporate Java into CF which is very nice. I think macromedia is a great company (M$ and ASP suck). Before you start bashing about how everyone in this forum will say CF is better, I only want people who have either programmed in BOTH or have factual data that proves one is better. I like CF cause I hear it's very easy to do the easy stuff (harder to do the hard stuff, but thats where JSP and servlets come into play). Please don't oppiniate about how CF is way better (speed wise I know PHP is way faster).
|
|
#2
|
|||
|
|||
|
Actually PHP is not way faster than CFMX, but this is a persistent rumor. If you have test data that contradicts this please post it. CFMX is as fast as the Java server it runs on, and JRun is actually even faster than WebSphere and runs neck and neck with Tomcat. J2EE servers like Tomcat are known to be pretty darn fast.
But since very few applications run at full load all the time, the real question is what are the inherent advantages of CF over PHP, and of course what are the advantages of PHP over CF. I do not program in PHP but I am pretty familiar with it. And just for the record, I think PHP is great and if I were not a CF developer I would probably be a PHP developer. The key benefit of CF is that it abstracts virtually anything that a developer would need to do for most web applications into tags. Tags like CFQUERY, CFFTP, CFHTTP, CFCHART, CFLDAP, CFINVOKE and many more, each do what would take lots of code to do in PHP. Yes you can create your own classes in PHP to handle this, but then you have to maintain them, update them, debug them, and test them. The CF tag library is basically like having a huge set of prebuilt and pretested PHP classes that do all of these things. The other key benefit of CF is the learning curve, which is basically zero. If you know HTML, you can start building simple CF apps in 15 minutes. In it's favor, PHP is a much lower level language than CF. So if you do need to "break out of the box" and do things that the built in CF tags don't do (say, modify system settings), then PHP will let you do this. However, because you can easily invoke any class in the Java API from with CF, this advantage is almost moot because anything you can do in Java you can do in CF. Of course, that means knowing about Java, which is also much harder to learn than CF and much more low level, obviously. The other advantage that PHP has over CF is the skill of the user base. The danger of CF is that it is SO easy to use that you get people who have no idea how to program properly building applications. This has really always been the root of CF's perceived limiations like poor speed or limited functionality. The problem is almost always that the programmer did something wrong, not that there is something wrong with CF. Edit: One other big advantage of PHP over CF that can't be ignored is that PHP is way more popular than CF, probably due to the fact that it is free and open source, where CF is not free and is not open source. Though there are now at least 2 vendors that sell CFML server (MM and BlueDragon) and there are free developer versions of the server available for download. Basically, with Java-based CFMX, you can do anything that you can do in PHP and more, because you can do anything that you can do in Java in CF. You have the CFML tags to do most standard things really fast, and if you need to you can dig into Java to do more esoteric things. It's kind of the best of both worlds. Hopefully that answers your question?
__________________
Ask if you have a question, but also help answer questions that you have knowledge of! Thanks, Brian. How to Post a Question in the Forums Last edited by kiteless : August 16th, 2004 at 11:00 PM. |
|
#3
|
||||
|
||||
|
Wow thank you so much for the quick reply. I can't agree with you more. I think Macromedia is a GREAT company. I love enryone of their products. I use MX Studio 2004 and it comes with ColdFusion MX which got me thinking (originally because the name sounded so cool). But once I realized that this is a serious language, I started to look into it. When I saw the tag based syntax, that kinda scared me but then I thought how it would make CFML and HTML mix so easy (unlike PHP). I am seriously thinking about switching because I can do all the easy stuff in PHP and write backend components in Java (correct?). I think PHP is a middle ground between the two which makes things like ODBC querys a hassle (which I use ALL THE TIME) but then it makes image creation pretty easy which I bet is a pain, if possible, to do in CF (correct me if I'm wrong). The only thing I said about PHP being faster is that you have the LAMP (Linux, Apache, MySQL, PHP) combo which is extrememly fast (faster than JSP and J2EE). Yes, PHP does have a big fan base because it's free and very easy to learn. But as you said, this is also a huge downside. Go look at the questions people post in the PHP section. Some people try to make app's and don't even know PHP! Anyways, I will always love PHP (fast, easy, free and FUN) but I think there is a big future for CF/JSP (I will never use ASP).
In the next few days I expect to pick up a CF book and start doing some stuff in CF! Thank you so much! |
|
#4
|
||||
|
||||
|
Now that I think about it, I had some uneasy feelings about switching. If someone could answer if CF has these features that would be great.
Image Creation On-The-Fly - Can CF create images like PHP can on the fly and a) output them to the browser or b) save them to the file system Socket Manipulation - Can CF interact and manipulate sockets like PHP can Header Modifications and Cookies - Can you modify headers and I hope to god you can set cookies (maybe a dumb question). Sessions - CF supports sessions, right? Basically I just want to know how robust the language gets. I am eager to try it out but I dont want to get CF and not like it. Or if someone has a link that lists the major features of CF, that would be great. |
|
#5
|
||||
|
||||
|
Be a real man and COLDFUSIONIZE it
![]() |
|
#6
|
|||
|
|||
|
You can use any of the Java classes (like the Java Advanced Imaging API) from CF. And the next version of CF ("Blackstone", due out in Jan 2005 or so) will have a CFIMAGE tag.
CF has no tag or function to interact with sockets, but again any of the Java API classes that do this can be called. Blackstone will also have an event gateway that will allow CF to respond to any type of request, not just a web request, such as JMS, SMS, IM, FTP, Telnet, etc. CF has CFHEADER and CFCOOKIE. CF supports sessions in an incredibly easy way. The development version is free, just download it and mess with it. |
|
#7
|
||||
|
||||
|
Wow. I am really gonna go buy CF now. Thats amazing. I will defintaly start using it over PHP. I have one last question which will totally sell me on it. Does it support OOP? I know I can write Java for big stuff but I still prefer OOP. Please get back to me.
|
|
#8
|
|||
|
|||
|
Yes you can write code in Java for full OOP. CF also has ColdFusion Components (CFCs) which are object-like constructs. They support inheritance, polymorphism, composition, have methods with access modifiers, return typing, argument typing, introspection (automatic documentation based on metadata), etc. They don't have interfaces (which I really wish they would add and which may end up in Blackstone).
|
|
#9
|
||||
|
||||
|
Yah I hope they add that in BlackStone. I think it is a great language but now I have my doubts as to whether I should just stick with pure JSP. Something that is already familiar to me. I currently have only used Java for client programs and some applets but JSP will be easy. I don't know I am so confused here. And I know all of you are going to say that I can use CF for standard stuff that would take much longer in Java and then I can use any Java API but I kinda like to be pure. AAAAHHHHHH too much to decide on!
|
|
#10
|
|||
|
|||
|
Dude you're crazy if you want to write your display code in JSP instead of CFML!
Did you know you can call JSP Tag Libraries from right inside your CFML pages too? To me the best hybrid is to use something like the Mach-II framework to act as a controller and a view renderer, and code simple business logic in CFCs and complex domain models in Java classes. |
|
#11
|
||||
|
||||
|
Yah, your right. I am gonna wait for that new "blackstone" version to come out and then I'll make the switch. Does anyone know of a pretty complex site written in CF. I just want to check it out. And kiteless, one of the reasons I would use pure JSP is because I do not like mixing lnaguages unless I have to. I will go out of my way to write something in PHP that could be done in PERL (unless it absolutly has to be in PERL). Also, the speed factor. I know that CFMX is written in Java but one of the Java specific frameworks would probably be alot faster.
|
|
#12
|
|||
|
|||
|
The entire Macromedia web site is written in CFMX.
And the Java frameworks are not any faster than CF, since in the end it's all bytecode. In fact, frameworks like Struts are actually pretty slow because they are so cumbersome and feature-overloaded. |
|
#13
|
|||
|
|||
|
Well, like a say before, the language is only as powerful as the programmer. The same goes for speed, I haven't meet a language that is natually slow, rather it wasn't coded well. This all applies to this thread as well. If you have the money, then go ahead and do some Coldfusion, you can't do anything but add to your knowlegde.
![]() |
|
#14
|
||||
|
||||
|
I will. I am going to buy a few CF books and wait for that new version to come out. Might mess around with some free stuff in the mean time. I agree with you for the most part. In the early days of Java, everything was pretty slow. But there are still differences. An app wriiten in assembly (or C/C++) will execute faster than one in Java or VB. But as for web langauges I think they all run on par, cept for ASP because I know from experience that it is slow (thats what I started programming with). Anyways, everyone had great input! Thank you kiteless for all the info. I definatly think that CF/Java is the way to go. Thanx alot!
PS. Of course MM website will be in CF but it is also not very complex. I mean I think their search button is the extent of it (although I hear CF has amazing search capabilities). |