Search Results

Search found 1399 results on 56 pages for 'naming'.

Page 2/56 | < Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >

  • What are the disadvantages of naming things alphabetically?

    - by JoJo
    Let me give you an example of how I name my classes alphabetically: Car CarHonda (subclass of Car) CarHondaAccord (subclass of CarHonda) There are two reasons why I put the type of the class earlier in its name: When browsing your files alphabetically in a file explorer, related items appear grouped together and parent classes appear above child classes. I can progressively refine auto-complete in my IDE. First I type the major type, then the secondary type, and so on without having to memorize what exactly I named the last part of the thing. My question is why do I hardly see any other programmers do this? They usually name things in reverse or some random order. Take the iOS SDK for example: UIViewController UITableViewController What are the disadvantages of my naming convention and the advantages of their convention?

    Read the article

  • What "version naming convention" do you use?

    - by rjstelling
    Are different version naming conventions suited to different projects? What do you use and why? Personally, I prefer a build number in hexadecimal (e.g 11BCF), this should be incremented very regularly. And then for customers a simple 3 digit version number, i.e. 1.1.3. 1.2.3 (11BCF) <- Build number, should correspond with a revision in source control ^ ^ ^ | | | | | +--- Minor bugs, spelling mistakes, etc. | +----- Minor features, major bug fixes, etc. +------- Major version, UX changes, file format changes, etc.

    Read the article

  • Naming convention: field starting with "m" or "s"

    - by Noya
    Hope this question hasn't posted yet... I saw lot of code (for example some Android source code) where fields name start with a "m" while static fields start with "s" Example (taken from Android View class source): private SparseArray<Object> mKeyedTags; private static int sNextAccessibilityViewId; I was wondering what "m" and "s" stand for... maybe is "m" mutable and "s" static? Since it seems that is a largely adopted pattern do you know if there some literature about this kind of naming convention?

    Read the article

  • Need help with the naming convention for an incremental variable [closed]

    - by iStryker
    I am using a voting module, that allows you vote either up or down [or reset]. If you vote up, the value is +1. If you vote down, the value is -1. If you vote up then down, the value is -1. I want to extend this module to allow you to vote multiple times, and the votes to be incremental. Examples Up, Up = +1, +1 = +2 Up, Up, Down = +1, +1, -1 = +1 I want to create a new boolean variable. If FALSE/NULL then use the old system +1/-1. If TRUE, voting will be incremental. What should be the name of this variable be? I feel 'incremental' is not the correct name. This module is part of an open-source project and is used on 3,177+ websites, so I want to get the naming convention right. Naturally, I'll be setting an upper and lower limit the variable be. [ie 5 & 0] Side-question: Is there a mathematics term to describe something being either +1/-1?

    Read the article

  • What character can be safely used for naming files on unix/linux?

    - by Eric DANNIELOU
    Before yesterday, I used only lower case letters, numbers, dot (.) and underscore(_) for directories and file naming. Today I would like to start using more special characters. Which ones are safe (by safe I mean I will never have any problem)? ps : I can't believe this question hasn't been asked already on this site, but I've searched for the word "naming" and read canonical questions without success (mosts are about computer names). Edit #1 : (btw, I don't use upper case letters for file names. I don't remember why. But since a few month, I have production problems with upper case letters : Some OS do not support ascii!) Here's what happened yesterday at work : As usual, I had to create a self signed SSL certificate. As usual, I used the name of the website for the files : www2.example.com.key www2.example.com.crt www2.example.com.csr. Then comes the problem : Generate a wildcard self signed certificate. I did that and named the files example.com.key example.com.crt example.com.csr, which is misleading (it's a certificate for *.example.com). I came back home, started putting some stars in apache configuration files filenames and see if it works (on a useless home computer, not even stagging). Stars in file names really scares me : Some coworkers/vendors/... can do some script using rm find xarg that would lead to http://www.ucs.cam.ac.uk/support/unix-support/misc/horror, and already one answer talks about disaster. Edit #2 : Just figured that : does not need to be escaped. Anyone knows why it is not used in file names?

    Read the article

  • Naming booleans

    - by wrongusername
    If I only want to check if something is impossible or not (i.e., I will not be using something like if(possible)), should I name the boolean notPossible and use if(notPossible) or should I name it possible and use if(!possible) instead? And just to be sure, if I also have to check for whether it is possible, I would name the boolean possible and use if(possible) along with else, right?

    Read the article

  • naming a function that exhibits "set if not equal" behavior

    - by Chris Sears
    This might be an odd question, but I'm looking for a word to use in a function name. I'm normally good at coming up with succinct, meaningful function names, but this one has me stumped so I thought I'd appeal for help. The function will take some desired state as an argument and compare it to the current state. If no change is needed, the function will exit normally without doing anything. Otherwise, the function will take some action to achieve the desired state. For example, if wanted to make sure the front door was closed, i might say: my_house.<something>_front_door('closed') What word or term should use in place of the something? I'd like it to be short, readable, and minimize the astonishment factor. A couple clarifying points... I would want someone calling the function to intuitively know they didn't need to wrap the function an 'if' that checks the current state. For example, this would be bad: if my_house.front_door_is_open(): my_house.<something>_front_door('closed') Also, they should know that the function won't throw an exception if the desired state matches the current state. So this should never happen: try: my_house.<something>_front_door('closed') except DoorWasAlreadyClosedException: pass Here are some options I've considered: my_house.set_front_door('closed') my_house.setne_front_door('closed') # ne=not equal, from the setne x86 instruction my_house.ensure_front_door('closed') my_house.configure_front_door('closed') my_house.update_front_door('closed') my_house.make_front_door('closed') my_house.remediate_front_door('closed') And I'm open to other forms, but most I've thought of don't improve readability. Such as... my_house.ensure_front_door_is('closed') my_house.conditionally_update_front_door('closed') my_house.change_front_door_if_needed('closed') Thanks for any input!

    Read the article

  • The curious case(s) of the Microsoft product naming department

    - by AaronBertrand
    A long time ago, in a galaxy far, far away... Okay, it was here on earth, a little over 5 years ago. With SQL Server 2005, Microsoft introduced a very useful feature called the DAC. DAC stands for "dedicated administrator connection"... you can read about it here , but essentially, it allows you a single connection into the server with priority resource allocation - so you can actually get in and kill a rogue process that is otherwise taking over the server. On its own this was a fine acronym choice,...(read more)

    Read the article

  • Naming methods that do the same thing but return different types

    - by Konstantin Ð.
    Let's assume that I'm extending a graphical file chooser class (JFileChooser). This class has methods which display the file chooser dialog and return a status signature in the form of an int: APPROVE_OPTION if the user selects a file and hits Open /Save, CANCEL_OPTION if the user hits Cancel, and ERROR_OPTION if something goes wrong. These methods are called showDialog(). I find this cumbersome, so I decide to make another method that returns a File object: in the case of APPROVE_OPTION, it returns the file selected by the user; otherwise, it returns null. This is where I run into a problem: would it be okay for me to keep the showDialog() name, even though methods with that name — and a different return type — already exist? To top it off, my method takes an additional parameter: a File which denotes in which directory the file chooser should start. My question to you: Is it okay to call a method the same name as a superclass method if they return different types? Or would that be confusing to API users? (If so, what other name could I use?) Alternatively, should I keep the name and change the return type so it matches that of the other methods? public int showDialog(Component parent, String approveButtonText) // Superclass method public File showDialog(Component parent, File location) // My method

    Read the article

  • Why PHP Function Naming so Inconsistent?

    - by Shamim Hafiz
    I was going through some PHP functions and I could not help notice the following: <?php function foo(&$var) { } foo($a); // $a is "created" and assigned to null $b = array(); foo($b['b']); var_dump(array_key_exists('b', $b)); // bool(true) $c = new StdClass; foo($c->d); var_dump(property_exists($c, 'd')); // bool(true) ?> Notice the array_key_exists() and property_exists() function. In the first one, the property name(key for an array) is the first parameter while in the second one it is the second parameter. By intuition, one would expect them to have similar signature. This can lead to confusion and the development time may be wasted by making corrections of this type. Shouldn't PHP, or any language for that matter, consider making the signatures of related functions consistent?

    Read the article

  • Naming boolean field that is a verb

    - by dnhang
    In Java, by convention getter and setter for boolean fields will be isField() and setField(). This works perfectly fine with field names that are adjectives like active, visible, closed, etc. But how do I name a field that has meaning of a verb, like haveChildren? Add _ing to the verb (havingChildren), maybe? Edit: to clarify, I don't have control of the method names (getter and setter), they are auto-generated by the IDE. So what I need is an appropriate field name so that when the IDE generate a getter for it, it make senses. For example, hasChildren is a perfect field name, but when the IDE generate the getter for the field it would be isHasChildren. How do I solve this?

    Read the article

  • Naming methods that perform HTTP GET/POST calls?

    - by antonpug
    In the application I am currently working on, there are generally 3 types of HTTP calls: pure GETs pure POSTs (updating the model with new data) "GET" POSTs (posting down an object to get some data back, no updates to the model) In the integration service, generally we name methods that post "postSomething()", and methods that get, "getSomething()". So my question is, if we have a "GET" POST, should the method be called: getSomething - seeing as the purpose is to obtain data postSomething - since we are technically using POST performSomeAction - arbitrary name that's more relevant to the action What are everyone's thoughts?

    Read the article

  • Naming a class that processes orders

    - by p.campbell
    I'm in the midst of refactoring a project. I've recently read Clean Code, and want to heed some of the advice within, with particular interest in Single Responsibility Principle (SRP). Currently, there's a class called OrderProcessor in the context of a manufacturing product order system. This class is currently performs the following routine every n minutes: check database for newly submitted + unprocessed orders (via a Data Layer class already, phew!) gather all the details of the orders mark them as in-process iterate through each to: perform some integrity checking call a web service on a 3rd party system to place the order check status return value of the web service for success/fail email somebody if web service returns fail constantly log to a text file on each operation or possible fail point I've started by breaking out this class into new classes like: OrderService - poor name. This is the one that wakes up every n minutes OrderGatherer - calls the DL to get the order from the database OrderIterator (? seems too forced or poorly named) - OrderPlacer - calls web service to place the order EmailSender Logger I'm struggling to find good names for each class, and implementing SRP in a reasonable way. How could this class be separated into new class with discrete responsibilities?

    Read the article

  • Pure virtual or abstract, what's in a name?

    - by Steven Jeuris
    While discussing a question about virtual functions on Stack Overflow, I wondered whether there was any official naming for pure (abstract) and non-pure virtual functions. I always relied on wikipedia for my information, which states that pure and non-pure virtual functions are the general term. Unfortunately, the article doesn't back it up with a origin or references. To quote Jon Skeet's answer to my reply that pure and non-pure are the general term used: @Steven: Hmm... possibly, but I've only ever seen it in the context of C++ before. I suspect anyone talking about them is likely to have a C++ background :) Did the terms originate from C++, or were they first defined or implemented in a earlier language, and are they the 'official' scientific terms?

    Read the article

  • What is the convention for the star location in reference variables?

    - by Brett Ryan
    Have been learning Objective-C and different books and examples use differing conventions for the location of the star (*) when naming reference variables. MyType* x; MyType *y; MyType*z; // this also works Personally I prefer the first option as it illustrates that x is a "pointer type of MyType". I see the first two used interchangeably, and sometimes in the same code I've seen differing uses of both. I want to know what is the most common convention It's been a very long time since I've programmed in C (15 years) so I can't remember if all variants are legal for C also or if this is Objective-C specific. I'd prefer answers which state why one is better than the other, as how I explained how I read it above.

    Read the article

  • How important is to avoid name collisions between libraries belonging to different domains?

    - by Sergio
    I have written a small open source Java library for facilitating conversions between different types of objects (in the style of Google's gson, but quite more general). It seems to me that a nice natural name for my library is JConverter, after browsing in the web to see if another library with the same name already exists, I found a library with the same name for Joomla. My concrete question is: How important is to avoid naming collisions when creating an open source library if an existing library with the chosen name already exists in a complete different domain ? (in my concrete case, these are libraries even implemented for different languages).

    Read the article

  • Scientific evidence that supports using long variable names instead of abbreviations?

    - by Sebastian Dietz
    Is there any scientific evidence that the human brain can read and understand fully written variable names better/faster than abbreviated ones? Like PersistenceManager persistenceManager; in contrast to PersistenceManager pm; I have the impression that I get a better grasp of code that does not use abbreviations, even if the abbreviations would have been commonly used throughout the codebase. Can this individual feeling be backed up by any studies?

    Read the article

  • Are very short or abbreviated method/function names that don't use full words bad practice or a matter of style.

    - by Alb
    Is there nowadays any case for brevity over clarity with method names? Tonight I came across the Python method repr() which seems like a bad name for a method to me. It's not an English word. It apparently is an abbreviation of 'representation' and even if you can deduce that, it still doesn't tell you what the method does. A good method name is subjective to a certain degree, but I had assumed that modern best practices agreed that names should be at least full words and descriptive enough to reveal enough about the method that you would easily find one when looking for it. Method names made from words help let your code read like English. repr() seems to have no advantages as a name other than being short and IDE auto-complete makes this a non-issue. An additional reason given in an answer is that python names are brief so that you can do many things on one line. Surely the better way is to just extract the many things to their own function, and repeat until lines are not too long. Are these just a hangover from the unix way of doing things? Commands with names like ls, rm, ps and du (if you could call those names) were hard to find and hard to remember. I know that the everyday usage of commands such as these is different than methods in code so the matter of whether those are bad names is a different matter.

    Read the article

  • Python lower_case_with_underscores style convention: underscores not popular?

    - by squirrel
    PEP8 recommends using lowercase, with words separated by underscores as necessary to improve readability for variable and function names. I've seen this interpreted as lower_case_with_underscores by most people, although in practice and in Python's native methods it seems like lowercasewithoutunderscores is more popular. It seems like following PEP8 strictly would be awkward since it seems to suggest mixing both lower_case_with_underscores and lowercasewithoutunderscores, which would be inconsistent. What is your interpretation of PEP8's variable names, and what do you actually use in practice? (Personally, I like lowerCamelCase as a compromise between readability and ease of typing.)

    Read the article

  • Are short abbreviated method/function names that don't use full words bad practice or a matter of style?

    - by Alb
    Is there nowadays any case for brevity over clarity with method names? Tonight I came across the Python method repr() which seems like a bad name for a method to me. It's not an English word. It apparently is an abbreviation of 'representation' and even if you can deduce that, it still doesn't tell you what the method does. A good method name is subjective to a certain degree, but I had assumed that modern best practices agreed that names should be at least full words and descriptive enough to reveal enough about the method that you would easily find one when looking for it. Method names made from words help let your code read like English. repr() seems to have no advantages as a name other than being short and IDE auto-complete makes this a non-issue. An additional reason given in an answer is that python names are brief so that you can do many things on one line. Surely the better way is to just extract the many things to their own function, and repeat until lines are not too long. Are these just a hangover from the unix way of doing things? Commands with names like ls, rm, ps and du (if you could call those names) were hard to find and hard to remember. I know that the everyday usage of commands such as these is different than methods in code so the matter of whether those are bad names is a different matter.

    Read the article

  • How to name a method that both performs a task and returns a boolean as a status?

    - by Limbo Exile
    If there is a method bool DoStuff() { try { // doing stuff... return true; } catch (Exception ex) { return false; } } should it rather be called IsStuffDone()? Both names could be misinterpreted by the user: If the name is DoStuff() why does it return a boolean? If the name is IsStuffDone() it is not clear whether the method performs a task or only checks its result. Is there a convention for this case? Or an alternative approach, as this one is considered flawed? For example in languages that have output parameters, like C#, a boolean status variable could be passed to the method as one and the method's return type would be void.

    Read the article

  • Fun programming or something else?

    - by gion_13
    I've recently heard about android's isUserAGoat method and I didn't know what to think. At first I laughed my brains out, than I was embarrassed for my lack of professionalism and tried to look into it and see if it makes any normal sense. As it turns out it is a joke (as stated here) and it appears that other languages/apis have these sort of easter eggs implemented in their core. While I personally like them and feel they can be a fresh breath sometimes, I think that they also can be both frustrating and confusing (and you begin to ask yourself : "can users be goats?" or "I get it! "goat" is slang for.... wait.."). My question is are there any other examples of these kind of programming jokes and what are their intends? Should they be considered harmless or not (how do programmers feel about it) ? Do they reach their goal (if any other than to laugh) ? Where do you draw a line between a good joke and a disaster? (what if the method was called isUserStupid?)

    Read the article

  • What happened to the this type of naming convention?

    - by Smith
    I have read so many docs about naming conventions, most recommending both Pascal and Camel naming conventions. Well, I agree to this, it's ok. This might not be pleasing to some, but I am just trying to get your opinion on why you name your objects and classes in a certain way. What happened to this type of naming conventions, and/or why are they bad? I want to name a structure, and I prefix it with "struct". My reason is that, with IntelliSense, I see all structures in one place, and anywhere I see the struct prefix, I know it's a "struct": structPerson structPosition another example is the enum, although I may not prefix it with "enum", but maybe with "enm": enmFruits enmSex again my reason is that in IntelliSense, I see all my enumerations in one place. Because .NET has so many built-in data structures, I think this helps me do less searching. Note that I used .NET in this example, but I welcome language agnostic answers.

    Read the article

  • Enum Naming Convention - Plural

    - by o.k.w
    I'm asking this question despite having read similar but not exactly what I want at http://stackoverflow.com/questions/495051/c-naming-convention-for-enum-and-matching-property I found I have a tendency to name enums in plural and then 'use' them as singular, example: public enum EntityTypes { Type1, Type2 } public class SomeClass { /* some codes */ public EntityTypes EntityType {get; set;} } Of course it works and this is my style, but can anyone find potential problem with such convention? I do have an "ugly" naming with the word "Status" though: public enum OrderStatuses { Pending, Fulfilled, Error, Blah, Blah } public class SomeClass { /* some codes */ public OrderStatuses OrderStatus {get; set;} } Additional Info: Maybe my question wasn't clear enough. I often have to think hard when naming the variables of the my defined enum types. I know the best practice, but it doesn't help to ease my job of naming those variables. I can't possibly expose all my enum properties (say "Status") as "MyStatus". My question: Can anyone find potential problem with my convention described above? It is NOT about best practice. Question rephrase: Well, I guess I should ask the question this way: Can someone come out a good generic way of naming the enum type such that when used, the naming of the enum 'instance' will be pretty straightforward?

    Read the article

  • Misc. Naming: Can I place underscores instead of camel casing in modern languages?

    - by Bubba88
    Hi! I would like to ask some kind of permission (I hope that doesn't sound strange) from the people who have influence on the naming conventions in modern languages like F#, Scala, etc. My problem is - I just can't read camelCased code and wish I could write underscored_names at least in my internal implementations (not in API interface). This applies to just everything - local var names, method names, params.. (Not class names I think) It seems that now the camel-casing is preferred for example for the names of object methods, but could that be not the only way? What would you say; Can I go with underscored names in languages like I mentioned (F#, Scala)?

    Read the article

< Previous Page | 1 2 3 4 5 6 7 8 9 10 11 12  | Next Page >