PHP

Page 2 - Seeking answers? Join the AnandTech community: where nearly half-a-million members share solutions and discuss the latest tech.

Markbnj

Elite Member <br>Moderator Emeritus
Moderator
Sep 16, 2005
15,682
14
81
www.markbetz.net
Originally posted by: GodlessAstronomer
Originally posted by: drebo
You will learn best practices as far as function naming, indentation, etc, as well as many things that are not necessarily used in other languages but are very important to an understanding of programming: pointers, data types, etc.

I have a quick question. I have seen this word "pointers" thrown around a bit and I'm curious. From what I can tell these are the same as object reference variables in Java, no?

Yes and no :). Pointers are a more fundamental concept from an earlier time. The simple definition of a pointer is that it is a variable containing the address at which data is stored. So if I put a character array at address x in my memory space, and create a pointer to char which is initialized with the address of the array, that pointer's value will be x. Pointers are scalar types that can appear on either side of an operator, whose value can be taken and manipulated arithmetically. So adding "1" to a pointer should increment it's address by 1 * the size of whatever thing lives at that address.

Pointers are somewhat more primitive in definition and operation than object references.
 

Aikouka

Lifer
Nov 27, 2001
30,383
912
126
Originally posted by: drebo
The concepts of public objects, static variables, and functions that do not return a value are most certainly concepts that exist in every single language, from Visual Basic, to ColdFusion, to PHP, to C++, and Java. They are concepts that MUST be mastered for a full understanding of programming. If you don't know the difference between an instance variable and a static variable, you're screwed.

I still don't think you're looking at this properly. If I'm teaching an introductory course to computer science and I'm merely having them create a simple program, I am not going to start delving into the aspects of object oriented hierarchy or whatever else simply because they see "public partial class Form1 : Form" (C#) at the top of their code! It isn't necessary to learn these things immediately, but nowhere have I said that they shouldn't learn these things.

In other words, just because something exists in a language and is shown does not mean it needs to be taught immediately. It may be taught in the same course, just later on when "the time is right."

You should show me a public object in pure LISP (i.e. no CLOS).
 

drebo

Diamond Member
Feb 24, 2006
7,034
1
81
That's why you don't start a beginning programming class off with object-oriented GUI programming.

I removed this from my previous post because I thought it was too mean, but now I see that it applies more than I'd previously thought:

I would hope that anyone reading this would take with a grain of salt anything said by anyone who would refer to database programming as "combining" a programming language with SQL.

Enough said. There's a right way and a wrong way to go about things, and introducing students to something they cannot understand, or you cannot teach, right off the bat is the wrong way to teach programming.
 

Aikouka

Lifer
Nov 27, 2001
30,383
912
126
I think you need to seriously step away from the keyboard and go outside for a couple hours to relax.

Originally posted by: drebo
I removed this from my previous post because I thought it was too mean, but now I see that it applies more than I'd previously thought:

I would hope that anyone reading this would take with a grain of salt anything said by anyone who would refer to database programming as "combining" a programming language with SQL.

I assume this is directed at myself.... I didn't say that I prefer combining PHP and MySQL as "database programming." In fact, the exact line was:

Although, I typically combine PHP with a SQL (MySQL).

I mentioned this, because in most websites I design, I'm able to create quite content-rich setups than I could with simply just PHP. Even with some small, simple sites that I've written, I've been able to empower them quite a bit by simply throwing my data into a table and referencing it via various queries. That was my point there.

It's also good to note that combining the two also requires a different way of thinking than just simply having a website. You've also got to keep in mind your data's organization and how it will work... how your site may possibly expand and if your data supports expansion, etc.

Originally posted by: drebo
That's why you don't start a beginning programming class off with object-oriented GUI programming.

I don't see any issues with teaching an introductory course in C#. You don't necessarily need to teach them via windows-based application programming, but you could develop console apps instead ( this referring to using Visual Studio obviously ). But I don't think there's any fault in showing event-driven apps, but focusing on them for awhile would be silly. I know we had one chapter in my introductory course where we used Java's Swing library to create some simple GUI apps.

Originally posted by: drebo
Enough said. There's a right way and a wrong way to go about things, and introducing students to something they cannot understand, or you cannot teach, right off the bat is the wrong way to teach programming.

So you're actually agreeing with me now? I don't know, I'm getting really confused as to where you lie.
 

ChristianV

Member
Feb 5, 2007
65
0
0
I would suggest to start with either C or Pascal as they are both quite strict, basic and yet powerful. After that you can move on to the OO orientated version of either of it. (C++ / Delphi Language(Object Pascal) and learn the concepts.

That's because if you just start explaining what the declaration is, you're going to lose people when you start using strange words like classes and all these things that they have no idea what they are. Then you try to explain those and you just end up getting ahead of yourself. The idea is to ignore those for the time being and when you start getting some background on it, you can then discuss the parts that've been lying around for awhile.
Well, if somebody wants to learn to program oneself, he or she should be able to get through that...

PHP is really easy to learn and even easier if you already know an other language. The syntax is similar to that of C(++).

As for the pointers: Java does support "pointers", but in a different way than C. You can have a reference to an object, but you cannot manipulate it. Meaning: you cannot manipulate the address(a pointer is basically a variable that contains an address) itself as you can in C and other languages. This is has advantages and disadvantages as well: for one thing: security is increased but also you are often forced to use less elegant ways to solve problems, error rate is also decreased. I for one like pointers a lot :D

If you really want to get a deep understanding of how it(programs) actually "works", I recommend you to go through the basics of Assembly, but don't do that too soon ;)
It really improved my understanding of programs and I now see my code quite differently than I did before, also get to know how to optimize your code better if you know what the compiler does with your code.
 

dinkumthinkum

Senior member
Jul 3, 2008
203
0
0
Originally posted by: drebo
The concepts of public objects, static variables, and functions that do not return a value are most certainly concepts that exist in every single language, from Visual Basic, to ColdFusion, to PHP, to C++, and Java. They are concepts that MUST be mastered for a full understanding of programming. If you don't know the difference between an instance variable and a static variable, you're screwed.

What an amazingly provincial outlook towards programming languages. If your "range" of languages extends from only PHP to Java to C++, you might want to consider broadening your horizons a bit.

I can think of languages, including object-oriented ones, lacking the concept of "public", "static", or even "void" functions. Python, Javascript, Smalltalk, Common Lisp, Self, OCaml, Haskell, Erlang, among many others, come to mind.

I would liken your response to someone who says that "Chlorophyll exists in every single organism on Earth, from deciduous trees to coniferous trees" ignoring the wide variety of non-tree and non-plant life.
 

LuckyTaxi

Diamond Member
Dec 24, 2000
6,044
23
81
Come on guys, he said he's comfortable with HTML/CSS so I'm assuming he wants to develop for the web. Why are people telling him C++? I understand it's a fairly easy language to learn compare to Java but I would vote for PHP. I started with NO php skills whatsoever a few years ago and now I'm developing apps for ecommerce companies and web 2.0 companies.

I started with a basic php/mysql book. I can't think of the name but the authors' name are Luke Welling and Laura Thomson. I just picked up an advanced php5 book by Larry Ullman and it's great. I think there's a basic book for PHP/mysql that he also published. I couldn't pick up java, but thats not to say it's a hard language to learn. I'm happy with php and now I'm moving on to django/python