Jump to content
Larry Ullman's Book Forums

Programming Questions


Recommended Posts

I've been reading this book and got to Chapter Six and ran into some difficulties. I felt that I had gone through the book too quickly so I've started again and am being much more thorough in both reading and playing around with the code this time round.

 

Being completely new to any form of programming I'm having some difficulty understanding some of the basic concepts in chapter one. For example I don't understand what the following really mean;

 

  1. Statement
  2. Executable
  3. Compiled language
  4. Interpreted language
  5. Attributes
  6. Function
  7. Argument (not sure if that's from Ch 1)
  8. Function
  9. Language construct

 

I know that these terms are explained in the book and I've spent some time looking them up in Wikipedia. However, I still feel that I don't fully understand them.

 

Could you by any chance recommend some basic programming resource / tutorial that would explain these?

 

Thanks!

Link to comment
Share on other sites

I shall try to help you, but you must appreciate I don't have the book and therefore can't see the context it's written in.

 

1. Statement - typically a statement is used in conjunction with an "if" hence an "if statement"

 

example

if( 1 == 1)

 

The (1 == 1) is a statement that you are checking is correct or not.

 

2. Executable - executable means to be able to execute or run something. Often you will hear someone say a file is executable. However what context this was used in i'm not sure.

 

3 & 4. Refers to how a language is run, PHP is an interpreted language and is ran by an interpreter program compiled languages, I would struggle to explain compliers.

 

5. Attributes depends what context this is written in, do you have an example?

 

6. Function - a function is a series of code that does a certain job. Often you'll find that a function is often reused.

function myFunction () {
    echo 'This is out put from the function';
}

 

 

Then you can call this function from your executed script like so: (as you should really separate logic(functions etc) from your code

<?php

require ('../folderforfunctions/functions.php');

myFunction();

// would echo out "This is output from the function"

 

7. Argument - Arguments are passed to functions. For instance

 


function myFunction ($name) {
    echo "My name is $name";
}

require ('../folderforfunctions/functions.php');

$name = 'Jonathon';

myFunction($name);

// would echo "My name is Jonathon"

 

PHP has it's own built functions too

 

9. Language constructs are often mistakenly referred to as functions that are built into php. Things like stripos() is a PHP function, things like array() and echo() are language constructs. I wouldn't really worry about the technicality around them. But they operate slightly differently, and you would use them in different ways, take for example these language constructs require, require_once, empty,echo,array,unset,include,isset. You might not know what they all do yet, but you'll see that they differ from functions as you go through the book i'm sure.

 

Hope that helps, I wouldnt worry about your list of items you don't understand, you'll get to grips with that as you have more experience with the language. :)

  • Upvote 1
Link to comment
Share on other sites

To cover several of your questions in one explanation, the act of compiling a program means taking the code you have written, and turning that into a set of instructions that computers can understand (but for the most part, people cannot).

 

While it may not be obvious, just about any program you run on your computer, including Word, your Internet browser, etc. are executable files (and generally have the file extension .exe). These executable files are the result of code being compiled, and are a collection of machine-parsable instructions. Compiled programs (generally called executable files or just executables) can run quickly, because the code written by humans has already been compiled into a set of instructions readily understandable by the computer.

 

Along that vein, a compiled language is a computer language whose code must be compiled to run/test it. On the other hand, an interpreted language is one that remains in code form (as written by humans) and is compiled on the spot, when it is run. Interpreted languages are generally slower than compiled languages (since they have to first be compiled on the spot before they can be run), but there are some added advantages to interpreted languages (which I'll skip over here).

 

Edit: To answer another one of your questions, I thought the answer to the following question has pretty darn good:

 

http://stackoverflow.com/questions/1180184/what-is-the-difference-between-a-language-construct-and-a-built-in-function-in

  • Upvote 1
Link to comment
Share on other sites

Thanks very much for your replies Jonathon and Hartley, the detailed info you provided clarifies a lot of the issues for me. I will keep going through the book and the terms should become much more understandable to me as I see them used more often.

 

Jonathon you should ask Larry for a copy of the book in return for the very helpful advice that you give to members here :)

Link to comment
Share on other sites

Thanks Fergal :), to respond to your statement, no, I do not have the book. I won a copy of it though when it was released, but I thought the competition was for Larry's 4th edition of PHP and MySQL, so Larry kindly let me exchange my copy of the book for the new PHP and MySQL book when it comes out - Thanks Larry! :)

Link to comment
Share on other sites

 Share

×
×
  • Create New...