Here is a short description of programming style from Wikipedia: Programming style is a set of rules or guidelines used when writing the source code for a computer program.
-1
votes
1answer
37 views
Array item vs property
Which way is better to store a object that's meant to be used globally?
$app['service']->doSomething();
or
$app->service->doSomething();
?
2
votes
5answers
198 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 ...
1
vote
1answer
64 views
Capitalization convention in assembly? [closed]
Is there any convention on what to capitalize in (x86) assembly?
For example, which one of these 'looks best'? (Or maybe none of them do?)
[BITS 32]
%define MACRO 1
MyLabel:
MOV EAX, 2
versus
...
5
votes
5answers
267 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 ...
-1
votes
2answers
289 views
Why is 24 lines a common default terminal height?
80x24 characters seems to be a very common default for terminal windows. This answer provides a very good historical reason as to why the width is 80 characters.
But why is the height commonly 24 ...
135
votes
7answers
13k views
Why is 80 characters the 'standard' limit for code width?
Specifically, why 80 and not 79, 81 or 100? What is the origin of this particular value?
39
votes
15answers
2k views
Is it wrong to use a boolean parameter to determine behavior?
I have seen a practice from time to time that "feels" wrong, but I can't quite articulate what is wrong about it. Or maybe it's just my prejudice. Here goes:
A developer defines a method with a ...
7
votes
3answers
155 views
When comparing a combination of String literals, is it convention to call .equals() on the literal? [closed]
There are benefits to each, and I understand the differences - but what is considered best / standard practice? Why?
"myString".equals(myStringVar)
Avoids a potential NPE and does not require a ...
3
votes
4answers
182 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 ...
53
votes
17answers
2k views
Recommendations for teaching junior programmers good coding style
I am a big fan of good coding style, producing clean, clear code that runs well and is easy to use and integrate into larger systems. I believe that we programmers are essentially craftspeople who ...
2
votes
2answers
118 views
Standards for mixing languages within one application? [closed]
Possible Duplicate:
What do you do when working with multiple languages with different capitalization schemes?
When mixing programming languages, is it a best practice to use different ...
4
votes
1answer
67 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 ...
2
votes
5answers
137 views
What is a generic term for name/identifier? (as opposed to label)
I need to refer to a number of things that have both an identifier value (used in code and configuration), and a human-readable label. These things include:
database columns
dropdown items
...
10
votes
7answers
465 views
Practical considerations for HTML / CSS naming conventions (syntax)
Question: what are the practical considerations for the syntax in class and id values?
Note that I'm not asking about the semantics, i.e. the actual words that are being used, as for example ...
2
votes
4answers
317 views
What are the benefits of closing every if-statement with an else in Python?
I am reading Learn Python the Hard Way by Zed Shaw. In this lesson he writes: "Every if-statement must have an else."
What are the benefits of ending every if-statement with an else? Are there any ...
9
votes
4answers
313 views
Javascript naming conventions
I am from Java background and am new to JavaScript. I have noticed many JavaScript methods using single character parameter names, such as in the following example.
doSomething(a,b,c)
I don't like ...
7
votes
1answer
76 views
Are there any free tools to measure web project's performance, security and other standards?
Are there any open-source tools to measure the standard of a web application project? I want to verify my project for:
Possible security leaks (SQL Injection etc.)
Performance
Stability (in high ...
3
votes
3answers
151 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 ...
12
votes
3answers
333 views
Bugs that can be avoided with coding standards
I am looking for statistics (or estimations) that backup the claim that coding standards help reduce bugs. Hard-numbers would be nice, although I haven't had much look finding any. I've even looked ...
5
votes
4answers
238 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:
...
14
votes
9answers
531 views
How to lead a development project without technical expertise
I have been a hands-on developer for my entire career and love working with code. I have always resented the team lead who has little or no expertise regarding a particular technology and yet insists ...
2
votes
1answer
119 views
Package conventions for MVC app [closed]
Which (if either) of the below is the more conventional/acceptable way to structure packages in a J2EE app? I'm trying to follow an MVC pattern as much as possible.
foo.bar.users
...
2
votes
2answers
127 views
GUI architecture and class naming advice
Problem:
I'm working on coding a few light-weight touch-tablet games and often get stuck with difficulties naming my user interaction/interface classes and their relationships with each other ...
2
votes
1answer
263 views
Has anyone thoroughly compared C# common coding standards?
Most of the C# programmers I know embrace one of the common coding standards. However being aware of the standards is one thing, telling the differences is another.
Browsing the common coding ...
7
votes
1answer
72 views
How does one request / handle personal or financial information?
I would like to create a budget app for Android. Obviously, to be competitive, I would need to allow users to get data from their bank. For [huge] security reasons, this stuff is not just freely given ...
3
votes
4answers
576 views
How can I deal with developers who don't use English in code? [closed]
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
2answers
271 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 ...
11
votes
8answers
466 views
Conflicting Java Styles within a Team
I am part of a Java development team with a 6 week deadline. This necessitates writing a good deal of code very very quickly. However our development team has different styles of coding. Everything ...
5
votes
1answer
264 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 ...
16
votes
10answers
1k views
Are chatty/humorous comments in source code acceptable or unprofessional? [closed]
Possible Duplicate:
Humor in Documentation
Throughout my professional career, I have often relied on chatty or humorous comments in source code (or source control commit messages) to help ...
3
votes
3answers
183 views
What is the right way to develop ASP.NET applications in order to separate data access from data visualization?
I'm currently involved in a migration to TFS from SVN of a large project that is going to be divided into five different sites. This project allows some providers to insert five different product data ...
6
votes
8answers
408 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 ...
2
votes
4answers
214 views
What kind of interface should a double container offer?
I want to write a class which offers two sequences of elements to its users. The first one (lets call it "primary") is the main of the class and will be use 80% of the time. The second one (lets call ...
0
votes
2answers
128 views
Naming Rules: Standards, Reserved, and what do they depend on? [closed]
I want to know the rules of naming (AlwaysCapitalize, _underscore, firstSmallLetter, etc...) for each of Namespaces, Classes, Interfaces, Exceptions, Data Members, Methods, Variables, etc....
also I ...
3
votes
3answers
101 views
migrating product and team from startup race to quality development [closed]
Possible Duplicate:
A simple ways to improve the release quality in RAD environment
This is year 3 and product is selling good enough. Now we need to enforce good software development ...
7
votes
5answers
227 views
How do you avoid name similarities between your classes and the native ones?
I just ran into an "interesting problem", which I would like your opinion about:
I am developing a system and for many reasons (meaning: abstraction, technology independence, etc) we create our own ...
3
votes
2answers
212 views
How to mark an empty conditional block in Java
In C++ when I wanted to mark that if is empty by design I added NULL; as statement:
if (cond1) {
...
} else if (cond2) {
NULL;
} else {
...
}
However in Java it seems to be impossible ...
6
votes
2answers
96 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 ...
4
votes
5answers
412 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
...
0
votes
0answers
191 views
Which one is better if(x==3) or if(3==x)? [closed]
Possible Duplicates:
Doesn't “if (0 == value) …” do more harm than good?
if ('constant' == $variable) vs. if ($variable == 'constant')
Yesterday, I ...
284
votes
16answers
12k views
Where did the notion of “one return only” come from?
I often talk to Java programmers who say "Don't put multiple return statements in the same method." When I ask them to tell me the reasons why, all I get is "The coding standard says so." or "It's ...
19
votes
4answers
612 views
Should interface names begin with an “I” prefix?
I have been reading "Clean Code" by Robert Martin to hopefully, become a better programmer. While none of it so far has been really ground breaking it has made me think differently about the way I ...
1
vote
2answers
370 views
Why would a video game need main(String[] args) in its own class?
My teacher just told me that whenever I create a class to run something for a video game company that uses Eclipse, I should make a run class with the main and any outputs. He says any arithmetic ...
17
votes
12answers
1k views
Is it an appropriate use of #define to make typing repeated code easier?
Is there any view on whether using the #define to define full lines of code for simplifying coding is good or bad programming practice? For example, if I needed to print a bunch of words together, I'd ...
0
votes
4answers
175 views
How do I convince some one that test should do assertion (not assertions) and not the helper methods
Joined a new employer and came across a new style of writing tests.
@Test()
public testMethodWhichDoesNotDoAnyAssertion() {
LoginPage loginPage = signUpPage.doLogin("username","password");
...
1
vote
4answers
130 views
What are the pros and cons of directly exposing a Table/View entity class to the client?
I'm developing a multi-tier application. We separate our project into three logical layers: client, service and data access. However, almost all methods in the service layer don't do anything except ...
4
votes
5answers
201 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 ...
2
votes
7answers
387 views
Is there a common capitalization convention in C++?
I do a lot of work in Python and Java, and both those languages have fairly common (though not universal) conventions on how capitalization should be used in identifiers: both use PascalCase for class ...
20
votes
9answers
672 views
Is it better to use pre-existing bad practices, or good practices that don't fit well with old code?
I was thinking of this because I was trying to write an extension for an existing 3rd party software, and their database is horribly denormalized. I needed to use their existing tables and add a bunch ...
6
votes
5answers
806 views
Why do programmers use one-based indexing for line numbers in source code? [closed]
Possible Duplicate:
Why isn't the line count in Visual Studio zero-based?
Why isn't the top line in a source code file labelled line number 0?
i.e. in a source file which was 10 ...