avillanu Posted August 7, 2007 Share Posted August 7, 2007 Last week I finally sat down and did an indepth look at the PHP/MySQL book I had bought years ago. This week I have gone through the basics and finally started coding the simple stuff - basic CMS, user/password system, etc. Right now I feel that given enough time I could program Facebook. But obviously it would be cumbersome procedural code that would be a nightmare to maintain. I don't know what the next step is. All the tutorial sites seem to just cover the basics. I want to learn how to write better code. What should I do? Quote Link to comment Share on other sites More sharing options...
Eric_Ryk Posted August 8, 2007 Share Posted August 8, 2007 What is your knowledge about the object oriented side of PHP? How about it's object overloading abilities? The security things that you need to know about to secure your applications? Quote Link to comment Share on other sites More sharing options...
avillanu Posted August 8, 2007 Author Share Posted August 8, 2007 Basically zero How would I go about learning this? The tutorial sites seem to just have the simple procedural stuff. Quote Link to comment Share on other sites More sharing options...
phpknight Posted August 8, 2007 Share Posted August 8, 2007 PHP5 advanced 2nd edition by Ullman is great. For OOP, there is a simple one by Lavin. If you already know OOP, skim it in the store. There are a few PHP specific pointers, but it is not worth reading the entire book. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted August 9, 2007 Share Posted August 9, 2007 Honestly, if you want to become a better programmer I would recommend ditching PHP for a short period of time. I recommend picking up a book on C. Spend some time learning the syntax and write a few simple CLI programs; the syntax is very similar to PHP so it shouldn't be terribly difficult. You want to really understand pointers and what's happening there though. Once you've written a few simple things, pick up a book on data structures and learn how to create simple things like linked lists, queues, hash tables, binary search trees, priority queues, etc. I would then recommend picking up either C++ or Java. I'd pick C++ over Java since you have to manage your own memory allocations, like you do in C. If you're motivated and spend a bit of time each day on this, you should be back to PHP within a couple of months. Other than buying a couple of books, you can get all the software you need for compiling your programs for free. You can become a decent PHP programmer without doing any of this of course, but using a couple of older languages will give you a new perspective on PHP when you return. 1) You will understand on a lower level how a computer works and certain concepts in PHP will just fall into place. 2) You will be able to appreciate everything PHP does for you! Quote Link to comment Share on other sites More sharing options...
Eric_Ryk Posted August 9, 2007 Share Posted August 9, 2007 Honestly, if you want to become a better programmer I would recommend ditching PHP for a short period of time. I recommend picking up a book on C. Spend some time learning the syntax and write a few simple CLI programs; the syntax is very similar to PHP so it shouldn't be terribly difficult. You want to really understand pointers and what's happening there though. Once you've written a few simple things, pick up a book on data structures and learn how to create simple things like linked lists, queues, hash tables, binary search trees, priority queues, etc. I would then recommend picking up either C++ or Java. I'd pick C++ over Java since you have to manage your own memory allocations, like you do in C. If you're motivated and spend a bit of time each day on this, you should be back to PHP within a couple of months. Other than buying a couple of books, you can get all the software you need for compiling your programs for free. You can become a decent PHP programmer without doing any of this of course, but using a couple of older languages will give you a new perspective on PHP when you return. 1) You will understand on a lower level how a computer works and certain concepts in PHP will just fall into place. 2) You will be able to appreciate everything PHP does for you! For someone who started PHP two weeks ago, I'd have to say that's a pretty bad path to go down. First off, you have no idea what this person is interested in learning or what they want to do with that knowledge. If all (s)he wants to do is learn web development, then getting into those other languages is not necessary at all. When most people ask what languages to learn, people generally tell them to go with what they like. This person has already found a language to learn, and here you are throwing other languages in their face saying "Learn these first." Perhaps learning those worked for you, but not everyone is the same. For learning about objects and things like that I really wouldn't recommend anything other than the PHP documentation, which can be found on php.net. They have incredibly good details on how to use objects and the like. Getting into placing those objects into organized code is another matter, but it generally takes each person a reasonable amount of time to work that out in their own head. Looking at the source of object oriented open source things is generally a good way to go here, but you don't want to get into anything too complex. A lot can be learned by simply reading code. Quote Link to comment Share on other sites More sharing options...
avillanu Posted August 9, 2007 Author Share Posted August 9, 2007 My web host has PHP4. I'd like to develop for PHP4, as it seems many web hosts are still using it... those books were written for PHP5, would I still be able to apply most of the concepts from the books to my PHP4 environment? The PHP/MySQL book I used was PHP5 but I could use 99% of it, just need to change the MySQL connection code and such. Quote Link to comment Share on other sites More sharing options...
roopurt18 Posted August 9, 2007 Share Posted August 9, 2007 First off, you have no idea what this person is interested in learning or what they want to do with that knowledge. If all (s)he wants to do is learn web development, then getting into those other languages is not necessary at all. That's right, the probability of using those other languages for web development is less than 1%. But I didn't say they should learn them to become a better PHP programmer, but instead to become a better programmer in general. C is a fairly low level language and C++ can be if you choose. A language like PHP hides a lot of the nitty gritty details; understanding some of those details will make you a better PHP programmer. For example, a PHP programmer can't figure out why their script is performing poorly. They've narrowed it down to a portion of the script that is doing repeated string concatenation. Someone who has used a more low level language will tell you the reason is probably because of repeated memory allocation / deallocation on a large chunk of memory. Perhaps learning those worked for you, but not everyone is the same. To be a better programmer, you really have to understand some concepts at the hardware level. You will not learn those concepts dealing with a "high-level" language like PHP. Anyways, what I made was a recommendation to become a better programmer overall. If this person wants to work with PHP only, I'd second your recommendation on reading the manual in terms of objects. Of course, you can't really appreciate the concept of objects until you create them in a language that doesn't support them, such as C. Quote Link to comment Share on other sites More sharing options...
redbullmarky Posted August 9, 2007 Share Posted August 9, 2007 i'm 199% with roopurt18 on this one. having a grasp on the general concepts of programming languages is a fine way to teach people how to think for themselves and truly understand what they're doing in a particular language. my own background includes BASIC, Cobol, Pascal, C and C++ LONG before PHP - all of which are similar in many ways but the principles of which are almost identical. Whilst PHP has still been a learning curve for me, it's been relatively easy - "Knowing" PHP is just a memory game to remember all the functions, etc you need. "Understanding" PHP is something that doesnt necessarily require PHP to pick up. And as PHP is written in C and includes many of the same/similar functions, C is a great one to try and understand to get a true understanding of how things REALLY work. Distancing yourself from one particular language but otherwise fully grasping the concepts is a good thing. Quote Link to comment Share on other sites More sharing options...
Eric_Ryk Posted August 9, 2007 Share Posted August 9, 2007 That's right, the probability of using those other languages for web development is less than 1%. But I didn't say they should learn them to become a better PHP programmer, but instead to become a better programmer in general. C is a fairly low level language and C++ can be if you choose. A language like PHP hides a lot of the nitty gritty details; understanding some of those details will make you a better PHP programmer. For example, a PHP programmer can't figure out why their script is performing poorly. They've narrowed it down to a portion of the script that is doing repeated string concatenation. Someone who has used a more low level language will tell you the reason is probably because of repeated memory allocation / deallocation on a large chunk of memory. To be a better programmer, you really have to understand some concepts at the hardware level. You will not learn those concepts dealing with a "high-level" language like PHP. Anyways, what I made was a recommendation to become a better programmer overall. If this person wants to work with PHP only, I'd second your recommendation on reading the manual in terms of objects. Of course, you can't really appreciate the concept of objects until you create them in a language that doesn't support them, such as C. Right, but most people can still program just fine without understanding those details. Personally, I got "good" in PHP before moving on to learn other languages. With the knowledge from C++ and Java, I learned some, but overall not too much. Albeit, I still haven't even gotten close to what I would consider "good" in either of those languages, but I still understand the concepts involved in the memory usage, and as you mentioned, the data structures. If you haven't had a before and after to compare, can you really see the difference? I did, but I didn't see too much of a difference. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.