Wonderful code
Moderator: General Moderators
- Chris Corbyn
- Breakbeat Nuttzer
- Posts: 13098
- Joined: Wed Mar 24, 2004 7:57 am
- Location: Melbourne, Australia
I write a test case, write an empty skeleton of the class/method, then make the test pass by writing code. Now where have I seen people do that before?
Seriously though, test driven development just results in the cleanest and most flexible interfaces you can imagine.
I'd really like to give pair programming a chance too but the team at my workplace is too small to convince my boss it's a good idea. Maybe when I get to SitePoint... they're an agile bunch
Seriously though, test driven development just results in the cleanest and most flexible interfaces you can imagine.
I'd really like to give pair programming a chance too but the team at my workplace is too small to convince my boss it's a good idea. Maybe when I get to SitePoint... they're an agile bunch
I bought an arcade game script, *wont say from where*, and the php/html pages it came with were horrendous. I ended up just coding my own pages.
Set Search Time - A google chrome extension. When you search only results from the past year (or set time period) are displayed. Helps tremendously when using new technologies to avoid outdated results.
Well I learned that this works today..
Code: Select all
if (false)
{
echo 'yo what\'s up';
}{
echo 'this actually works?';
}- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
Oh astions, you are such a liar!!
I looked at that code just now and realized what's happening. This is perfectly valid code:
See what's happening?
Just like in C++, you can create blocks of code with no meaning simply for organizational purposes. That doesn't create an else, it just doesn't meet the if-statement condition. It'd print the second part regardless of the condition being true or false.
I looked at that code just now and realized what's happening. This is perfectly valid code:
Code: Select all
echo $foo;
{
echo $bar;
}Just like in C++, you can create blocks of code with no meaning simply for organizational purposes. That doesn't create an else, it just doesn't meet the if-statement condition. It'd print the second part regardless of the condition being true or false.
- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
-
Charles256
- DevNet Resident
- Posts: 1375
- Joined: Fri Sep 16, 2005 9:06 pm
It was something like..
Code: Select all
if ($thisvariable > $thatvariable && $somethingelse < $anothersomethingelse) { $ErrAry[$i]['index'] = "Really long error message"; $Errcnt++;}
{
// tons of code here..
}- superdezign
- DevNet Master
- Posts: 4135
- Joined: Sat Jan 20, 2007 11:06 pm
- RobertGonzalez
- Site Administrator
- Posts: 14293
- Joined: Tue Sep 09, 2003 6:04 pm
- Location: Fremont, CA, USA
-
alex.barylski
- DevNet Evangelist
- Posts: 6267
- Joined: Tue Dec 21, 2004 5:00 pm
- Location: Winnipeg
I hate:
1) Functions longer than 80-100 lines
2) Classes with more than half a dozen (or dozen at most) functions
3) Stupid comments like (Initialize variable)
4) Non-existant conventions (MyClass mized with My_Class)
5) Complicated code
6) Inconsistent file naming conventions (Smarty.php, mysmarty.class.php, etc)
7) HTML mixed with PHP - excluding template specific logic
JavaScript mashed with PHP or AJAX hell
9) Cross frame scripting
10) Monolithic applications, poor separation of concerns, etc
11) Poor file structures
Although I usually get at least one thing (an 'oh good idea' moment) on every peice of code I work on, so I guess it's not a total loss.
1) Functions longer than 80-100 lines
2) Classes with more than half a dozen (or dozen at most) functions
3) Stupid comments like (Initialize variable)
4) Non-existant conventions (MyClass mized with My_Class)
5) Complicated code
6) Inconsistent file naming conventions (Smarty.php, mysmarty.class.php, etc)
7) HTML mixed with PHP - excluding template specific logic
9) Cross frame scripting
10) Monolithic applications, poor separation of concerns, etc
11) Poor file structures
Although I usually get at least one thing (an 'oh good idea' moment) on every peice of code I work on, so I guess it's not a total loss.