Questions tagged [conventions]

A generic tag covering any accepted method of doing things, which could include naming, spacing, coding, commenting, etc.

A generic tag covering any accepted method of doing things, which could include naming, spacing, coding, commenting, etc.

1143 questions
64
votes
5 answers

How to signal "not implemented yet"?

In the initial drafting of a new gem I need to leave some method implementations empty ( to be implemented in the next ) Therefore, I would like to signal a "not implemented yet" exception I'm wondering if there is a best practice or standard…
Franco Rondini
  • 10,841
  • 8
  • 51
  • 77
63
votes
4 answers

Conventions for app.js, index.js, and server.js in node.js?

In node.js, it seems I run into the same 3 filenames to describe the main entry point to an app: When using the express-generator package, an app.js file is created as the main entry point for the resulting app. When creating a new package.json…
youngrrrr
  • 3,044
  • 3
  • 25
  • 42
63
votes
5 answers

What is the advantage of the 'src/main/java'' convention?

I've noticed that a lot of projects have the following structure: Project-A bin lib src main java RootLevelPackageClass.java I currently use the following convention (as my projects are 100%…
Chris
  • 4,450
  • 3
  • 38
  • 49
58
votes
5 answers

When to use ellipsis after menu items

In pretty much all applications that have a menu bar, some of the items have an ellipsis (...) after them, and some don't. Is there a well known convention on when to put that ellipsis there and when not to? When do you do it? Do you do it? I have…
Svish
  • 152,914
  • 173
  • 462
  • 620
58
votes
9 answers

JavaScript braces on new line or not?

At work, we place braces on the next line, but at home, I do the opposite. Which one do you prefer? (K&R vs OTBS) function something() { // ... } function something() { // ... } A lot of JavaScript libraries seem to use the OTBS (one true…
Tower
  • 98,741
  • 129
  • 357
  • 507
55
votes
4 answers

Standard File Naming Conventions in Ruby

For a file containing the given class, SomeCoolClass, what would be the proper or standard filename? 1. somecoolclass.rb 2. some_cool_class.rb 3. some-cool-class.rb 4. SomeCoolClass.rb or some other variation? I noticed in the Ruby stdlib,…
Clint Pachl
52
votes
2 answers

What are common conventions for using namespaces in Clojure?

I'm having trouble finding good advice and common practices for the use of namespaces in Clojure. I realize that namespaces are not the same as Java packages so I'm trying to tease out the conventions in Clojure, which seem surprisingly hard to…
Alex Miller
  • 69,183
  • 25
  • 122
  • 167
52
votes
5 answers

What's the convention for java package names without a domain association?

I can't find a Q/A on SO that answers my exact question, so I figure I'd post it and see what comes back. As far as the naming convention goes for Java packages, I understand that it's supposed to be the reverse domain name: com.whatever.stuff and I…
Mike
  • 47,263
  • 29
  • 113
  • 177
51
votes
5 answers

Code line wrapping - how to handle long lines

I'm facing a particular line that is 153 characters long. Now, I tend to break things after 120 characters (of course, this is heavily dependent on where I am and the local conventions.) But to be honest, everywhere I break the line just makes it…
corsiKa
  • 81,495
  • 25
  • 153
  • 204
50
votes
10 answers

Named numbers as variables

I've seen this a couple of times recently in high profile code, where constant values are defined as variables, named after the value, then used only once. I wondered why it gets done? E.g. Linux Source (resize.c) unsigned five = 5; unsigned seven =…
Jack0x539
  • 616
  • 6
  • 12
50
votes
24 answers

How to name variables

What rules do you use to name your variables? Where are single letter vars allowed? How much info do you put in the name? How about for example code? What are your preferred meaningless variable names? (after foo & bar) Why are they spelled "foo"…
BCS
  • 75,627
  • 68
  • 187
  • 294
49
votes
4 answers

Javascript/DOM event name convention

When I started doing web development, I realized Javascript event names were all in lower case with no separators, i.e. "mousedown", "mouseup", etc. And when working with the jQuery UI library, I noticed they also use the same convention; i.e.…
roy riojas
  • 2,406
  • 1
  • 28
  • 30
48
votes
2 answers

Summary of Ruby on Rails fundamental concepts

Being new to Rails, I am having a difficult time finding a website or reference that gives a run down summary of Ruby on Rails. I understand MVC, ActiveRecord, and that sort of stuff on a basic level, but I am having a hard time understanding some…
iwasrobbed
  • 46,496
  • 21
  • 150
  • 195
47
votes
3 answers

Directory structure for TypeScript projects

What would be an idiomatic directory structure for a TypeScript project? I would like the following features in such a structure: Separate directories for TypeScript source code and transpiled JavaScript Separate directories for project source…
codematix
  • 1,317
  • 1
  • 16
  • 30
47
votes
2 answers

Fail vs. raise in Ruby : Should we really believe the style guide?

Ruby offers two possibilities to cause an exception programmatically: raise and fail, both being Kernel methods. According to the documents, they are absolutely equivalent. Out of a habit, I used only raise so far. Now I found several…
user1934428
  • 19,864
  • 7
  • 42
  • 87
1 2
3
76 77