conventions

C/C++ function/method decoration

DISCLAIMER: I haven't done C++ for some time... Is it common nowadays to decorate C/C++ function/method declarations in order to improve readability? Crude Example: void some_function(IN int param1, OUT char **param2); with the macros IN and OUT defined with an empty body (i.e. lightweight documentation if you will in this example). ...

2nd or 3rd person comments?

Do you write comments in 2nd or 3rd person? // go somewhere and do something (2nd person comment) or // goes somewhere and does something (3rd person comment) ...

iPhone UITableView and CoreData conventions

Hi folks, I've got a question on the conventional way to structure something similar to the following: I have a screen which has a single line of data followed by a list of other data - and so I thought using a grouped UITableView with a single row'd section for the top and the rest in the section below would work well. As I'm using C...

Typing methods with `id`

In Objective-C, I usually see methods that return a dynamically typed object defined as follows: - (id)someMethod:(id)someParameter; I know that I can do this, though, as well: - someMethod:someParameter; Interestingly, I see the latter convention in more core-level foundation classes, but everyone else seems to use the first. Sinc...

UI Convention: Shortcut key for application exit?

Is there a convention for the shortcut keys for application exit? Some applications uses Alt+X some others use Ctrl+ X and Ctrl+Q. Applications like FF and IE doesnot assign a shortcut at all. So is there any accepted convention for that? Note:Am talking about Windows here. ...

Django: Recommended placement of template files?

It seems that Django doesn't have a convention on the placement of template files. What would be the most logical, preferred placement? (Since Django stresses the interoperability of apps, I assume that the "best" placement would be somewhere under /app/; maybe /app/templates/?) ...

How to hand over varaibles to a function? With an array or variables?

When I try to refactor my functions, for new needs, I stumble from time to time about the crucial question: shall I add an other variable with a default value? Or shall I user only one array, where I´m able to add an additional variable without breaking the API? ...

Case Conventions in wpf using MVVM

Is there a standard for case and naming conventions in wpf/mvvm that differs from C#? I am accustomed to camelCase with the first character being lower case for private and upper case for public methods/properties. In the sample MVVM code I have been examining I have seen a lot of leading _ characters, is this a holdover from another p...

(Conventions) C# Class names

Hello, I'm not too quite sure about what i should do about a grouped set of classes. My situation: I have 11 classes that relate only to the class Character.cs, but all of those classes (including Character.cs and CharacterManager.cs) are within the namespace Models.Characters. Which is the more "proper" or preferred way of naming ...

Self-Referential ManyToMany Convention in CakePHP

I have an existing data model where I can rename things freely to match CakePHP's conventions. I have a type of graph node, where a node can have an arbitrary number of child nodes and an arbitrary number of parent nodes (uni-directional relationships). Here's the table of nodes, following CakePHP's conventions: Table: nodes Column: no...

Java Architecture - Question about ActionListener Conventions

I am making a user interface which shows graphs and manipulates graphs. The class extends JFrame implements ActionListener. The ActionListener then calls different classes to manipulate graphs depending on the action. This worked while the class had few ActionListeners; however, now the class is becoming unmanageable. I know that in the...

Displaying topic specific tweets in Twitter

I'd like to integrate Twitter into my app but keep the tweets specific to the app topic. For example, if the app is about recipes, all tweets on the built in Twitter client will be about recipes. Basically acting like a chat client about recipes. However, I don't think Twitter works that way. You basically follow someone (say the a...

How do I add Check Constraints in an AttributePropertyConvention in Fluent NHibernate?

First time journey with (Fluent) NHibernate. What I am trying to do is to add conventions for the attributes in System.ComponentModel.DataAnnotations. How would I add a Check Constraint for the attribute.MinimumLength? Here is my code so far: Thanks! using System.ComponentModel.DataAnnotations; using FluentNHibernate.Conventions; usin...

What is the Fluent NHibernate Convention for value object list

I'm trying to figure out what the convention would be for a value object list, in this case an IList. Here a code fragment for my domain model: public class RegionSetting : Entity { public virtual bool Required { get; set; } public virtual string Name { get; set; } public virtual IList<string> Options { get; set; } } My au...

include boost header file using "" or <>

Why tuple documentation for example says to use: #include "boost/tuple/tuple.hpp" and not #include <boost/tuple/tuple.hpp> I know that it's almost not probably my code will have also boost/tuple/tuple.hpp, but using include <> states explicitly not to look in the curent directory. So what is the reason? ...

Is there any technical reason to use or not to use var in C# when the type is known?

It seems that more and more C# code I read uses the var type identifier: foreach (var itemChange in ItemChanges) { //... } instead of explicitly stating the type: foreach (ItemChange itemChange in ItemChanges) { //... } even when the type is known. I am still using the latter explicit version just because I think someone r...

Python import mechanics

I have two related Python 'import' questions. They are easily testable, but I want answers that are language-defined and not implementation-specific, and I'm also interested in style/convention, so I'm asking here instead. 1) If module A imports module B, and module B imports module C, can code in module A reference module C without an...

Architecture and packages

In a layered architecture, you have a presentation layer, logic layer and data layer. So far, I've been grouping classes into domain, service and dao packages. This represents the model with POJOs/JPA Entities, the business logic and data access layer. I suppose the domain and services could be grouped to form the logic layer but that...

Proper use of Arraylist and Java Generics vs Vectors

I have been using vectors in the past and am very familiar with them. I have heard that ArrayLists are faster and more flexible. I am new to using ArrayLists and Java Generics. I am currently using them as follows and receiving a warning about parametrization (Which I thought I did by declaring them <String>. ArrayList<String> arrayList...

Good Haskell coding standards

Could someone provide a link to a good coding standard for Haskell? I've found this and this, but they are far from comprehensive. Not to mention that the HaskellWiki one includes such "gems" as "use classes with care" and "defining symbolic infix identifiers should be left to library writers only." ...