Bluehost.com Web Hosting $6.95

class montly calendar - review code

This is a discussion on class montly calendar - review code within the PHP Language forums, part of the PHP Programming Forums category; I'm studying for webdeveloper. The trainer only comments when it doesn't work, but I am also interested in ...


Go Back   Usenet Forums > PHP Programming Forums > PHP Language

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 10-25-2006
JM
 
Posts: n/a
Default class montly calendar - review code

I'm studying for webdeveloper. The trainer only comments when it doesn't
work, but I am also interested in comments on programs or pieces of code
that work : can it work better, faster, shorter, ...
I made an object to show a monthly calendar using PHP, OOP and DOM (and
MySQL). If possible I would like some more experienced programmers to
review/comment my code (logic, design, code, names, ...). I hope to
learn from it.
For more information, an example and to download the code :
http://www.johan-mares.be/webdevelop...?htt=6&lang=en

Thanx,

Johan
Reply With Quote
  #2 (permalink)  
Old 10-25-2006
Steve
 
Posts: n/a
Default Re: class montly calendar - review code


"JM" <reply@group.svp> wrote in message
news:p7qdnVHXdvDcEKLYRVnyjw@scarlet.biz...
| I'm studying for webdeveloper. The trainer only comments when it doesn't
| work, but I am also interested in comments on programs or pieces of code
| that work : can it work better, faster, shorter, ...
| I made an object to show a monthly calendar using PHP, OOP and DOM (and
| MySQL). If possible I would like some more experienced programmers to
| review/comment my code (logic, design, code, names, ...). I hope to
| learn from it.
| For more information, an example and to download the code :
| http://www.johan-mares.be/webdevelop...?htt=6&lang=en

it's pretty basic. i'd like to be able to pull up event details in another
window, OR, have a "back" button on the day's detail so i can see the
calendar for the month again.

as for your code. i applaud your use of comments but i'd MUCH rather see
well formatted code! ex.,

private $mMonths = array("januari", "februari", "maart", "april", "mei",
"juni", "juli", "augustus", "september", "oktober", "november",
"december");

private $mMonths = array(
'januari' ,
'februari' ,
'maart' ,
'april' ,
'mei' ,
'juni' ,
'juli' ,
'augustus' ,
'september' ,
'oktober' ,
'november' ,
'december'
);

which is easier to read? i put all my code in block form. code is easier to
read in blocks rather than like reading a book from left to right. i also
try to align variables with values:

$foo = 'bar';
$thisMonth = 'oktober';
$yesterday = 'tuesday';

also note that i use a tic (') instead of quotes (") in most places as
quotes are parsed by php. no need for such parsing in the above.

i saw your experience is in .Net. php doesn't use "m" for "modular" as in
$mMonth...php best practices are using an underscore: $_month. all $_
variables are assumed to be within the scope of the object only.

do not arbitrarily wrap function parameters among multiple lines. either
make all paratemeters of a function on one line, or each on its own line:

someFunction($paramA, $paramB, $paramC);

or

someFunction(
$paramA ,
$paramB ,
$paramC
);

i saw some other things going on in your code, but these are my main
pet-peaves. my biggest is the formatting of in-line sql...your's is
passable. ;^)

hth,

me


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

BB 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 12:29 PM.


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