The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
1answer
111 views

How to name filename parameter to make clear it should contain full path? [closed]

I'm seeking vital naming of string filename parameter in parameter list used in various methods where filename with full path is expected. In many cases also UNC path can be actually supplied as full ...
1
vote
4answers
70 views

What's the proper way of dealing with a global file path?

I don't have compilable code, because the code in question depends on a large function that's irrelevant to the question, but say I have the following scenario: savePath = "C:\\..." changePath1, ...
2
votes
1answer
139 views
+50

Why is mixing plural with singular and camel case with underscores in cake php naming convention better than a simpler convention?

I have been using cake php for over a year and generally I like it but I struggle to understand the advantages of the complex naming conventions over something simpler. Cake uses plural here and ...
2
votes
3answers
258 views

invoking methods within a conditional expression

In an oft-cited (if dated) reference for C# coding standards (pdf; from Lance Hunt), the statement is made, 33. Avoid invoking methods within a conditional expression. I've not seen this ...
0
votes
1answer
52 views

exception for string literal conventions

If I'm used to use ' for string literals in PHP, would it be better if I'll stick to it in any situation or can there be exceptions when it would increase readability? example: $foo = "bar'baz"; // ...
0
votes
1answer
66 views

How should templates be named? [closed]

In D I can create templates like this: template Foo(A) { A add(A a, A b) { ... } A multiply(A a, A b) { ... } A concatenate(A a, A b) { ... } } What should a template be named ideally? ...
2
votes
4answers
290 views

Lexing: One token per operator, or one universal operator token?

When lexing, what would be the best way to tokenize operators? Would one just create a BinaryOperator token, or a separate token for every single binary operator? Examples: PlusOperator, ...
2
votes
1answer
135 views

Naming test methods in Java [closed]

Over at codereview a comment hinted that using snake_case to name test methods is a good idea. This contradicted my views and I did some research and there seem to be a lot of examples that actually ...
0
votes
1answer
91 views

How does package naming affects Android application once deployed

Are there conventions to follow when naming an application package for an Android application? I'm coding in Xamarin Studio, using .Net, so I feel far from this "com.myapp.etc" naming convention. Are ...
1
vote
1answer
143 views

What do you call a method that might do something? [closed]

Is it okay to call it void maybeGenerateUIDsAndDownload() ? Because sometimes it will generate UIDs and download but sometimes it will not do it.
4
votes
3answers
577 views

Extension method naming convention [closed]

We are using some utility methods in our company to simplify programming. So we have following string extension: public static bool IsNoE(this string s) { return string.IsNullOrEmpty(s); } ...
3
votes
2answers
601 views

Are there any industry standards that define code quality?

Our specific situation is that we are creating an agreement between ourselves and another team for shared control or use of a PHP based web application that we have been building. We have a set of ...
2
votes
1answer
125 views

How far to go when standardizing code [duplicate]

My small team and I have created a decent sized web application (~50k lines), with a fully featured API, all in Perl. As us perl hackers know.. it is easy to get sloppy. We had to port over a lot of ...
-1
votes
1answer
175 views

Naming convention of getters and setters [closed]

