Should This Newbie Learn From Dreamweaver?

This is a discussion on Should This Newbie Learn From Dreamweaver? within the PHP General forums, part of the PHP Programming Forums category; First of all - I know this is an entirely subjective question, and I know there's no single approach to ...


Go Back   Usenet Forums > PHP Programming Forums > PHP General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-23-2008
revDAVE
 
Posts: n/a
Default Should This Newbie Learn From Dreamweaver?

First of all - I know this is an entirely subjective question, and I know
there's no single approach to learning this technology. I'm just looking for
a few hints from seasoned professionals basically whether Dreamweaver
verbose code (at least it looks like that to me at this beginning point) is
all 'needed & necessary'...

I have a background using ColdFusion, however I am new to php / mySQL.

I am caught between two learning approaches:

1 - I know that generally, it is better to build my knowledge from the
'bottom up' - coding by hand from books and such etc. - and so far I have
been doing that with php and mySQL. Slowly I am getting there. Php is quite
powerful and impressive.

2 - Dreamweaver cs3 is pretty cool. Creating recordsets - dynamic data -
updating records etc. is pretty seductive it seems to work well.

A few questions:

One of my issues is that the Dreamweaver code that gets created seems quite
verbose and somewhat complex (like using switch & case in a simple query
listed below...), therefore even harder for this newbie to try to learn
from. My question is this: Is this Dreamweaver code actually all
modern/necessary (vs a 'simple approach') - or is it way over the top?

Without getting too detailed:

- If in fact you folks say that most of the DW approach (for those that have
seen it) is 'necessary' & 'the right way to do things' - then I will be
happy to use it and try to figure out some of its complexities . But, if you
think that DW is over the the top ('...I don't use all that suff - I do a
query in just a few lines!') ... then I'll just start with the 'bottom up -
code by hand - do it yourself simple approach'.

BTW: if anyone wants to see more DW code - email me off-list - I'll be happy
to send more examples... (I don't want to clog up this cool list)

BTW: I also tried a happy medium - simplifying the DW code - however that
will break its usefulness in DW - and other DW interface items stop working,
so I guess that's not an option right now.

Interested in your thoughts... Dave

------------------------

Example get recordset query w DW:


<?php require_once('../Connections/weblink.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
$theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ?
mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" :
"NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue :
$theNotDefinedValue;
break;
}
return $theValue;
}
}

$colname_get_Recordset1 = "-1";
if (isset($_SESSION['mem_id'])) {
$colname_get_Recordset1 = $_SESSION['mem_id'];
}
mysql_select_db($database_weblink, $weblink);
$query_get_Recordset1 = sprintf("SELECT * FROM tbl_test WHERE mem_id = %s
ORDER BY mem_id ASC", GetSQLValueString($colname_get_Recordset1, "int"));
$get_Recordset1 = mysql_query($query_get_Recordset1, $weblink) or
die(mysql_error());
$row_get_Recordset1 = mysql_fetch_assoc($get_Recordset1);
$totalRows_get_Recordset1 = mysql_num_rows($get_Recordset1);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>Untitled Document</title>
</head>

<body>
</body>Remember
</html>
<?php
mysql_free_result($get_Recordset1);
?>


--
Thanks - RevDave
Cool @ hosting4days . com
[db-lists]



Reply With Quote
  #2 (permalink)  
Old 04-23-2008
Ray Hauge
 
Posts: n/a
Default Re: [PHP] Should This Newbie Learn From Dreamweaver?

revDAVE wrote:
> First of all - I know this is an entirely subjective question, and I know
> there's no single approach to learning this technology. I'm just looking for
> a few hints from seasoned professionals basically whether Dreamweaver
> verbose code (at least it looks like that to me at this beginning point) is
> all 'needed & necessary'...
>


Like you said it's all subjective, but my opinion is to learn the basics
first, then you can rely on your tools to take the mundane work out of
the way for you. I'd still suggest using an editor with code completion
though, because it will help you when you're trying to remember
parameter orders or even function names to a point.

After you feel comfortable with that, then you'll be able to understand
what the program is doing for you and it won't be a "black box" that
really is unsupportable. I find the best way to do that is to come up
with some little program that you code up for fun to help get you
through the learning stages. You'll learn more figuring out how to get
something to work than just copying and pasting code.

That's my 2 cents. Hope that helps.

--
Ray Hauge
www.primateapplications.com
Reply With Quote
  #3 (permalink)  
Old 04-23-2008
Jason Pruim
 
Posts: n/a
Default Re: [PHP] Should This Newbie Learn From Dreamweaver?


On Apr 22, 2008, at 9:04 PM, revDAVE wrote:

> First of all - I know this is an entirely subjective question, and I
> know
> there's no single approach to learning this technology. I'm just
> looking for
> a few hints from seasoned professionals basically whether Dreamweaver
> verbose code (at least it looks like that to me at this beginning
> point) is
> all 'needed & necessary'...
>
> I have a background using ColdFusion, however I am new to php / mySQL.
>
> I am caught between two learning approaches:
>
> 1 - I know that generally, it is better to build my knowledge from
> the
> 'bottom up' - coding by hand from books and such etc. - and so far I
> have
> been doing that with php and mySQL. Slowly I am getting there. Php
> is quite
> powerful and impressive.


When I first started learning PHP/MySQL just about a year ago, I
started using dreamweaver 8, just for the code completion/syntax
highlighting though... I wanted to be able to visually see where I
missed a ' or a " type of thing.

One of the best ways I've found to learn everything though is to take
a simple script that is close to what you want, and change it to fit
your needs... You can learn alot about how other people code... Which
always helped me.

Or do what tedd does.. Build an example of everything that gets asked
on the list... See if you can figure it out, once you understand how
to do it, fixing and extending it is much easier.
>


And in regards to the code you posted... That did seem a little
verbose.. It probably works great being so specific and all... But my
simple queries tend to work good most of the time as well :)


