Hi everybody,
Simple question : do you prefix your PHP classes (for example your library classes) with the name of your company ?
Example : Zend prefix everything with "Zend_", but that's normal because this is a framework (so they want to avoid conflicts).
Should I do the same for the library classes of my company ? Will I ever get co...
Possible Duplicates:
Using this in front of member variables in C++
Is excessive use of this in C++ a code smell
Years ago, I got in the habit of using this-> when accessing member variables. I knew it wasn't strictly necessary, but I thought it was more clear.
Then, at some point, I started to prefer a more minimalistic st...
Can someone explain the format for ASP.NET MVC controllers? They look like this:
public class ProductsController : Controller
{
//
// GET: /Products/Edit/34
public ActionResult Edit(int id)
{
// ...
}
}
Why don't they follow the standard C#-notation with three slashes and XML markup? And why the empty line...
HI, I have a simple question, I've asked 3-4 different people and have had different answers from each of them.
Which code layout is better and used more?
does it really matter as long as it's consistent?
Which is seen as better practice in the world of working as a programmer?
Eg
A)
for(int i=0;i<8;i++)
{
for(int p=0;p<8;p++)...
As C# lacks support for freestanding functions, I find it hard to find a place to put conversion functions. For example, I'd like to convert an enum to a number. In C++, I would make the following freestanding function for this:
UINT32 ConvertToUint32(const MyEnum e);
How can I elegantly do this in C#? Should I make a dummy static cla...
This is an subjective question, I need your feels and thoughts about coding standards, and formatting practices.
PHP Zend coding standard requires to write multiline function calls like this:
$returnedValue = $object->longMethodName(
$argument1,
$otherArgument,
42
);
I think the following approach is more readable:
$retu...
I feel like this is a stupid question, but I can't think of a good way to do it.
What I want to do is create a sine wave LUT at compile time or run time. Ideally compile time, but run time is fine if it is much easier to code. However, I want this static object to be accessible by everything that includes its library (I don't want to ...
Many python IDE's will start you with a template like:
print 'hello world'
That's not enough... So here's my skeleton code to get this question started:
My Module Skeleton, Short Version:
#!/usr/bin/env python
"""
Module Docstring
"""
#
## Code goes here.
#
def test():
"""Testing Docstring"""
pass
if __name__=='__main__'...
I would like to know about books that talk about design issues like when to use namespaces and other coding standards to write good quality efficient C++ code. One that talks about Code testing will also be appreciated.
Thanks
...
Suppose you are calling a function, where there's clearly a need to break down the statement into few lines, for readability's sake. However there are at least two way to do it:
Would you do this:
return render(request, template,
{
'var1' : value1,
'var2' : value2,
'var3' : ...
Though it's debatable, I've heard the majority of CSS developers prefer multi-line because of the ease of which a property can be found within the CSS file. But doesn't this make the CSS file bigger and less readable on the whole? I think single-line lets you scan the CSS file much faster. Any thoughts?
...
Are there any reasons, apart from subjective visual perception and cases where you have multiple statements on the same line, to use semicolon at the end of statements in Javascript?
...
Eclipse and MyEclipse create new Java files with an extra blank line after the last closing brace by default. I think CodeWarrior did the same thing a few years back, and that some people leave such blank lines in their code either by intention or laziness. So, this seems to be at least a moderately widespread behavior.
As a former hu...
When programming against a fluent API or just using method-chaining, I've seen the style mostly like this:
var obj = objectFactory.CreateObject()
.SetObjectParameter(paramName, value)
.SetObjectParameter(paramName, value)
.DoSomeTransformation();
What is the reasoning behind putting the dot at the beginning of the line ins...
I was wondering if there is a standard practice regarding the use of labels in Lisp. I've been messing around with a Lisp implementation of the algorithm described in the first answer here http://stackoverflow.com/questions/352203/generating-permutations-lazily
My current version uses labels to break out portions of functionality.
(de...
Hi,
I'm always struggling with something like the following Java example:
String breads[] = {"Brown", "White", "Sandwich"};
int count[] = new int[breads.length];
for (int i = 0; i < ****; i++)
{
// Prompt the number of breads
}
****: which array.length should I choose?
I can choose between breads.length and count.length
I know it ...
I have always written my boolean expressions like this:
if (!isValid) {
// code
}
But my new employer insists on the following style:
if (false == isValid) {
// code
}
Is one style preferred, or standard?
...
Hi,
I'm looking for an automatic way in eclipse to reformat curly braces to K&R style, eliminating braces for single statements if, etc. Is there such a way?
Thanks.
...
Sometimes I have to write code that alternates between doing things and checking for error conditions (e.g., call a library function, check its return value, keep going). This often leads to long runs where the actual work is happening in the conditions of if statements, like
if(! (data = (big_struct *) malloc(sizeof(*data)))){
//re...
Hi,
I want to call a validation method inside a shared gwt class that i have created to store the validation logic (for user entered text fields)
suggestBox.addKeyUpHandler( new KeyUpHandler() {
public void onKeyUp(KeyUpEvent event) {
if (event.getNativeKeyCode() == KeyCodes.KEY_ENTER) {
...