Share Your Programming Tips

A Member? Please Login  
type your username and password to login
Date: October 14, 2008, 11:19 AM
249693 members and 148380 Topics
Latest Member: osteowsgeathy
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  Share Your Programming Tips
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Share Your Programming Tips  (Read 584 views)
naijaguru (m)
Share Your Programming Tips
« on: March 28, 2007, 11:58 AM »

Did You Know? (Programming Tips)

Hello!

I would love to see a long thread of bits of programming tips from the corners of our heads  Cheesy
You can reply to a tip by supporting and go further by adding yours or criticizing it and then post the right tip. Don't be scared of posting a wrong tip, you'll always learn.

OK I START

- Did you know that SIMPLE APPLICATIONS are less security prone?
naijaguru (m)
Re: Did You Know? (programming Tips)
« #1 on: March 28, 2007, 03:09 PM »

Did you know that Smarty is not just a Php tag replacement system but a Template/Presentation framework for seperating code from content, thus creating a clear division of labour between the coder and the designer
abdkabir (m)
Re: Did You Know? (programming Tips)
« #2 on: March 29, 2007, 01:49 PM »

Did u know, taking a few time, thinking of and planning your coding project could save  you a lot of time rather than just jumping to coding thinking the ideas will come as you program
abdkabir (m)
Re: Did You Know? (programming Tips)
« #3 on: March 29, 2007, 01:50 PM »

Did u know, taking a few time, thinking of and planing your coding project could save  you a lot of time rather than just jumping to coding thinking the ideas will come as you program
naijaguru (m)
Re: Did You Know? (programming Tips)
« #4 on: March 29, 2007, 05:01 PM »

Yeah you are right abdkabir. A proper use of UML or OOD (Object Oriented Design Methodology) gives u a robust and maintainable result.

did you know that PEAR Packages in PHP is Similar to JAVA's API ?
my2cents (m)
Re: Did You Know? (programming Tips)
« #5 on: March 29, 2007, 05:16 PM »

did you know that if, in a loop, you assign the size of an array outside of the loop as opposed to including it as ".size" inside, say, the for loop, that you actually save on memory?

In other words, rather than have: (for i=0; i < array.size(); i++), you should have:
var j = array.size();
(for i=0; i < j; i++)

y? because in the loop, the processor has to calculate the size of the array each time whereas in the 2nd method, it is calculated and stored in "j" just once.

Pretty subtle, but worthy of mention.

I hope this helps.
c0dec (m)
Re: Share Your Programming Tips
« #6 on: March 29, 2007, 06:25 PM »

c++ coders: http://www.tantalon.com/pete/cppopt/main.htm

C coders: uhmassuming c and d are pointers to characters.
Code:
while (*c++ = *d++);
does a string copy Undecided
abdkabir (m)
Re: Share Your Programming Tips
« #7 on: March 29, 2007, 11:42 PM »

Nice one @ naijaguru

Still even if the project isnt  big enough to require OOA , OOD or UML. Did u know its still important u do the thinking about how you will do your coding before starting. IT ALWAYS HELPS U know just thinking about possible classes, attributes, methods , procedures, Algorithms, Data types etc. Wink
 
naijaguru (m)
Re: Share Your Programming Tips
« #8 on: March 30, 2007, 10:27 AM »

@ my2cents.

I think using
     for(int i = 0; i <= array.lenght(); i++) {
           , your code here
      } (Java) is better.

Why? What if you are coding a sort of  game or a multi-threading app, and the length of your array increases during runtime. Your loop would simply accommodate the current array.length(). Copying array.length() in a variable would result to looping in a wrong number of times.

did you know that nl2br() function in PHP adds a <br> to every newline in your user input from the <textarea> field?

Seriously, I never knew that, I had to use TinyMCE, an application written in JavaScript to convert <textarea> inputs to HTML and also act like a sort word processor on your HTML forms, for a simple news management system. It was so stupid because TinyMCE takes over 1MB of space from ur host, and you also have to deal with JavaScript compatibility issues, tho light.

Little functions like that could save you the stress of re-inventing the wheel.
simmy (m)
Re: Share Your Programming Tips
« #9 on: March 30, 2007, 01:48 PM »

omo i bow for you guys o
4 Play (m)
Re: Share Your Programming Tips
« #10 on: April 09, 2007, 04:06 PM »

Otuyelu (m)
Re: Share Your Programming Tips
« #11 on: April 11, 2007, 05:43 PM »

Okay I have a bunch of snippets I usually use, but here are sites that have some of the best Code Snippets

PHP:
http://www.zend.com/code/codex.php
http://www.phpbuilder.com/snippet/
http://www.php-csl.com/snippets/
I stop here cause a thorough search of google.com can get you real cool snippets sites.
MySQL:
http://forge.mysql.com/snippets/

Honorable mentions to
http://www.phpfreaks.com (I started my PHP learning from the articles and references here)
http://www.phpclasses.org/  (not really snippets but this has the largest repository of OpenSource PHP classes for Object Oriented Programmers.  you know what they say about "classes"? The more class file you have, the more more time you have to spend at the beach.  Save time, use classes!!!)


General (these have code snippets from several technologies):
http://snippets.dzone.com
http://www.snippetlibrary.com/code.php
 Web Development Or Software Development: Which Is More Lucrative?  Pls I Need Registration Key For Visual Web Developer 2005 Express Edition   Can A Skilled Programmer Make It In Nigeria?  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Job Talk Jobs/Vacancies (2) Career Talk Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.