SitePoint Sponsor

User Tag List

Results 1 to 22 of 22
  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hello:
    I am reading and using Learn to Program by Chris Pine. I picked this book up because I know ZERO about programming and kept getting lsot when I tried to learn PHP directly. I am starting a course in PHP next month that assumes some rudimetarty programming knowledge (like what's a string, variable, object etc.). Do you think learning this intro to Ruby will mess me up when I go to learn PHP or are they at all similar? I couldn't find a book on PHP for dead beginners.
    Since Ruby isn't highly supported for hosting, I need to learn PHP. Maybe I'll come back to Ruby later but :
    Should I NOT read this book right before learning PHP intro?

    Thanks for opinion.
    Andrea

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2006
    Location
    Halifax, Canada
    Posts
    498
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ruby and PHP are not very similar in terms of syntax, but learning *any* language will help with your ability to code in other languages.

    The only disadvantage I could see is that once you know Ruby, you will wonder why PHP is not as intuitive .

  3. #3
    SitePoint Member skrolikowski's Avatar
    Join Date
    Nov 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    PHP is my favorite language I've learned/used so far.
    Try these books:
    http://www.sitepoint.com/books/phpmysql1/
    http://www.amazon.com/World-Wide-Vis.../dp/0201727870

    Learning one language probably won't help with learning the other.

  4. #4
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by skrolikowski View Post
    Learning one language probably won't help with learning the other.
    It will. A lot. The first programming language you learn is a lot harder than the second. Most languages are 80% standard and 20% new, so you already know 80% of the second programming language you learn. But. If you want to use PHP eventually then you should just learn PHP and not Ruby. You'll need to learn the full 100% of the first programming language you learn anyway. Ruby IS easier to learn than PHP though.

  5. #5
    SitePoint Enthusiast
    Join Date
    Feb 2007
    Posts
    38
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thank you for the replys. I tried a couple of PHP books including the Dummies one (hated that crud) but I'll ccheck out those recommended by skrolikowski. So the final verdict is: it might help and it might not! That's okay. I'll start with Ruby and move on from there.

    Cheers

  6. #6
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Personally, what is the point in learning PHP now you've learnt Ruby? PHP is the new Perl really, it's full of hacked "fixes" that break things (magic quotes, a totally retarded solution to SQL escaping because you use a pair of double quotes(""), not \" to escape SQL strings), always has security problems and the developers can't agree on how the language behaves (See http://bugs.php.net/bug.php?id=33698).

    PHP also only narrows you to web programming. (I know it's possible to do other things, but PHP really does suck at them generally speaking).

    PHP is faster than Ruby, that's about it. But it doesn't justify using it. If you find Ruby is too slow, look at Python, and more specifically DJango for web stuff. It's a lot faster than Ruby, but Python and Django will be easy to adapt to due to it's similarities.

    As a rule of thumb you'll find once you learn language, learning others is not too hard, unless you learn something that is very different from a paradigmic perpective (i.e. Learning Haskell which is functional after learning Java, which is supposed object oritiented (It isn't really, but it's marketed like that so the dumb, non-geek business manager like people in this world think it's cool)). However, having said that, it highly recommended you learn languages that very different, as it will make you aware of different ways/perpectives to solve solutions.

    OK, do be aware I am biased a little, I hate Java and PHP, so do consider that after reading. I think however that learning Ruby is better than PHP as a first language. It's consistent as a rule of thumb and has few quirks when compared to PHP, C++, and Java.
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings

  7. #7
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It depends on what type of development you want to get into, and what type of mindset you have. If you just want to be a freelance developer, and pickup the smaller clients who maybe need some e-Commerce store, or maybe a membership database with a few thousand accounts, then Ruby is perfect.

    If you hope to get into developing the larger systems with hundreds of thousands of accounts and millions of transactions, then PHP is probably the way to go. My two cents at least, although I'm still just getting my feet wet with Ruby.

    Matt
    Kiopa Software -- Demo Now Online! Check it out!
    Goal: Consolidate all data & tools you use on a daily basis.
    Grand opening special, licenses FREE for a limited time.

  8. #8
    SitePoint Enthusiast
    Join Date
    Jun 2006
    Location
    Tampa, Fl
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Definitely start with PHP and learn it as much as you can. Then you may try some other languages which are going to be easier to learn since you are familiar with some techniques and what is a string, array and thing like the ones you mention.

  9. #9
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    At the risk of being flamed back (and starting a Holy war), I'm gonna stick my neck out and ask why learn PHP first (if at all?)... (Also do bear in mind I'm saying this as someone who's used PHP more than any other language)....

    PHP is a nasty language. To me it's C for HTML programmers. Everything uses a nasty proceedural nature, which is as inconsistent as hell (take a look at string, strpos, vs str_replace... does the string go at the beginning or end, and why does one function have an underscore when the other doesn't?).

    As for know what Strings and arrays are etc, PHP's type system is pure hell. PHP "arrays" are not arrays really, they are ordered hash tables. While they are flexible, it's really bad the way they've made one god-like collection type whick people see as "arrays". Like I was saying the type system is a total mess in PHP, It's not easy to remember all the irritating coercions that take place... for instance, knowing if "0" == 0, 0 == null, 0 == "", "" == false, etc etc (I think "0" == 0, and 0 == "", but "0" != "", which is very rather inconsistent as you'd think by logic that if "0" == 0 and 0 == "" that "0" == "").

    While people say PHP is fast, it really falls over if you do anything more than a simple site with it, and soon slows down when you want to use any form of framework based archietecture.

    Like I also said PHP is riddled with security flaws as well. Hacks like magic quotes don't even secure anything, and many releases are fixing some form of trival security bug. You only need to look at the changelogs to see the number of silly security fixes they keep having to throw in.

    PHP is nothing more than the result of a few cowboy C programmers who struck lucky. While I did say in my last reply I'm biased, most reasonable programmer will agree that the points I make are fairly reasonable. Look at it this way, why are so many PHP and Java programmers flocking to Ruby, Smalltalk, Python etc? Now look at the percentage of Ruby, Smalltalk and Python programmers flocking to Java and PHP.... not many urgh?

    I'm not going to make out Ruby is flawless, it's not. It's slow as hell, and very unsupported in terms of hosting. However as a language it has a lot to offer for new programmers as it is clean, simple, consistent and allows you to program in a range of styles / paradigms.
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings

  10. #10
    SitePoint Member
    Join Date
    Mar 2005
    Posts
    5
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm new to Ruby (and Rails) - fact is I'm still learning all this stuff.

    But I dont see speed as an issue, with JRuby and the fact that Ruby seems to be strongly typed even if type is dynamically allocated it seems to me that someone could write a compiler for Ruby which would make it as fast as Java

    what's interesting is that Java and Ruby came out at about the same time, and while Java was pushed, contorted and twisted to suit the crazy ideas of enterprise programmers. Ruby was allowed to find itself and seems to be all the better for it.

    Maybe I'm wrong or biased, but the whole Ruby ethos seems to be about findging the simple and elegant solution rather than something over engineered and complex

    I just hope that the people behind Ruby and the people behind Rails keep things simple, but not so simple as to make it terse and hard to read. I would sooner the solutions be a little verbose and read easily than terse and super efficient

    my 2c worth

  11. #11
    SitePoint Zealot
    Join Date
    Dec 2005
    Posts
    117
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by MiiJaySung View Post
    which is very rather inconsistent as you'd think by logic that if "0" == 0 and 0 == "" that "0" == "")
    No, 0 is an integer and "0" is a string. How hard is that?

    The PHP team meant to develop is this way, to help make it easier for beginners to learn. You don't have to worry about strict type casting, because PHP takes care of that for you. That's the same reason it's a "nasty procedural language"; they made it easy to learn.

    Quote Originally Posted by MiiJaySung View Post
    While people say PHP is fast, it really falls over if you do anything more than a simple site with it
    Really? heh, you must not be very efficient at development then.

    Quote Originally Posted by MiiJaySung View Post
    and soon slows down when you want to use any form of framework based archietecture.
    Well, that's just because whatever framework you're using isn't very efficient, and can hardly be blamed on the PHP team.

    Quote Originally Posted by MiiJaySung View Post
    PHP is nothing more than the result of a few cowboy C programmers who struck lucky.
    heh, I love this line of thinking. Just gotta go against the grain.

    Quote Originally Posted by MiiJaySung View Post
    While I did say in my last reply I'm biased, most reasonable programmer will agree that the points I make are fairly reasonable.
    Sorry, but nope. Again, it depends what you're looking for. How many enterprise applications do you see switching over to Ruby? None. It's all smaller based sites and systems, because that's all Ruby is good for. If you try to plug in 500,000 accounts and 3+ million transactions into a Ruby developed system, it's going to fall apart, and quickly. If you have a properly developed PHP system though, it can easily handle the load.

    Ruby is good if you're geared towards anything less than enterprise development, and you like things done the quick and easy way. The way I see it, with PHP you're giving an empty lot of land to build a house on, whereas with Ruby on Rails, you have to work around an existing foundation. Again, it all depends on your mindset, and what kind of development you're doing.

    Quote Originally Posted by MiiJaySung View Post
    I'm not going to make out Ruby is flawless, it's not. It's slow as hell, and very unsupported in terms of hosting.
    And I'll do the opposite and say Ruby is an excellent concept, with an even better implementation, and is something that every developer can learn from, whether or not they use it.
    Kiopa Software -- Demo Now Online! Check it out!
    Goal: Consolidate all data & tools you use on a daily basis.
    Grand opening special, licenses FREE for a limited time.

  12. #12
    SitePoint Enthusiast
    Join Date
    Jun 2005
    Posts
    62
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Get a Ruby on Rails Beginner Book

    I am learning Ruby on Rails right now, and I know some PHP. If you are building small to full blown apps, just get Build your own Ruby on Rails Web Applications by Patrick Lenz. I am going through this book right now, and it is an amazing introduction that will help you appreciate an elegant language! Seriously, Rails does most of the work for you!

    PHP has its advantages too because as you don't have a framework in the way. If you want to learn about PHP, I would highly recommend PHP Solutions: Dynamic Web Design Made Easy (Solutions) or view the book on the publisher's site.

  13. #13
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    What I stated about coercion in PHP is right. The program below will demonstrate

    Code:
    <?php
    
    if ("0" == 0)  print "string 0 equal to number 0\n";
    if (""  == 0)  print "empty string equal to 0\n";
    if ("0" == "") print "string 0 equal to empty string\n";
    
    ?>
    The automatic casting rules in PHP are hardly useful... The above example illustrates how PHP is inconsistent because it's type system does not follow the principles of "Deductive reasoning". When I used PHP at work, my exboss could never remember what would be true or false when using ==. I often myself used === to get round this. It is not designed to help developers at all. All it does it does allow new programmers get into bad habits in the way they expect data types to be handled because they don't understand the purpose of data types.

    Coercion in a language should be consistent when used (i.e. follow some rules of deductive reasoning so it's easy to remember how things are cast) and it should be easy for a programmer to see where it happens. Well in my opinion that's show things should work, and most languages do follow that (Or at least give cast warnings, like C does)

    It's nothing to do with me being efficient with development or not or not really when it comes to the framework issue. You look at most PHP frameworks out there, they really put a large overhead on the app. While frameworks are evil and stupid on small projects, when you start developing something of any size you need some sort of framework / archietecture. Just look at all the CMS's and portal systems PHP has... they are really bloated and slow.

    The cowboy statement was meant in a joking tounge and cheek manner. I never came up with the statement, Lastcraft made that statement a while back when we were discussing some stupid PHP bug I found that the PHP developers were trying to avoid fixing.

    The "enterprise" arguement is a stupid one. Most people who talk about "enterprise" software should be shot. Please *define clearly* what is and isn't enterprise software for me, and where the boundary lies?.... because I really don't know what this is.... as do most other people. The word "enterprise software" is one of these nasty slapstick terms given by business managers and software engineers.

    If you have to use the term "enterprise", I can't say PHP has excelled in this area. It has taken a long time for PHP to be accepted by larger companies in a commercial context. Yahoo is one of the few exceptions. Yes, there are more larger sites using PHP, but that's only because it's getting old in terms of technology, and many of these sites are not large companies, but rather sites like sourceforce, ****, facebook etc. Ruby has been used in a wide range of larger scale commercial projects. You only need to look at http://www.ruby-lang.org/en/document...ccess-stories/ for a few examples. However Ruby suffers in the same way PHP did about 5 years ago because it's seen as a new player in the technology sector. Like I said, PHP is pretty bad in the enterprise sector, it's totally drafted by Java. Does this mean Java is a good language? No. It was good in the late 90's, much like PHP was good in about 5-6 years ago but times have changed, technology has evolved. Anyone could go one forever about the "enterprise" debate. I mean, people could argue LISP is no good for enterprise software because it's 40 years old... yet Paul Graham and Naughty Dog software (made crash bandicoot games etc) have been very sucessful as businesses all because they used LISP to give them a competitive edge.

    The basic point with "enterprise software", is that in reality it doesn't matter what language you use, it's how you use it. Hell, there's loads of big companies like banks who still have huge amounts of their business based in nasty stuff like VB and COBOL (aka... Compiles Occaasionally Because Of Luck :P)

    I'm not sure what you mean by your last point... relating to:

    I'm not going to make out Ruby is flawless, it's not. It's slow as hell, and very unsupported in terms of hosting. However as a language it has a lot to offer for new programmers as it is clean, simple, consistent and allows you to program in a range of styles / paradigms.
    I stated Ruby was a good starting language for learning, but has it's flaws, mainly in the relam of speed, commercial support and hosting. I can't tell if you are a agreeing with me there or not as you also said it's a good "concept" where developers can learn, but said "I'll do the opposite" (how is your point disgreeing with mine). I will argue that the speed is down to the implementation (at a C code / VM level, as opposed to a language design level).

    Like I've said, I'm not totally sticking up for Ruby, I've clearly stated it's hosting and VM speed leaves a lot of room for improvement. However I don't see how people can stick up for PHP when it's such a poor language. I am not one of these people who believe that everything should be coding in language X, because languages are tools and you need the right tool for the right job. However some tools start to become obsolete after time (I mean, who uses flint these days when you have knives for cutting food). PHP is a tool that is started to show it's age in the same way that VB6, and COBOL have. (Does anyone know any COBOL programmers still???)
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings

  14. #14
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by RDFrame View Post
    It depends on what type of development you want to get into, and what type of mindset you have. If you just want to be a freelance developer, and pickup the smaller clients who maybe need some e-Commerce store, or maybe a membership database with a few thousand accounts, then Ruby is perfect.

    If you hope to get into developing the larger systems with hundreds of thousands of accounts and millions of transactions, then PHP is probably the way to go. My two cents at least, although I'm still just getting my feet wet with Ruby.

    Matt
    This is probably where I would disagree the most. Rails is a fully blown framework stack. It's designed for large apps. OK, Ruby needs to speed upa little for high traffic sites (which will happen in Version 2). PHP on the other hand I don't see as a good choice for big scale sites... it was designed as a small template language in much the same way ERuby is designed... I wasn't designed for huge amounts of business logic (Like I said, PHP was a template language for HTML views... business logic was done in C in the original versions, i.e. PHP 2.x). This also shows up as most PHP frameworks show very poor performance compared to native PHP (look at Cake, etc).
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings

  15. #15
    Resident Java Hater
    Join Date
    Jul 2004
    Location
    Gerodieville Central, UK
    Posts
    446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Magic8Ball View Post
    I'm new to Ruby (and Rails) - fact is I'm still learning all this stuff.

    But I dont see speed as an issue, with JRuby and the fact that Ruby seems to be strongly typed even if type is dynamically allocated it seems to me that someone could write a compiler for Ruby which would make it as fast as Java

    what's interesting is that Java and Ruby came out at about the same time, and while Java was pushed, contorted and twisted to suit the crazy ideas of enterprise programmers. Ruby was allowed to find itself and seems to be all the better for it.

    Maybe I'm wrong or biased, but the whole Ruby ethos seems to be about findging the simple and elegant solution rather than something over engineered and complex

    I just hope that the people behind Ruby and the people behind Rails keep things simple, but not so simple as to make it terse and hard to read. I would sooner the solutions be a little verbose and read easily than terse and super efficient

    my 2c worth
    I'm not sure about JRuby, not used it. I think it's slower than normal ruby because it's interpretted in Java. Ruby will never be fast like many staticly typed languages, because it's impossible to get that speed. Personally OO and static typing in languages doesn't work. This is why Java and C++ are so inconsistent (and also why PHP5 has inherited a lot of bad stuff from Java imo). At the same time, Ruby can be a lot faster than it is, Like I said, Version 2.0 of Ruby will make it faster because the current C based VM implementation sucks in terms of speed.

    You are spot in about the Ruby ethos bit. Matz original design plans was to write a language that he enjoyed using. He was set on the idea that programmer happiness would bring productivity. One of the best things I think about Ruby is that it has brought about an awareness to a number of very old languages that never really took off commercially, such as LISP & SmallTalk. There has been a lot more interest in both of these languages recently, and I think Ruby has helped here because Ruby has inherited a lot from each language. I find it a great shame that Sun didn't invest more in "Self" as a language (which was based on SmallTalk to some degree), but rather went off and used Oak/Java which used C++'s OO model instead of Smalltalk's. It's interesting now because I think Sub have a bit of regret here because they've suddenly taken a huge interest in non static languages such as PHP and JRuby. Likewise, it's clear MS have had similar influences with the advent of closures in C# 2.x
    http://virtualfunction.net - Rails Web Development
    http://squaremove.co.uk - Rails powered Property Listings

  16. #16
    SitePoint Member skrolikowski's Avatar
    Join Date
    Nov 2006
    Posts
    22
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Wow! This has turned into a long thread. Anyway...
    When I said, "Learning one language probably won't help with learning the other." I meant that it probably doesn't matter which one you learn first. Personally, I think PHP makes more sense and is easier to learn.

  17. #17
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    @skrolikowski: You don't really know Ruby do you?

    I know both Ruby and PHP and I can tell you that Ruby is a lot easier. It's more consistent. Yes there are more advanced concepts in Ruby, but you don't have to understand them immediately (but it's useful to know later).

    If you really want to learn to program then read HtDP first and then SICP (skip HtDP if you're brave).

    Free online:

    http://www.htdp.org/
    http://mitpress.mit.edu/sicp/

    You'll understand basic programming concepts like recursion, variable scope, higher order functions and data abstraction that many programmers don't understand. You'll also learn about advanced concepts like meta linguistic abstraction, laziness and logic programming.

    The problem is that you cannot apply these things in PHP in practice because PHP is not powerful enough...

  18. #18
    SitePoint Guru
    Join Date
    Aug 2005
    Posts
    986
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    -
    Last edited by Fenrir2; Apr 12, 2007 at 12:05. Reason: pressed submit twice

  19. #19
    SitePoint Member
    Join Date
    Apr 2007
    Posts
    16
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if you want a tutorial that easy to swallow go to this site the only problem it is in actionScript but you will love the instructor joey lott he starts from the bottom and very nice example and as every body say if you learn one language other languages will be easier to pick try the actionScript 2.0 and if you love Joey Lott and the way he teach witch i am sure you will do the advanced actionScript you will love it . i know it is far from server side programing but still in web development the best thing about that tutorial is it is videos and you can play it and stop any time .. they have php title in there but i didn't like it the instructor didn't do great job like Joey lott did

  20. #20
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by tigerfadi View Post
    if you want a tutorial that easy to swallow go to this site the only problem it is in actionScript but you will love the instructor joey lott
    i think you mean this site: http://www.lynda.com/

    i followed the tutorial for RoR here and it was awesome!! i would never have been able to get my self up and running in RoR without this. it's biased toward's mac users but there is a window's installation tut as well.

  21. #21
    SitePoint Member peacephila's Avatar
    Join Date
    Apr 2007
    Location
    Bagan, Myanmar
    Posts
    6
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Busch,
    What was your next step after Lynda course?
    by Chemist
    Chromatography

  22. #22
    SitePoint Wizard Busch's Avatar
    Join Date
    Jan 2004
    Posts
    1,072
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by peacephila View Post
    Busch,
    What was your next step after Lynda course?
    I just finished the entire tutorial and decided to apply what I had learned by making a very simple mock application. I'm still working on that. After that, I don't know. I hope when I'm finished with that, I will be skilled enough to solve the normal web issues I usually run in to.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •