Questions tagged [convention]

A convention is a set of agreed, stipulated, or generally accepted norms. It typically helps common efficiency or understanding but is not required, as opposed to a strict standard or protocol. In programming, a typical kind of convention is the coding convention which stipulates how programmers should format and style their programs.

Here are some examples of conventions that affect programming:

  • Coding style: how the source code is formatted (indentation & spacing, location of braces, ordering of methods/functions, etc.). This helps programmers to read and understand the code more quickly, find bugs more easily.
  • File naming: some programs expect the files they process to be named a certain way. For example, the ant command assumes by default that the build file is names build.xml, which allow developers to omit the file name in the command line.
  • File structure: programmers are often used to particular way to organize the files, that depends on the language / technology. This allows to read / browse through an unknown code base more easily. Even compilers of some language may expect files to be organized by default in a conventional way. For example, maven expects source files to be in a src directory and binary files in a target directory.
  • Variable naming: some variables with given semantics are conventionally named. For example, for loop variable are usually named i, j, k, etc.; and Cartesian coordinates are usually named x, y and z.
353 questions
0
votes
3 answers

PHP OOP coding conventions

I'm brand new at OOP PHP and i would like to get as many of the coding conventions right as fast as possible. I made this tiny guestbook script, and i would like to know if there's anything not done as it should. Index.php:
Patrick Reck
  • 11,246
  • 11
  • 53
  • 86
0
votes
1 answer

What is the convention for where to place certain types of certs?

I am trying to understand how to properly programatically install CA, server and client SSL certificates on windows. I have been unable to discover any over-arching scheme or convention to use when searching for a particular type of certificate. …
Sanford Staab
  • 239
  • 2
  • 10
0
votes
1 answer

Table naming conventions for ref tables vs storage tables

By ref table I'm referring to a kind of entity 'type' table, and by storage table I'm referring to a table that stores a lot of changing information. For example: I have a 'user' table named as such, which is a storage table since it can hold an…
Flosculus
  • 6,880
  • 3
  • 18
  • 42
0
votes
1 answer

Proper way to arrange the jquery event binding in large applications

While working in highly interactive and animated client side web applications, we highly rely on jQuery libraries and use their events heavily. In large enterprise applications, this results in a big connection of the events, their callbacks and…
0
votes
1 answer

Events convention

I'm making an XNA game and I have a question about the convention for events. I made a menu which has buttons, those buttons have 3 events naimly: onClick, onMouseEnter and onMouseLeave. Atm my code looks like this : public static void…
Svexo
  • 523
  • 1
  • 4
  • 15
0
votes
1 answer

Where to put the memcache in a ZF project?

I am trying to adopt memcached in my project which is built under ZendFrame. Firstly I create a Memcached class in the library(it seems a bit unecessary as it pretty much just encapsulates the functions what memcache offers) Then I am wondering…
zhaopeng
  • 55
  • 7
0
votes
1 answer

are validation annotations deprecated in strut2?

I read from here https://cwiki.apache.org/WW/annotations.html that Annotation are deprecated and changed by Conventions plugin. I noted that documentation that Convention plugin still use @Actions or @Interceptor anottations but they use…
molavec
  • 8,848
  • 1
  • 27
  • 22
0
votes
1 answer

What's the meaning of return by reference C array?

I used -[NSDictionary getObjects:andKeys:] method first time, and I discovered there's no policy on description should I free the memory or not. I think * Returns by reference C arrays* means it's just a reference to internal memory block, so I…
eonil
  • 83,476
  • 81
  • 317
  • 516
0
votes
1 answer

What's the actual meaning of the struts.convention.action.mapAllMatches in the struts2 convention plugin

What's the actual meaning of the struts.convention.action.mapAllMatches in the struts2 convention plugin
gamein
  • 43
  • 5
-1
votes
1 answer

Redis sorted sets

I have a list of Ids from a table that I want to store in a Redis sorted set. Each of these ids has a date and entity associated with it. The plan is to use the id as the score and allow Redis to sort them accordingly. When it is time for lookup I…
-1
votes
1 answer

Python - Accessing instance attribute without `self.` inside __init__

My question is largely one of style or convention; however, it could have consequences which are not obvious to me that would effect which style is used. If I have a class where instance attributes are defined by parameters to __init__, is it…
Johndt
  • 4,187
  • 1
  • 23
  • 29
-1
votes
1 answer

class URLfinder or class URLFinder?

I was wondering what the naming convention is in instances where you pretty much have to use an acronym in the class name. I read the oracle documentation here but it did not offer much help. Usually I name classes starting with an uppercase…
ForeverStudent
  • 2,487
  • 1
  • 14
  • 33
-1
votes
2 answers

Including file known to already be included

What's the convention when including a file you know is already included by another include? Example: Class Base is declared in "base.h" and has a few child classes. Base has a virtual method foo(Bar& bar) and therefore includes "bar.h". From a…
Agrim Pathak
  • 3,047
  • 4
  • 27
  • 43
-1
votes
3 answers

Class Names in C# (English vs Intellisense)

I'm using Visual Studio 2013 to write C# code. How should I name my classes? In a "English-friendly" way, or in a way thats more IntelliSense- friendly. For instance, I have a interface called IColorComparer. And a few classes that implement that…
Trauer
  • 1,981
  • 2
  • 18
  • 40
-1
votes
1 answer

GitHub convention for hosting chunks of code?

I am a noob in GitHub and open source social programming. My GitHub account is less than a month old. To experiment with stuff, I would like to host chunks of code blah blah blah tldr ok, so here's the thing 1. For hosting loose chunks of code that…
Noobification
  • 319
  • 1
  • 14
1 2 3
23
24