Man it feels good to be able to shorten code

Ye' old general discussion board. Basically, for everything that isn't covered elsewhere. Come here to shoot the breeze, shoot your mouth off, or whatever suits your fancy.
This forum is not for asking programming related questions.

Moderator: General Moderators

Post Reply
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Man it feels good to be able to shorten code

Post 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.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post 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
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

ooo, is that a free service provided by the FastestTyper (C) Mac? :D

-Nay
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post 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
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post 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:
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post by Nay »

qads wrote:great, where can i send you 20MBs worth of code then? :lol:
only? :wink:

-Nay
qads
DevNet Resident
Posts: 1199
Joined: Tue Apr 23, 2002 10:02 am
Location: Brisbane

Post 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
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post 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/
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Should be, they are both the same site. Just got two different domains pointed to it.
Nay
Forum Regular
Posts: 951
Joined: Fri Jun 20, 2003 11:03 am
Location: Brisbane, Australia

Post 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
User avatar
infolock
DevNet Resident
Posts: 1708
Joined: Wed Sep 25, 2002 7:47 pm

Post 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.
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post 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.
Post Reply