 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Abhinav Singh's Blog: Wordpress style "Duplicate comment detected" using Memcached and PHP
by Chris Cornutt January 02, 2010 @ 07:36:27
Abhinav Singh has a new post today looking at his method for preventing duplicate comments (similar to a method used on Wordpress blogs) using memcached.
In this blog post, I will put up some sample PHP code for Duplicate comment detection using Memcached without touching the databases. Towards the end, I will also discuss how the script can be modified for usage in any environment including forums and social networking websites.
His method uses a custom function (is_repetitive_comment) to create an md5 hash of the comment and username to check against the stored values on the memcached server. Code is included as is an explaination of how it all works together.
voice your opinion now!
memcached duplicate comment wordpress
Jani Hartikainen's Blog: Is commenting your code useless?
by Chris Cornutt October 16, 2009 @ 09:45:03
Jani Hartikainen has posted some of his opinions about code commenting in a response to this post from James Carr claiming that code comments on fresh code is a bad idea.
James puts it quite well: When you write comments, it would be much better idea to just talk with your coworkers about it. He uses "excuses" as an example - code which does something that you need to explain, or says something like "Here we do X but we should really do Y" While I partially agree - if you're not sure which approach you should use, or whether your approach is correct, talking with your coworkers is definitely a good idea.
Jani talks a bit about what he considers good and bad commenting - non-redundant, descriptive and sometimes difficult to remember to do correctly.
voice your opinion now!
comment code opinion
Johannes Schluter's Blog: Code and human languages
by Chris Cornutt August 06, 2009 @ 11:34:21
In a recent blog post from Johannes Schluter he proposes a "universal language" for documentation and code comments - English.
The argument for using only English is simple: Every developer should know at least basic English and using English helps when either outsourcing, opensourcing or reaching new markets. Now there are arguments against English, too, one is that not all developers are able of using English properly so reading and writing comments is more difficult for them - now you don't have to write long prosaic texts in comments, but still...
Comments on the post vary - some disagree and some say that this is how they're already doing things and it seems to be working out well.
voice your opinion now!
code comment documentation language
Davey Shafik's Blog: Return Values
by Chris Cornutt February 04, 2009 @ 11:14:28
Davey Shafik has taken a look at return values and keeping them standard when handing them back from the results of a database query.
In #phpc we recently had a discussion about function return values; specifically from database queries. I'm going to go on a (admittedly, rather sturdy looking) limb and say this applies to pretty much any function that returns from a data resource, not just a database .
His personal preference is to return the results data if there's matching information but to return a false value if there is an error/not results were found. He includes a snippet of example code to show the structure he's talking about. Some of the comments on the post mention things like exception handling, other similar methods other developers use and the use of nulls.
voice your opinion now!
return value array false null exception comment
Shawn Stratton's Blog: Code Readability, Part 1
by Chris Cornutt January 13, 2009 @ 10:20:28
Shawn Stratton has posted the first part of his series looking at "Code Readability". This part focuses on something that is often woefully forgotten by many developers - proper code commenting.
The simplicity of PHP can sometimes be overwhelming, with so many different ways and approaches to creating solutions for our problems we sometimes lose the ability to think past the current problem and into the future. [...] Today I'm going to try to address some quick ideas that most of you will already be familiar with, things that will aide in the general readability of code for future generations.
He looks at the difference between useful and non-useful comments: DocBlocks, putting them near decisions, listing array parameters, recording TODOs and how it can all help you generate API documentation quickly and easily.
voice your opinion now!
readability docblock comment useful series
Brandon Savage's Blog: Where Comments Are Useful
by Chris Cornutt January 01, 2009 @ 20:04:45
Brandon Savage has his own response to the "comments are harmful" post over on the PHP in Action blog:
There's a lot of good advice, especially about writing clean code. But the article fails to address a good number of really critical details and to some degree misses the point of Eli's article.
He mentions these points - the value of writing comments before hand, the usefulness of descriptive comments, how they can be used as a todo pointing to future development and using them to share the knowledge and let other people in on what you're thinking.
voice your opinion now!
comment useful before descriptive future development share
|
Community Events
Don't see your event here? Let us know!
|