Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,974 members, 7,817,870 topics. Date: Saturday, 04 May 2024 at 09:45 PM

Share Your Programming Tips - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Share Your Programming Tips (2285 Views)

Larisoft Clean Desktop: (re: Operation Prove Your Programming Skills) / Where To Go If You Need Programmers Or Advertise Your Programming Skills / Defend Your Programming Language (2) (3) (4)

(1) (Reply) (Go Down)

Share Your Programming Tips by naijaguru(m): 11:58am On Mar 28, 2007
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?
Re: Share Your Programming Tips by naijaguru(m): 3:09pm On Mar 28, 2007
[size=14pt]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[/size]
Re: Share Your Programming Tips by abdkabir(m): 1:49pm On Mar 29, 2007
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
Re: Share Your Programming Tips by abdkabir(m): 1:50pm On Mar 29, 2007
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
Re: Share Your Programming Tips by naijaguru(m): 5:01pm On Mar 29, 2007
Yeah you are right abdkabir. A proper use of UML or OOD (Object Oriented Design Methodology) gives u a robust and maintainable result.

[size=14pt]did you know that PEAR Packages in PHP is Similar to JAVA's API ?[/size]
Re: Share Your Programming Tips by my2cents(m): 5:16pm On Mar 29, 2007
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? cos 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.
Re: Share Your Programming Tips by c0dec(m): 6:25pm On Mar 29, 2007
c++ coders: http://www.tantalon.com/pete/cppopt/main.htm

[b]C coders: [/b]uhm. . .assuming c and d are pointers to characters.

while (*c++ = *d++);

does a string copy undecided
Re: Share Your Programming Tips by abdkabir(m): 11:42pm On Mar 29, 2007
Nice one @ naijaguru

Still even if the project isnt big enough to require OOA , OOD or UML. [b]Did u know its still important u do the thinking about how you will do your coding before starting. [/b]IT ALWAYS HELPS U know just thinking about possible classes, attributes, methods , procedures, Algorithms, Data types etc. wink
Re: Share Your Programming Tips by naijaguru(m): 10:27am On Mar 30, 2007
@ 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.

[size=14pt]did you know that nl2br() function in PHP adds a <br> to every newline in your user input from the <textarea> field?[/size]

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 cos 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.
Re: Share Your Programming Tips by simmy(m): 1:48pm On Mar 30, 2007
omo i bow 4 u guys o
Re: Share Your Programming Tips by 4Play(m): 4:06pm On Apr 09, 2007
Re: Share Your Programming Tips by Otuyelu(m): 5:43pm On Apr 11, 2007
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
Re: Share Your Programming Tips by blueyedgeek(m): 6:32pm On Mar 01, 2015
{{var bump = true}}
Re: Share Your Programming Tips by mubitechnology: 8:26pm On Mar 01, 2015
It really nice to see PRO's droping some good tips on programming, pls how can I combine my studies and programming, I have beening learning this programming especially scripting language like html, css, php and javascript since 2013 but it seem am not putting much time to it due to my studies, guys I need you help

(1) (Reply)

[News] Mark Zuckerberg’s Sister Is Now A Google Employee / Deployment In Vb.net Please Urgent Help / Some SEO Interview Questions And Answer

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 27
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.