Reply With Quote
  #4 (permalink)  
Old 04-23-2008
Larry Garfield
 
Posts: n/a
Default Re: [PHP] Should This Newbie Learn From Dreamweaver?

Welcome to PHP! Please have exact change.

As a general rule, I distrust generated code in PHP, or in HTML. I virtually
never use Dreamweaver (or its evil twin, FronPage), as the code it generates
is rarely what I want at the quality level I want. Such code is designed for
the cut-and-paster. Such code is how we ended up with the same MM_
Javascript functions that everyone used for a decade because DW would
autogenerate them for you, despite their not being that good and generating
lousy code that is difficult to maintain because the people "writing
Javascript" didn't actually have the slightest clue what they're doing.

You will get far better code by either writing it by hand yourself or using an
existing library that someone else with more experience than you wrote by
hand. You will also learn more in the process. (That could be a code
library or a framework, to nod to the other thread raging right now, but in
either case it's written by a human.)

Now, you can certainly study assisted code to see what it's doing and figure
out why, but remember that it's generated by a simple, dumb algorithm so it
is designed not for speed, readability, or quality, but safety against
cut-and-paste spoon-coding. Never use it in actual production.

On Tuesday 22 April 2008, revDAVE wrote:
> First of all - I know this is an entirely subjective question, and I know
> there's no single approach to learning this technology. I'm just looking
> for a few hints from seasoned professionals basically whether Dreamweaver
> verbose code (at least it looks like that to me at this beginning point) is
> all 'needed & necessary'...
>
> I have a background using ColdFusion, however I am new to php / mySQL.
>
> I am caught between two learning approaches:
>
> 1 - I know that generally, it is better to build my knowledge from the
> 'bottom up' - coding by hand from books and such etc. - and so far I have
> been doing that with php and mySQL. Slowly I am getting there. Php is quite
> powerful and impressive.
>
> 2 - Dreamweaver cs3 is pretty cool. Creating recordsets - dynamic data -
> updating records etc. is pretty seductive it seems to work well.
>
> A few questions:
>
> One of my issues is that the Dreamweaver code that gets created seems quite
> verbose and somewhat complex (like using switch & case in a simple query
> listed below...), therefore even harder for this newbie to try to learn
> from. My question is this: Is this Dreamweaver code actually all
> modern/necessary (vs a 'simple approach') - or is it way over the top?
>
> Without getting too detailed:
>
> - If in fact you folks say that most of the DW approach (for those that
> have seen it) is 'necessary' & 'the right way to do things' - then I will
> be happy to use it and try to figure out some of its complexities . But, if
> you think that DW is over the the top ('...I don't use all that suff - I do
> a query in just a few lines!') ... then I'll just start with the 'bottom up
> - code by hand - do it yourself simple approach'.
>
> BTW: if anyone wants to see more DW code - email me off-list - I'll be
> happy to send more examples... (I don't want to clog up this cool list)
>
> BTW: I also tried a happy medium - simplifying the DW code - however that
> will break its usefulness in DW - and other DW interface items stop
> working, so I guess that's not an option right now.
>
> Interested in your thoughts... Dave
>
> ------------------------
>
> Example get recordset query w DW:
>
>
> <?php require_once('../Connections/weblink.php'); ?>
> <?php
> if (!function_exists("GetSQLValueString")) {
> function GetSQLValueString($theValue, $theType, $theDefinedValue = "",
> $theNotDefinedValue = "")
> {
> $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
>
> $theValue = function_exists("mysql_real_escape_string") ?
> mysql_real_escape_string($theValue) : mysql_escape_string($theValue);
>
> switch ($theType) {
> case "text":
> $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
> break;
> case "long":
> case "int":
> $theValue = ($theValue != "") ? intval($theValue) : "NULL";
> break;
> case "double":
> $theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" :
> "NULL";
> break;
> case "date":
> $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
> break;
> case "defined":
> $theValue = ($theValue != "") ? $theDefinedValue :
> $theNotDefinedValue;
> break;
> }
> return $theValue;
> }
> }
>
> $colname_get_Recordset1 = "-1";
> if (isset($_SESSION['mem_id'])) {
> $colname_get_Recordset1 = $_SESSION['mem_id'];
> }
> mysql_select_db($database_weblink, $weblink);
> $query_get_Recordset1 = sprintf("SELECT * FROM tbl_test WHERE mem_id = %s
> ORDER BY mem_id ASC", GetSQLValueString($colname_get_Recordset1, "int"));
> $get_Recordset1 = mysql_query($query_get_Recordset1, $weblink) or
> die(mysql_error());
> $row_get_Recordset1 = mysql_fetch_assoc($get_Recordset1);
> $totalRows_get_Recordset1 = mysql_num_rows($get_Recordset1);
> ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
> <html xmlns="http://www.w3.org/1999/xhtml">
> <head>
> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
> <title>Untitled Document</title>
> </head>
>
> <body>
> </body>Remember
> </html>
> <?php
> mysql_free_result($get_Recordset1);
> ?>
>
>
> --
> Thanks - RevDave
> Cool @ hosting4days . com
> [db-lists]



--
Larry Garfield AIM: LOLG42
larry@garfieldtech.com ICQ: 6817012

"If nature has made any one thing less susceptible than all others of
exclusive property, it is the action of the thinking power called an idea,
which an individual may exclusively possess as long as he keeps it to
himself; but the moment it is divulged, it forces itself into the possession
of every one, and the receiver cannot dispossess himself of it." -- Thomas
Jefferson
Reply With Quote
  #5 (permalink)  
Old 04-23-2008
Kenoli
 
Posts: n/a
Default Re: Should This Newbie Learn From Dreamweaver?

I'm a relatively new coder, having worked off and on on my own
projects for 3 years or so. I've tried to use various frameworks and
even IDEs and each time felt like it required learning a second
language and went back to coding directly. I even recently wrote a
templating system because Smarty and other templating systems I looked
at seemed too complicate to learn. I do use Dreamweaver as a text
editor, not to generate php code, but rather because it helps me crank
out the html/css parts of the code much faster than doing it all by
hand.

On the other hand, I have learned a lot by looking at how some of
these frameworks did things, from specific functions to program
structure.

What I find it hard to find is good information on good programming
style and structure. There are always lots of ways to do things and I
often find myself re-doing code when I find that it results in
problems down the line. I'd like to find a place that has good
information on this part of the process so I went down less of these
blind alleys.

--Kenoli
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 10:09 PM.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0