Page 1 of 1

Man it feels good to be able to shorten code

Posted: Mon Nov 17, 2003 4:15 am
by infolock
well, it's about 5am eastern time here right now, but it was well worth it. I just shortened one of my 420 line scripts down to 205 lines :D might not be a lot to some of the guru's, but to me, i'm feeling like it's nuddy bar time.

Posted: Mon Nov 17, 2003 5:02 am
by Nay
I can make any script to just one line.

You know how?

Code: Select all

<?php include("that_script.php"); ?>
mwhahahha, beat you! :lol:

-Nay

Posted: Mon Nov 17, 2003 5:18 am
by infolock
well, i can do one with a few less chars :

Code: Select all

<? include'that_script.php'; ?>
now, i j0r master. lol, seriously though, i just found [php_man]array_search[/php_man] a few minutes ago. take another 20 lines off my code :D

i'm getting tired though 8O

Posted: Mon Nov 17, 2003 5:48 am
by twigletmac
Modularising and shortening code is very gratifying. I try and go through my own code regularily to see where I can put repeated tasks into functions and get rid of uneccassary re-inventions of the wheel. Currently I'm doing the same on another developers code, which is always interesting, I'm adding lots of comments like I would do for someone in the forums so they can get it a bit more efficient and meet the team standards.

Mac

Posted: Mon Nov 17, 2003 6:42 am
by Nay
ooo, is that a free service provided by the FastestTyper (C) Mac? :D

-Nay

Posted: Mon Nov 17, 2003 8:28 am
by twigletmac
Nay wrote:ooo, is that a free service provided by the FastestTyper (C) Mac? :D

-Nay
Nah, I actually get paid to do that at work... (although I've done it a lot here for free :))

Mac

Posted: Tue Nov 18, 2003 5:18 pm
by qads
twigletmac wrote:although I've done it a lot here for free :)
great, where can i send you 20MBs worth of code then? :lol:

Posted: Wed Nov 19, 2003 2:48 am
by Nay
qads wrote:great, where can i send you 20MBs worth of code then? :lol:
only? :wink:

-Nay

Posted: Wed Nov 19, 2003 2:09 pm
by qads
most of it is from my noob days..yes i still have it! lol..now those were the days

/me have a flash back

Posted: Thu Nov 20, 2003 9:08 am
by jason
You guys are talking about [google]Refactoring[/google].

A good book on this topic from Martin Fowler can be found here:

http://www.amazon.com/exec/obidos/tg/de ... 201485672/

Posted: Thu Nov 20, 2003 10:33 am
by Nay
ooo...........jason with the correct terms :lol:....

oh yea, one thing. is it just me or at geekcomplete.com, the XML feed link is http://phpcomplete.com/newsfeed.php instead of http://geekcomplete.com/newsfeed.php...

O_o

-Nay

Posted: Thu Nov 20, 2003 10:42 am
by jason
Should be, they are both the same site. Just got two different domains pointed to it.

Posted: Thu Nov 20, 2003 10:51 am
by Nay
but when i use the phpcomplete.com/newsfeed.php link, i get cannot find server while when i use geekcomplete.com/newsfeed.php, i get the rss feed.

-Nay

Posted: Thu Nov 20, 2003 11:03 am
by infolock
nice book jason. I'll have to look give a few hints about it being a good christmas present 8)

edit : too bad it isn't for php though. would be nice to see one for it though.

Posted: Thu Nov 20, 2003 11:30 am
by jason
Doesn't really matter that it's not for PHP. The lessons applied carry over very easily to PHP. The examples, though in Java, are easy to understand.