View Single Post
Old Nov 3rd, 2004, 8:21 AM   #4
scorpiosage
Programmer
 
scorpiosage's Avatar
 
Join Date: Aug 2004
Location: Austin, Tx
Posts: 55
Rep Power: 5 scorpiosage is on a distinguished road
Send a message via AIM to scorpiosage Send a message via Yahoo to scorpiosage
Having html and css background is good work. That's where I started, and then since then got a little inot C programming and vb programming (ok, I am not the best at those, but, know enough to do a few nifty tricks.).

As most of my focus has been in web development though, before I got into c and vb, I got onto Javascript.

The basics of javascript itself has tought me a lot about programming, and how scripts are formed.

Each language of course has it's own way of going about things, and it is in a way the same as English or any other language.

Before I sit down to actually create a script I first figure out what exactly I want it to do.

You can actually sit down and write it in story form wich will help you, for instance

when the dog barks the neighbors wake up. When the dog doesn't bark, the neighbors do not wake up.

In programming this sentence is usually stated differently though. It would read,

If the dog barks the neighbors wake up, otherwise, the neighbors do not wake up.

The problem is, that you actually have to define some of these words. In the english language everything has a deffinition. In programming, there are only some words that are defined, and the rest you have to actually define before you use them in your sentance.

For my explination here, what we need to define is the dog barking and the neighbors waking up, as well as the neighbors not waking up.

let us assume that we are getting the information from a form on a previous page, wich uses the post method (from an html form).

So would be the script.

<? 
$dog = $_POST['action'];

if ($dog =="bark")
print("the nieghbors wake up");
else
print9"the nieghbors do not wake up");
?>

Up until now this is a bit pointless, all that it does is print something based on wether or not the previous form posted "bark", but, this is the basic idea. Now you can do a bunch of different things based on the given information.
you can define the database connection and path, and insert weather or not the neighbor is barking into a database, so on and so forth.

I prefer to think of things in terms of nouns and verbs. For every action there must be something doing that action and all parts, if not defined under php's "dictionary" must be defined by using only words that are in php's dictionary.

In the previous example, we defined dog, by saying
$dog = $_POST['action'];

This assumes that the name attribute of the form field on the previous page was "action".

Now, if we had to create another deffinition for something, we can actually use the php dictionary and our own dictionary to define it. Anywhere were you would have to call the result of the form field "action" all you have to do is put $dog and you are good to go.

I hope that this served to help your logical side, because I truely am the same way. If things don't make sense, or I can't translate them into logic english then they just don't go anywhere for me iether.
Mike
__________________
Here's my latest project still in the works, and I need to get rid of this &quot;frame&quot; situation for real. www.prideofaustin.com
scorpiosage is offline   Reply With Quote