Coding standards a set of conventions and practices used in software, such as naming classes, variables, and files.
6
votes
3answers
406 views
Converting a 1,000,000 rows database
If I have a database that stores the login credentials of 1,000,000 users in PLAINTEXT, how much effort will it take me to md5 hash these passwords?
6
votes
6answers
296 views
Vertical alignment: yea or nay?
For instance, non-vertically aligned:
Name: Hamt
Version: 0.1.0
Cabal-Version: >= 1.2
License: BSD3
Author: Jason Baker
Or vertically aligned:
Name: Hamt
Version: 0.1.0
...
6
votes
8answers
557 views
How should I introduce a coding standard to my team?
First a bit of background: My current development manager is taking another opportunity the end of this week, leaving our team with four fulltime developers, a part-time intern and a web designer ...
6
votes
1answer
148 views
Naming of related classes and interfaces
I have created an ObjectParser class which parses data into strongly typed objects using an IObjectParserDataSource as the data source (the data could be an Excel file, text file, array, query string, ...
6
votes
5answers
502 views
Should I use title case in URLs?
We are currently deciding on a consistent naming convention across a site with multiple web applications. Historically, I've been an advocate of the 'lowercase all the letters!' when creating URLs:
...
6
votes
2answers
114 views
What do you do when working with multiple languages with different capitalization schemes?
I'm making a webapp using Django. The Python convention for naming variables is lowercase_with_underscores, but the Javascript convention is camelCase. In addition, I've seen many people use ...
6
votes
3answers
221 views
How should I get my code ready for OpenSourcing it and putting it on GitHub?
In a few weeks, my project is going to be finished and I want to start getting my code ready for other people to use it.
I am going to be posting everything to GitHub so people can tweak it and ...
6
votes
3answers
193 views
“static” as a semantic clue about statelessness?
this might be a little philosophical but I hope someone can help me find a good way to think about this.
I've recently undertaken a refactoring of a medium sized project in Java to go back and add ...
6
votes
2answers
247 views
REST API Library Conventions
Most API libraries define one method for each endpoint. If there is an endpoint for getting user information, you might have a method like:
getUserInfo(userId);
That simple method is often a ...
6
votes
4answers
165 views
Is there a standard for when you include libraries or not?
I often come across a class which has a single reference to another library and was wondering if its better to include the library or to reference the object by it's full name. Is one better then the ...
6
votes
1answer
430 views
Are there any FOSS operating systems available that conform to NASA's JPL coding standards?
I, like many others, have been completely enamored with the recent successful landing of Mar's Curiosity rover. After reading a couple of articles, and following a few links, I've found a couple C ...
5
votes
8answers
1k views
What's the best book for coding conventions? [closed]
What's the best book about coding conventions (and perhaps design patterns), that you highly recommend (at best code samples in Python, C++ or Java)?
It would be good, if the book (or just another) ...
5
votes
8answers
498 views
What is best in a if condition? (position < size) or (size > position) and why? [closed]
In a condition statement (IF) everyone use (position < size), but why? Only convention or there is a good reason for that?
Example:
if (pos < array.lengh) {
// do some with array[pos];
}
...
5
votes
5answers
800 views
Naming classes, methods, functions and variables
There are 3 important naming conventions:
with_underscores
PascalCased
camelCased
Other variants are not important because they are not commonly used.
For variables it seems that the one with ...
5
votes
5answers
749 views
How to deal with different programming styles in a team?
We have a small dev team (only 3 developers) and we recently got
a new team member. While he is a smart coder, his coding style is
completely different from ours. Our existing code base contains
...
5
votes
1answer
313 views
Word for red flags / warning signs?
When reading about best practices and code reviews, I have come across a word/phrase that people on forums have used to describe code that should be a warning sign that the programmer may have missed ...
5
votes
4answers
181 views
What writing rules are different for humans and code?
It seems that some rules of writing code are in direct contradiction with the rules of human writing. For example in code it's advisable to define each piece of information in only one place and in ...
5
votes
2answers
2k views
What are the reasons one would use fully qualified class names in source code?
I recently ran across code where the developers used both fully qualified class names AND imported class names in their source code.
Example:
import packageA.Foo;
public class Example {
public ...
5
votes
5answers
346 views
Is it considered bad practice to run different JavaScript for IE
Is it considered bad practice (and how bad) to run different JavaScript for IE? Currently im writing some JavaScript and the simplist way to work arround IE quirks seems to be to check for browser ...
5
votes
4answers
349 views
How a freelancer can learn industry standards?
Being a freelancer, I don't have access to corporate training programs where employees learn best practices. Most of the time I am advised to look into the available code on the Internet. Ideal places ...
5
votes
4answers
452 views
C# coding standards” Use the const directive only on natural constants
I've seen these 2 guidelines in coding c# standard and I’m not sure the what the 2nd one means.
With the exception of zero and one, never hard-code a numeric value; always declare a constant ...
5
votes
3answers
215 views
Why does Zend discourage “floating functions”?
Zend's Coding Standard Naming Convention says
Functions in the global scope (a.k.a "floating functions") are permitted but discouraged in most cases. Consider wrapping these functions in a static ...
5
votes
2answers
443 views
Should you create a class within a method?
I have made a program using Java that is an implementation of this project: http://nifty.stanford.edu/2009/stone-random-art/sml/index.html. Essentially, you create a mathematical expression and, ...
5
votes
5answers
248 views
Standards in Enterprise Development
Is it perhaps time for enterprise systems to be developed to strict enforced standards? Many books list optional 'standards' and best practices, but these are purely suggested practices. Still, every ...
5
votes
4answers
127 views
Should Equality be commutative within a Class Hierachy?
It is easy to define the Equals operation in ways that are not commutative. When providing equality against other types, there are obviously situations (in most languages) were equality not being ...
5
votes
6answers
788 views
Indentation: is there any evidence to show whether 2 or 4 spaces is more readable? [closed]
At the company I work for, we're trying to standardize our development practices, and we want to make the right call regarding indentation.
Is there any empirical evidence (preferably research ...
5
votes
1answer
140 views
Should classes from the same namespace be kept in the same assembly?
For example, ISerializable and the Serializable Attribute are both in the System.Runtime.Serialization namespace, but not the assembly of the same name. On the other hand, DataContract attributes are ...
5
votes
4answers
325 views
How to apply one of the OOP concepts (Closed for Modification and Open for extension)?
Days before, I created Question, Quiz, and Main classes. One Quiz has one or more Questions. From the main class I first create Question objects (the constructor accepts an array of numbers). The Quiz ...
5
votes
5answers
321 views
What are the standard practices for database access in .net?
I have seen weird database access practices in .net. I have seen stored procedures for every database tasks. I have seen every database property name is preceded by it's table name. I have seen fully ...
5
votes
1answer
135 views
How to learn what the industry standards/expectations are, particularly with security?
For instance, I was making my first mobile web-application about a year ago, and half-way through, someone pointed me to jQuery Mobile. Obviously this induced a total revolution in my app. Rewrote ...
5
votes
1answer
423 views
Is there a standard pseudocode for parallel algorithms?
The common styles of pseudocode are largely intelligible, and it is more or less clear how to write pseudocode for sequential programs.
But if parallelism is not hidden behind a full library and is ...
5
votes
1answer
386 views
A standard style guide or best-practice guide for web application development
I run a very small team of developers on a web application, just three people (and not even full time). We're all capable developers, but we write our code in very different ways: we name similar ...
4
votes
13answers
597 views
Logging, do you do it?
Back on my theme of late: interview questions. Was recently asked to describe a time I'd used logging.
My first instinct was to respond with compiler warnings set to full and error-out. What he was ...
4
votes
6answers
912 views
Naming conventions for variables [closed]
When programming, what naming conventions do you use for your variables? I don't mean when the name of the variable should be obvious; ie. sum, total, first, last. But when you name variables that ...
4
votes
3answers
269 views
Naming a “do X if needed” method
What is a good way to name a method that checks if X needs to be done, and does X it if necessary?
For example, how to name a method that updates a user list if new users have logged in? ...
4
votes
5answers
436 views
How can I avoid mistakes using the same variable name again?
This isn't a rare case and occurs with me often and I spent countless time trying to debug the code.
Latest example, this PHP code where I used $email for the parameter and for object as well.
...
4
votes
8answers
605 views
How can I promote clean coding at my workplace?
I work with a lot of legacy Java and RPG code on an internal company application. As you might expect, a lot of the code is written in many different styles, and often is difficult to read because of ...
4
votes
4answers
712 views
How can I deal with developers who don't use English in code? [duplicate]
Possible Duplicate:
Code maintenance: keeping a bad pattern when extending new code for being consistent, or not?
I'm working on a project for a Greek public organization, as a part for a ...
4
votes
5answers
314 views
Keep coding the wrong way to remain consistent? [duplicate]
Possible Duplicate:
Code maintenance: keeping a bad pattern when extending new code for being consistent, or not?
To keep things simple let's say I am responsible for maintaining two ...
4
votes
3answers
198 views
What quality level in the commit history can/should I expect/enforce?
I worked as a lone developer for a long time. During this time, I developed a way of formulating and ordering commit messages: Refactor first, describe exactly the reason for the commit in the ...
4
votes
2answers
448 views
Why are people afraid to die()?
I have seen a lot of people (first comment) hating die(); instead of exit;
As the follow-up comments on that post note, die and exit are the same - the attitude appears to be one of perception, with ...
4
votes
3answers
414 views
CTO has left — codebase is a huge kludge, any advice on how to manage/handle/damage control? [closed]
I began work at a company 2 months ago as a PHP developer. I stepped in to somewhat of a kludge, but I've yet to find a company that isn't... The development stable is currently two developers ...
4
votes
5answers
288 views
What is the minumum code/operations to have in a separate thread?
I understand that threading is needed to get the maximum performance out of today's multicore processors but starting a thread is rather costly so you can't put every single calculation that can be ...
4
votes
1answer
92 views
Naming conventions for newtype deconstructors (destructors?)
Looking into Haskell's standard library we can see:
newtype StateT s m a = StateT { runStateT :: s -> m (a, s) }
newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a }
newtype Sum a = Sum { ...
4
votes
3answers
164 views
User defined type for healthcare / Medical Records variable name prefixes?
I was reading Code Complete regarding variable naming in trying to find an answer to this question and stumbled on a table of commonly accepted prefixes for programming word processor software. Well, ...
4
votes
5answers
361 views
Where is this from (originally)?: “80% of the lifetime cost of a piece of software goes to maintenance”
In the Sun Java coding conventions document (here: http://www.oracle.com/technetwork/java/codeconv-138413.html), it states:
"80% of the lifetime cost of a piece of software goes to maintenance"
Does ...
4
votes
2answers
228 views
What should my “large codebase sample” look like?
If an employer asks for a large code sample, one for an entire project, what characteristics should the project have to show architectural skills and the ability to manage a large codebase?
For ...
4
votes
3answers
138 views
Where do I place my example implementations in my framework?
I've created a pretty simple templating framework and have default implementations for some of my interfaces used for passing around information. I store these in MyFramework.Default namespace
...
4
votes
2answers
269 views
Should functions always return a success/failure status? [duplicate]
Possible Duplicate:
When and why you should use void (instead of i.e. bool/int)
What is the reasoning behind making all functions (and methods!) return a uniform type, usually int, as a ...
4
votes
7answers
2k views
Codeigniter Open Source Applications for Coding References [closed]
I choose codeigniter to be my first framework to work with.
Now I'm looking for open source applications built based on this framework to be my references for good coding practices and standards.
...