programming-practices

Features/functions that make your app more professional? Coding hobbyhorses.

What features do you implement (how) in your PHP web applications because you deem it "more professional" in some way? Or do you have personal nitpicks and code hobbyhorses, specifically small things that might count? Which unsavoured code or minor functionality do you spend an inordinate amount of time on to get right? . Example co...

It it a bad practice to use break in a for loop?

Possible Duplicate: Break statements In the real world Hi, Is it a bad practice to use break statement inside a for loop? Say, I am searching for an value in an array. Compare inside a for loop and when value is found, break; to exit the for loop. Is this a bad practice? I have seen the alternative used : define a variable ...

What's the best practice method for storing raw php, javascript, html or similar in a mysql database?

The example web page has 2 fields and allows a user to enter a title and code. Both fields would later be embed and displayed in an HTML page for viewing and/or editing but not execution. In other words, any PHP or javascript or similar should not run but be displayed for editing and copying. In this case, what is the best way to escape...

What should have javadoc in Java ?

What should be documented by javadoc comments (classes, methods, constructors and fields? Or only classes methods and constructors?)? Is there any convention about that ? Please provide links to relevant resources in your answer whenever possible. Thank you EDIT: The question is not about how is it usualy done or what is logical to com...

The 10 Commandments of Programming...

...or programming related activities There's a certain text (The Bible) which suggests that there were, at least at one time, a list of 10 rules (The 10 Commandments) that if followed you would be considered, well, "good". If such a list existed for programming, what would it be? I'm thinking in terms of languages (or language types) t...

What to consider before subclassing list?

Hi, I was recently going over a coding problem I was having and someone looking at the code said that subclassing list was bad (my problem was unrelated to that class). He said that you shouldn't do it and that it came with a bunch of bad side effects. Is this true? I'm asking if list is generally bad to subclass and if so, what are th...

Good programming practices versus speed of ad-hoc programming

I know good programming practices always help in the "long run" for a project, but sometimes they just seem to cost a lot of time. For instance, its suggested that I maintain a header file and a cpp file for each class that I make, keep only the declarations in the headers while definitions in cpp. Even with 10-12 classes, this process b...

Implementing Payroll system

My professor has given me an assignment on Pay roll system in python. There's one feature of printing Employees: All Employees Print by Attributes Print by Id Print by Name Print by Designation Print by Salary Print less than (<) Print greater than (>) ... all possible conditions Print by Depart...

When is it time to refactor code?

On on hand: 1. You never get time to do it. 2. "Context switching" is mentally expensive (difficult to leave what you're doing in the middle of it). 3. It usually isn't an easy task. 4. There's always the fear you'll break something that's now working. On the other: 1. Using that code is error-prone. 2. Over time you might realize that ...

When Expando Class should be used in Google App Engine Apps?

What are the applications for Google App Engine Expando Class? And what are the good practices related to it? ...

Should I use a structure instead of a class to hold string only data in C#?

C# question. Say I have a customers class that has a bunch of props for storing string only data such as name postal data and phone numbers. I don't use this entity for ORM as I'm only adding it to some type of collection for use during app life cycle. Additionally I don't need to add any entity specific methods to it or persist the da...

Could I get some wpf specific design resources for best practise in themeing controls?

What are some wpf specific design resources for best practise in themeing controls? Could you design legends point me to some sweet resources for themeing of WPF controls? I'm familiar with some of the MSDN stuff, hoping for maybe more blogs,walkthroughs etc by 3rd parties with experience in this area. I've been googling but keen to get...

Online fun game for programmers?

Do we have any game for programmers? I forget the name of s site in which we have to train our robot using function to travel like packman. Anyone remember the site? ...

C# - Bad Practices

What are some of the bad practices you have seen in C# or .NET in general, there are plenty of posts on "good" practices, but I have not seen one on bad practices. If this is OT then please delete. ...

Android Production Logging Best Practice

What are the best practices for logging in Android apps in production mode, keeping in mind the following requirements : 1- Ability to upload logs for debugging 2- Ability to clean up logs or set rollovers Thanks ...