Given a string variable variable, for example, the convention to expose it is: public class SomeClass { public String variable = ""; public String getVariable() {return variable;} public void ...
0
votes
1answer
98 views

What is ServletUtilities?

The answer in this question suggests creating a ServletUtilities class to handle text conversion between Java strings and XML text. Generally when you create a JEE web application you put ...
1
vote
2answers
107 views

Coding convention question about AS3 duplicate variable definition

AS3's got some awkward rules about variable scope, due to its use of hoisting. I don't like pointlessly leaving a bunch of compiler warnings lying around, but it's more important to me for my code to ...
10
votes
6answers
1k 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 ...
1
vote
2answers
120 views

Should I Aggregate Web API Errors?

The Situation We are writing a REST API that performs validation up-front. The code is written such that it tries to find as many errors as possible. However, each error might correspond to a ...
4
votes
4answers
302 views

Why is the following naming guideline different between OO and non-OO languages?

I am working with a non-OO language and I'm trying to name my routines consistently. I came acrross the following guideline from Steve McConnell's Code Complete: To name a procedure, use a strong ...
2
votes
4answers
837 views

DTOs matter on ASP.NET MVC JSON Action?

I recently came across an internal project where they were using DTOs throughout the solution, and when I sat down to implement a new MVC controller with a JSON REST endpoint I decided to use an ...
4
votes
4answers
479 views

Using a function's return value as an if condition, good practice?

Do you think it is a good practice to use function return values as if conditions? I'm coding in PHP atm but it holds for many other languages. if(isTheConditionMet($maybeSomeParams)) { } or $res ...
1
vote
3answers
253 views

“state” or “status”? When should a variable name contain the word “state”, and when should a variable name instead contain the word “status”? [closed]

Reading code and discussions pertaining to code, I often see the words "state" and "status" used interchangeably, but the following tendencies seem to exist: When a variable holds a value intended ...
1
vote
5answers
399 views

What is the advantage to using a factor of 1024 instead of 1000 for disk size units?

When considering the disk space of a storage medium, normally the computer or operating system will represent it in terms of powers of 1024 - a kilobyte is 1,024 bytes, a megabyte is 1,048,576 bytes, ...
6
votes
2answers
709 views

Java convention for if/else if order

I have an if/else if structure that on some cases does nothing. From the code I have seen in my career, the "empty" case is normally left out. But when I wrote my code, it just doesn't feel right to ...
1
vote
1answer
469 views

Why are methods considered the class attributes in Python?

I read in a book that both methods and fields are considered the attributes of a class in Python. However, recently I was told by a friend of mine that methods may not be considered the attributes of ...
-1
votes
1answer
91 views

Writing data driven reflection based tests to ensure design completeness [closed]

When writing software I'm often forced to at some point to make a decision that involves a design pattern of "by convention" naming and behavioral patterns. This normally makes me feel kind of slimy ...
0
votes
0answers
43 views

BASE_DIR/URL with or without trailing slash? [duplicate]

When you have basedir/url constants or variables, do you put a trailing slash? In theory I think ultimately one should, since /path/to/dir/ is a dir while with /path/to/dir if I'm not mistaken the ...
19
votes
10answers
2k views

[YYYY].[MM].[DD].[hh][mm] vs. [major].[minor].[revision] [duplicate]

Possible Duplicate: What “version naming convention” do you use? I am currently debating between the traditional versioning convention [major].[minor].[revision] and my own, ...
25
votes
4answers
10k views

Is it better to use assert or IllegalArgumentException for required method parameters?

In Java, which is more highly recommended, and why? Both types will throw exceptions, so in that regard handling them is the same. assert is slightly shorter, but I'm not sure how much that matters. ...
6
votes
5answers
772 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: ...
2
votes
3answers
207 views

Is there an established convention for separating Windows file names in a string?

I have a function which needs to output a string containing a list of file paths. I can choose the separation character but I cannot change the data type (e.g. I cannot return a List<string> or ...
1
vote
1answer
127 views

External file (images, sounds) naming convention at Xcode

What is better naming conventions at Xcode regardng External File (images, sounds) etc? Is there any guideline from vendor Apple? As we store our projects at SVN, is there any complicity from Hosted ...
3
votes
3answers
148 views

conventions for friend methods in Perl

Perl doesn't support a friend relationship between objects, nor does it support private or protected methods. What is usually done for private methods is to prefix the name with an underscore. I ...
0
votes
1answer
503 views

Convention on model names in ruby on rails

I was doing my ER diagram for a rails application I'm about to begin with and there I have an entity called Class News so I'd have a model ClassNew but I don't know if I will have problems in the ...
1
vote
4answers
615 views

CamelCase issue (PList or Plist)

Ok, I understand what CamelCase is. This question is relating to how to CamelCase the shortened version of Property List (PList). I am asking this because I am working on a PList parser in C# and ...
2
votes
2answers
131 views

Assignments in mock return values

(I will show examples using php and phpunit but this may be applied to any programming language) The case: let's say we have a method A::foo that delegates some work to class M and returns the value ...
1
vote
9answers
1k views

When calculating how many days between 2 dates, should you include both dates in the count, or neither, or 1?

I am trying to make an algorithm that counts the days between two dates, e.g. between 3/1/2012 and 3/2/2012. What is the correct answer, or the most popular choice? Should be the one I use? In ...
5
votes
9answers
794 views

Should the most recent date be named 'start' or 'end'?

So I have a function that takes two dates. The SQL query gets all the results between the two dates. I currently have my function setup as such: function myFunc(start, end) Where start is the ...
10
votes
5answers
4k 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 ...
16
votes
3answers
892 views

Why do trees grow downward?

Why do trees grow downward in computer science? I have a feeling it goes back to a printer, and that a program traversing a tree first prints the root, and uses the notion of a bottomless stack of ...
2
votes
3answers
128 views

Should I care about Junit redundancy when using setUp() with @Before annotation?

Even though developers have switched from junit 3.x to 4.x I still see the following 99% of the time: @Before public void setUp(){/*some setup code*/} @After public void tearDown(){/*some clean up ...