coding-standards

What should be the standard PHP code file lenth in LOC ?

I do PHP coding a lot in my company and personal work. Usually my files get bigger, sometimes more than 2000-3000 lines long. Then, they get difficult to manage. My Question: What should be (is) the standard length of a PHP code file in terms of lines-of-code. At what length do you guys split it up? Note: No Object Oriented programming...

When should assert() be used?

In developing a large C++ programming project with many developers, we have run into issues with inappropriate use of assert() in the code which results in poor quality where the assertion does indeed occur and the product crashes. The question is what are good principles to apply to use assert() appropriately? When is it proper to use...

Browsers with JS disabled

Years ago I used to design with JavaScript disabled browsers in mind. How important is it nowadays? Is it really something you need to worry about? I've never come across a user in real life who has JavaScript disabled. Anyone got any figures? ...

Why maintain traditional detailed ChangeLog in modern world (with SVN, Mercurial, Git)?

Detailed ChangeLog entry usually tell who, when and what function changed and for why this change done. And this for every separate function in the source code tree! As I understand ChangeLog come from past when there were no good VCS. So traditional ChangeLog doesn't need at all as you can get it all from: $ svn log . $ hg log ...

PHP coding standards at work: Insane, or am I?

I prefer coding standards to be logical. This is my argument for why the following set of standards are not. I need to know one of two things: (1) why I'm wrong, or (2) how to convince my team to change them. camelCase: Functions, class names, methods, and variables must be camelCase. Makes it hard to differentiate between variable...

How can I determine to which C standard is this code compliant?

In a C lab this uber simple code appears: #include <stdio.h> int suma (int a, int b) { return a+b; } int mult (int a, int b) { return a*b; } int main(void) { int a,b; printf ("Operando 1: "); scanf("%d",&a); printf("Operando 2: "); scanf("%d",&b); printf("%d+%d=%d\n",a,b...

Zend code standard, how I can check it?

What's the best way to check zend code standard? I'm thinking the PHPCS (PHP Code Sniffer) not efficiently because it not complain about php doc and many other things :( Doc: http://framework.zend.com/manual/en/coding-standard.html ...

General Programming: When a set of objects are managed by another object, what do you call it?

I'm looking for help identifying this design pattern and learning the "typical" vocabulary it uses: I'm working on a project in PHP, and I've created a thin ORM layer that saves generic objects to and from the database. There are two classes that do the work: "my_object" is basically a container for various kinds of data. After being ...

[C++] Access members directly or always use getters

Note: C++ specific question I personally find it weird/ugly when a class uses a getter to access its own member data. I know the performance impact is none but I just don't like to see all those method calls. Are there any strong arguments either way, or is it just one of those things that's personal preference and should be left to eac...

In PHP is it better to code first even if it is messy and then apply coding style?

Once the code works, we have all the time in the world to make it look good. If we need to make sudden rapid changes, then we have no choice other than messing up standard coding style. Is this way professional and widely used? Or is it better to form the habit of maintaining perfect order while coding at every point in time? ...

why C# and C++ use _<variableName> coding convention?

Hi... I have seen too much C# and C++ code where the variable naming convention seems to ask programmers to write variable names using underscore before the text of the variable. e.gr. int? _countMoney; What's the rationale supporting that convention? ...

Objective-C Coding Standards?

I've been teaching myself Objective-C for about 6 months and like using the language a lot. However I haven't found any good coding standards, so the code I write always ends up looking like an inconsistent mess. Things like naming conventions carry over just fine, but spacing, indentation and the (impossible?) 80 character line-width a...

Collection of standards in software development

Lets collect all together standards which are used in software development. I think we should follow this pattern: identification: [e.g.IEEE 123456789] title: [title in words] organisation: [organisation which released the standard] keywords: [e.g. area of the standard] description: [description as text date: [date or year it was relea...

Zend Coding Standard in Netbeans

Hello, How to configure Netbeans PHP to follow Zend Coding Standard? I'm struggling with this quite a while, and still get phpcs errors on multi line function arguments. Would you share your settings? ...

Should we use NSClassFromString before using any class in our code?

I always wonder, should we use NSClassFromString before using any built in class in our code to make is generic. Or is there any standard practice to use this. Same thing for property. Should we use valueForKey and setValue calls separately to access any property. Is it a standard practice? For example look at the below code // Screen ...

How did the convention of not puttting any whitespace in Obj-C method declarations come about?

How did it become convention that there is no whitespace in the declaration of a method? -(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath It seems like everyone does it, 90% of the examples I see, the generated templates, other people's code, etc., etc. I suspect it's just another vi/e...

Coding standards for VB.NET

Possible Duplicate: C# Coding standard / Best practices What VB.NET or C# coding standards are you using for your .NET applications? I was looking at hungarian notation and I don't think it is a good idea for a .NET application. Any suggestions? Thanks ...

MVC Model best practice - How to handle non-user-input data

So, my question is that I have a model. My model has some data that is populated based on the id passed in through the url and set into a cookie, and the rest is user input, which is validated using data annotations. The "problem" I've come across is how to handle this non user input data. Do I put it in hidden controls and thus infla...

Out parameters and pass by reference

I have joined a new group that has coding guidelines that (to me) seem dated. But just rallying against the machine without valid backup is not going to get me anywhere. So I am turning to SO to see if we can up with rational reasons for/against (hey I may be wrong in my option so both sides of the argument would be appreciated). The g...

python - why use def main()

Possible Duplicate: What does <if name==main:> do? Hi there, Just being doing some things with python, and from what i've seen (code samples/tutorials) that code uses def main() # my code here if __name__ == "__main__": main() but why, is there any reason not do def your functions at the top of the file, then just...