PHP v ASP

Discussion in 'Programming & Software Development' started by maskslash, Jul 6, 2006.

  1. Ze.

    Ze. Member

    Joined:
    Sep 13, 2003
    Messages:
    7,871
    Location:
    Newcastle, NSW
    I had a look at it, i'll have a look again when i've got more time but i wasn't too impressed. It seems to me you've found that python fits your way of thinking and thats why you are so happy with it.
    Whilst language plays a small part its only when it gets in the way and forces a particular pattern. I dunno where you've been but Perl is famous for bad code. It's the poster child for code that is hard to maintain.

    I'd have to agree with GreenBeret on this , so i'll myself the typing and won't repeat what he's said too much.
    I would have to disagree there are plenty of people who don't understand object oriented programming and abuse it immensely.

    One can write object oriented code in c if they wish , they just have to discipline and impose rules on themselves on how they name functions and call them. Correspondingly one can write procedural code in python , ruby , java or any of the other object oriented languages if they wish.
    There are many reasons for languages to become popular and most of them aren't related to how easy they are to use. I personally don't find the django syntax and structure very attractive at all , i prefer Rails, (although from the tutorials i saw that aren't the latest version of Rails the auto generated displays for django were prettier).
    It all depends one how one abstracts the code , one has to choose the right manner of abstraction in any language to be effective.
    When assembly is written by a good programmer it isn't that hard to follow.
    You can give a bad programmer the best language and he'll still write bad code. It's not because of a failing in the language but rather a failing in the programmer.

    Correspondingly you can give a good programmer a bad language and he'll write nice clean code without any hassle.
    Whilst i'm not a fan of php, you have to be kidding if you think somebody can't write bad code using Rails or Django. It'll turn out to be quite common the more people that code for it.
    Have you had much experience in many other object oriented languages?

    Auto generated code with these frameworks is fine but thats all it is , i'm sure a lot of us could write some auto generators if we wish and i'm sure some of us have. I know i've written little languages before to do tasks.

    I'm going to take a wild guess and say one of the reasons you are so enchanted with these frameworks is the MVC pattern and the avoidance of having to write SQL statements.

    You can use the MVC pattern in many languages (including php and asp) if you wish. I personally don't find SQL that difficult although i did like some of the purer forms of relational databases easier.
     
  2. Daemon

    Daemon Member

    Joined:
    Jun 27, 2001
    Messages:
    5,471
    Location:
    qld.au
    It probably is the case that I find Django fitting my way of thinking, but I'm certainly not alone in that. The reason Django is already successful is _because_ of their way of thinking, it's a system that really suits rapid web development. The writers of it needed something that they could rapidly evolve the development of their website, hence created a framework that adapts this approach very well.
    Agreed, Perl is probably a bad choice because there is a lot of bad perl code, but I'd also argue that well written Perl is easier to maintain over well written VB etc.

    Most people will go out and buy a truck if they need to move lots of equipment, they won't try to use their existing car to do it. Similarly, most people don't go out and buy a truck to get their shopping each week because it's the wrong tool for the job. I don't see programming as being any different, you need to choose the correct tool to start with instead of trying to shoehorn something else to fit the job.
    For Rails and Django, the reason they are popular is because they allow rapid development and are relatively easy to use.
    How much have you worked with assembly before? It's not easy to follow at all once it becomes a sizable program, and it's the reason that other languages exist in the first place. I never write assembly level code unless I really have to these days, the productivity drop versus the small speed gain really isn't worth it. Most DSP's come with software that allow rapid development these days and do a pretty decent job of optimising the code itself.
    I didn't say they can't write bad code, but it does make it harder to write bad code. I'm not trying to stipulate that the language is the cause of the bad code at all, I just think it plays a significant part.
    I have experience in C, C++, Java, PHP, Python, ADA, Fortran, Pascal, Perl, VB, ASP, C#, Ruby, assembly and Perl. I have developed applications with over 100,000 lines of code for enterprise level applications down to the development of software running on embedded hardware.
    You've missed the point of these frameworks if you think it auto-generates the code. That's not what they do at all, "scaffolding" is the wrong approach for code you can maintain easily. You need something (Django does it well, Rails is fairly good) that's dynamically generated at runtime so that there really is only one true set of code.
    No, I looked at these frameworks because my time is better spent adding functionality rather than writing lots of code and SQL statements. I have no problem writing SQL statements and still do for many of the programs I still maintain at work.
    You can't do it in ASP and PHP to the same extent, so you're nearly back to square one with some of the PHP frameworks. Most of them just generate code for you, which is the wrong approach from a maintenance point of view. They are not even close to the same league as Rails or Django for rapid development and being able to rapidly evolve a website. As I have said previously, Rails and Django do actually live up to their hype.
     
    Last edited: Jul 9, 2006
  3. Elyzion

    Elyzion Member

    Joined:
    Oct 27, 2004
    Messages:
    7,449
    Location:
    Singapore
    You can, you just need to write the framework to do it.

    Do you have experience in ASP.Net :p
     
  4. Daemon

    Daemon Member

    Joined:
    Jun 27, 2001
    Messages:
    5,471
    Location:
    qld.au
    Again, without either being proper OO languages (ie ASP and PHP) you simply can't do it to the same extent. It's not just the framework the underlying langauge and concepts that make Rails and Django the success they are.

    I don't have any experience in ASP.NET so I can't comment on that one.
     
  5. Elyzion

    Elyzion Member

    Joined:
    Oct 27, 2004
    Messages:
    7,449
    Location:
    Singapore
    Ok, i was just curious, i can't stand ASP, but i love ASP.Net, but untill .net2.0 came out, i wasn't sure weather to go PHP or ASP.Net, but when .net2.0 came out, i was sold.
     
  6. phreeky82

    phreeky82 Member

    Joined:
    Dec 10, 2002
    Messages:
    9,615
    Location:
    Qld
    i'm sure i'm not the only one using PHP extensively with my own framework (well technically my employers)

    somebody will shoot me down for this (others may agree), but a full OO structure is, in a lot of ways, totally inappropriate for the way the web works, especially when the lifttime of some sessions is less than 1 second.

    imo the key to successful web applications is anything but the language selection, but the way you use it, and your knowledge of web browsers and most importantly using HTTP and your selection of web server software to its full extent.

    the way you spit out text, manip a database, do some mathematics and handle sessions is in essence the same between all of them.

    talking about enterprise level applications with 100,000 lines of code doesn't really mean much to me, some of the things i've worked on have been that size too and it has certainly been a mixed bag of whether that's a good thing or a bad thing. if you're talking 100,000 lines of code i'm sure as hell hoping most of that is hidden away for the majority of development and is part of a more central business workflow/process model in use throughout the business.
     
  7. Daemon

    Daemon Member

    Joined:
    Jun 27, 2001
    Messages:
    5,471
    Location:
    qld.au
    Why would you say that OO is no good for web use? I'm not quite sure what to respond to with here, as I see it makes total sense. True OO code gives you a very easy ability to naturally grow your code if designed right, whereas flat structures commonly found in PHP don't. I have been able to generate websites in Django within 1/2 a day that would have taken me over a week to do in PHP. The added bonus on this is that when you come to change or add any additions to this code it's a matter of minutes, not hours. If you look at where Django came from (ie a news website), they had to add totally new sections to a website in hours, not days. We're not talking a new article or something simple like that here either, this is hours to add a totally new area that's dynamic to the website.

    Have a look at sites like www.lawrence.com and www.chicagocrime.org, they were setup by one of the main authors of Django. As an ex PHP programmer (well I don't write much new stuff anymore), I really wish I had looked at Rails and Django much, much earlier.

    You'll also find that Python and Rails perform quite well too and although PHP is fast, it requires external software to cache it's output.
    It's certainly true that most things can be done in all languages, but if it can be done quicker and easier and allowing the site to scale then isn't it worth doing it properly in the first place? Would you rather try to maintain 200 lines of code or 2000, especially if the 200 are easier to follow? That's the logical path I choose to follow.

    I've never had to work with a website with 100,000 lines of code (thankfully!) but in other areas I have. When you have had to work with anything of a larger scale you soon start to work out what programming methods scale well and what doesn't :)
     
  8. teegman

    teegman Member

    Joined:
    Feb 13, 2006
    Messages:
    94
    Location:
    Adelaide
    I've just started looking into this and to say that Cake excites me is an understatement. Anyways, the ASP vs PHP (vs J2EE and vs Ruby on Rails now) arguement is a little silly, its horses for courses. A hobby developer isn't going to want to learn to use J2ee to write a simple blog site, the same way a big company isn't necessarily going to want to use php to interact with their existing systems.
     
  9. phreeky82

    phreeky82 Member

    Joined:
    Dec 10, 2002
    Messages:
    9,615
    Location:
    Qld
    Yeah probably a completely wrong way of trying to describe a more complex issue. OO itself is not the problem, but the way you structure you code (which of course can be inappropriate in a non-OO approach too).

    A lot of OO programmers will make a habit, more so than when coding non-OO, of doing a huge amount of initialising of some type (often including pulling in huge amounts of data), which is a web world is often completely wrong.

    So my description of the issue, at best, sucks a*se :D

    I am a fan of quite lean code for the web and do prefer to keep business processors out of the primary web-serving code and generally away from PHP. If you follow that approach then generally the PHP code itself is small enough for maintainence to be quite simple.

    Btw in my opinion non-OO code can be just as readable, easy to maintain and code as OO code. If you come across code that isn't then the programmer is at fault, and if you find it hard to create good non-OO code then you probably need to consider the design more.
     
  10. hyperstyle

    hyperstyle Member

    Joined:
    May 24, 2003
    Messages:
    1,731
    Location:
    Brisbane
    I would die without the ability to use OO in php. My current project, which i started from scratch is now probably pretty close to the 100 000 line mark. Without OO i would dare say it'd now be closer to 200 000 lines and a bucket of shit. If you use OO right your actual working code will be very lean and small. Combine that with templates to separate your php from your html and you are halfway to a solid app.
     

Share This Page

Advertisement: