Search Results

Search found 2081 results on 84 pages for 'standards compliance'.

Page 12/84 | < Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >

  • Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)

    - by AKE
    The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing): "Use comments sparingly. Programs are self-documenting, with a modicum of help from mnemonics. Comments should say WHAT the program is doing, not HOW." My question: Should comments say WHY the program is doing what it is doing? Update: In addition to the answers below, these two provide additional insight. Beginner's guide to writing comments? http://programmers.stackexchange.com/a/98609/62203

    Read the article

  • How important is it that you know the C++ standard?

    - by Nim
    I did try searching, but I did not see a similar question (either that or my search terminology was incorrect - if so, feel free to close). I am an avid user of SO, and I notice that there are lots of references to the C++ standard in discussions and answers - and I have to admit, I have never read this particular document, the language makes my eyes hurt... So, the question is, can a C++ developer really code for a living without ever having read this document? Is it really important for us mere mortals who are not in the business of writing compilers?

    Read the article

  • Standard -server to server- and -browser to server- authentication method

    - by jeruki
    I have server with some resources; until now all these resources were requested through a browser by a human user, and the authentication was made with an username/password method, that generates a cookie with a token (to have the session open for some time). Right now the system requires that other servers make GET requests to this resource server but they have to authenticate to get them. We have been using a list of authorized IPs but having two authentication methods makes the code more complex. My questions are: Is there any standard method or pattern to authenticate human users and servers using the same code? If there is not, are the methods I'm using now the right ones or is there a better / more standard way to accomplish what I need? Thanks in advance for any suggestion.

    Read the article

  • Control convention for circular movement?

    - by Christian
    I'm currently doing a kind of training project in Unity (still a beginner). It's supposed to be somewhat like Breakout, but instead of just going left and right I want the paddle to circle around the center point. This is all fine and dandy, but the problem I have is: how do you control this with a keyboard or gamepad? For touch and mouse control I could work around the problem by letting the paddle follow the cursor/finger, but with the other control methods I'm a bit stumped. With a keyboard for example, I could either make it so that the Left arrow always moves the paddle clockwise (it starts at the bottom of the circle), or I could link it to the actual direction - meaning that if the paddle is at the bottom, it goes left and up along the circle or, if it's in the upper hemisphere, it moves left and down, both times toward the outer left point of the circle. Both feel kind of weird. With the first one, it can be counter intuitive to press Left to move the paddle right when it's in the upper area, while in the second method you'd need to constantly switch buttons to keep moving. So, long story short: is there any kind of existing standard, convention or accepted example for this type of movement and the corresponding controls? I didn't really know what to google for (control conventions for circular movement was one of the searches I tried, but it didn't give me much), and I also didn't really find anything about this on here. If there is a Question that I simply didn't see, please excuse the duplicate.

    Read the article

  • How should compound words be handled when coding? Is there a definitive list of compound words? [closed]

    - by Ray
    QUESTION: How should you handle compound words when programming? Are there any good lists available online for developers of generally accepted technology-related compound words? I can see how this is highly ambiguous, so should I just use common-sense? EXAMPLE: I would be inclined to do this: filename NOT FileName or login NOT LogIn However, the microsoft documentation indicates that filename is not compound. So I wonder, is there a more definitive source? See also, this english.stackexchange discussion on filename. Under the section "Capitalization Rules for Compound Words and Common Terms" located here: Microsoft .NET Capitalization Conventions only offers a limited introduction into the topic, and leaves it up to the developer to use their intuition with the rest.

    Read the article

  • What is the worst programmer habit?

    - by 0x4a6f4672
    Many people get into programming because programming is fun. At least in the beginning. After some time doing it professionally, programming is no longer fun, often just hard work. Sometimes we develop bad habits along the way to make it fun again. Some bad habits of programmers are well known, for example the "I fix that in a second" habit, the "reinvent the wheel" practice or the "all code except mine is crap" attitude (which often leads to "I will re-write the entire program from scratch" syndrome). There are things which a programmer should never do. What is the worst programmer habit?

    Read the article

  • Where did the notion of "one return only" come from?

    - by FredOverflow
    I often talk to Java programmers who say "Don't put multiple return statements in the same method." When I ask them to tell me the reasons why, all I get is "The coding standard says so." or "It's confusing." When they show me solutions with a single return statement, the code looks uglier to me. For example: if (blablabla) return 42; else return 97; "This is ugly, you have to use a local variable!" int result; if (blablabla) result = 42; else result = 97; return result; How does this 50% code bloat make the program any easier to understand? Personally, I find it harder, because the state space has just increased by another variable that could easily have been prevented. Of course, normally I would just write: return (blablabla) ? 42 : 97; But the conditional operator gets even less love among Java programmers. "It's incomprehensible!" Where did this notion of "one return only" come from, and why do people adhere to it rigidly?

    Read the article

  • Why does Zend discourage "floating functions"?

    - by kojiro
    Zend's Coding Standard Naming Convention says Functions in the global scope (a.k.a "floating functions") are permitted but discouraged in most cases. Consider wrapping these functions in a static class. The common wisdom in Python says practically the opposite: Finally, use staticmethod sparingly! There are very few situations where static-methods are necessary in Python, and I've seen them used many times where a separate "top-level" function would have been clearer. (Not only does the above StackOverflow answer warn against overuse of static methods, but more than one Python linter will warn the same.) Is this something that can be generalized across programming languages, and if so, why does Python differ so from PHP? If it's not something that can be generalized, what is the basis for one approach or the other, and is there a way to immediately recognize in a language whether you should prefer bare functions or static methods?

    Read the article

  • Assignments in mock return values

    - by zerkms
    (I will show examples using php and phpunit but this may be applied to any programming language) The case: let's say we have a method A::foo that delegates some work to class M and returns the value as-is. Which of these solutions would you choose: $mock = $this->getMock('M'); $mock->expects($this->once()) ->method('bar') ->will($this->returnValue('baz')); $obj = new A($mock); $this->assertEquals('baz', $obj->foo()); or $mock = $this->getMock('M'); $mock->expects($this->once()) ->method('bar') ->will($this->returnValue($result = 'baz')); $obj = new A($mock); $this->assertEquals($result, $obj->foo()); or $result = 'baz'; $mock = $this->getMock('M'); $mock->expects($this->once()) ->method('bar') ->will($this->returnValue($result)); $obj = new A($mock); $this->assertEquals($result, $obj->foo()); Personally I always follow the 2nd solution, but just 10 minutes ago I had a conversation with couple of developers who said that it is "too tricky" and chose 3rd or 1st. So what would you usually do? And do you have any conventions to follow in such cases?

    Read the article

  • Naming conventions for newtype deconstructors (destructors?)

    - by Petr Pudlák
    Looking into Haskell's standard library we can see: newtype StateT s m a = StateT { runStateT :: s -> m (a, s) } newtype WrappedMonad m a = WrapMonad { unwrapMonad :: m a } newtype Sum a = Sum { getSum :: a } Apparently, there (at least) 3 different prefixes used to unwrap a value inside a newtype: un-, run- and get-. (Moreover run- and get- capitalizes the next letter while un- doesn't.) This seems confusing. Are there any reasons for that, or is that just a historical thing? If I design my own newtype, what prefix should I use and why?

    Read the article

  • What should NOT be included in comments? (opinion on a dictum by the inventor of Forth)

    - by AKE
    The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing): "Use comments sparingly. Programs are self-documenting, with a modicum of help from mnemonics. Comments should say WHAT the program is doing, not HOW." My question: Should comments say WHY the program is doing what it is doing? Update: In addition to the answers below, these two provide additional insight. 1: Beginner's guide to writing comments? 2: http://programmers.stackexchange.com/a/98609/62203

    Read the article

  • How to define a natural id in database?

    - by gcc
    There are a lot of manuals. I am trying to create an database to hold information of these documents. But, there is a small problem. How can I give meaningful id to the manuals? Are there any standard or logic behind the giving meaningful id to the documents? If there is no standard, can you tell me how I should do that? example: table : manual id | manual name EDIT: Not Meaningful ID 1 or M1 or foo 2 C2 bar 3 P123 name ... ... ... (i) (ii) (iii) (i) Not meaningful for me because if some item deleted, there can be gap. ex 1 33 100. (ii) random character can be confusing when one try to give a name to new manual (iii) Why giving name is not preferred is because finding a name to the manual as ID is hard after 500 manuals. Meaningful : New ID * Can be easily produced even if after 1000 manuals * Should not be so complicated

    Read the article

  • Single quotes vs double quotes

    - by Eric Hydrick
    I just started a job where I'm writing Python after coming from a Java background, and I'm noticing that other developers tend to quote strings using single quotes ('') instead of double quotes (""). For example: line1 = 'This is how strings typically look.' line2 = "Not like this." Is there a particular reason for this other than personal preference? Is this the proper way to be quoting strings?

    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

  • Custom HTML Tags: Are there any specifications stating a standard way to handle them?

    - by blesh
    It seems like for years they've just been given default styling and inline display. Is there a spec somewhere that has dictated this? I've looked over the RFC's but I'm not particularly good with RFC-ese, and I didn't notice anything anywhere. For example <body> Some content <mycustomtag>something else</mycustomtag> more content. </body> I can still style it with CSS, and the browser doesn't outright vomit... so it seems like there is some sort of expected behavior. Was that dictated by a specification?

    Read the article

  • What is the benefit of not using Hungarian notation?

    - by user29981
    One of the things I struggle with is not using Hungarian notation. I don't want to have to go to the variable definition just to see what type it is. When a project gets extensive, it's nice to be able to look at a variable prefixed by 'bool' and know that it's looking for true/false instead of a 0/1 value. I also do a lot of work in SQL Server. I prefix my stored procedures with 'sp' and my tables with 'tbl', not to mention all of my variables in the database respectively. I see everywhere that nobody really wants to use Hungarian notation, to the point where they avoid it. My question is, what is the benefit of not using Hungarian notation, and why does the majority of developers avoid it like the plague?

    Read the article

  • Eliminating Magic Numbers: When is it time to say "No"?

    - by oosterwal
    We're all aware that magic numbers (hard-coded values) can wreak havoc in your program, especially when it's time to modify a section of code that has no comments, but where do you draw the line? For instance, if you have a function that calculates the number of seconds between two days, do you replace seconds = num_days * 24 * 60 * 60 with seconds = num_days * HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE At what point do you decide that it is completely obvious what the hard-coded value means and leave it alone?

    Read the article

  • Good practices when writing a parser for a standard file format (such as ePub)

    - by J-F L-R
    I am considering writing an Android reader software that can read ePubs and display them. I checked the ePub standard documents. However, these contain a lot of information. So I am wondering what is the process of implementing a standard for a file format. What are the steps to get a working implementation without passing by parts of the standard? Are there any best practices? Also, is it even possible to program this alone in a reasonable time? From what I have already found out, ePub is basically a zip archive. That means I could probably use zlib to decompress it. The content is in XHTML and CSS, so I believe it should be possible to display it in a WebView. The parts that are missing are writing the code that can read the metadata and manage the non-standard XHTML extensions.

    Read the article

  • What do you do when working with multiple languages with different capitalization schemes?

    - by dvcolgan
    I'm making a webapp using Django. The Python convention for naming variables is lowercase_with_underscores, but the Javascript convention is camelCase. In addition, I've seen many people use lowercase-with-hyphens for CSS identifiers. Would you suggest using all three naming conventions where appropriate, or picking one and using it, even if the other two recommend something else? Switching back and forth isn't a huge problem, but it can still be mental overhead.

    Read the article

  • How do you avoid name similarities between your classes and the native ones?

    - by Oscar
    I just ran into an "interesting problem", which I would like your opinion about: I am developing a system and for many reasons (meaning: abstraction, technology independence, etc) we create our own types for exchanging information. For instance: if there is a method which is called SendEmail and is invoked by the business logic, it way have a parameter of type OurCompany.EMailMessage, which is an object which is completely technology independent and contains only "business relevant data" (for instance, no information abut head encoding). Inside the SendEmail function, we get this information from our EMailMEssage object and create a MailMessage (this one is technolgy specific) object so it can be sent over the network. As you can already notice, our class has a very similar name to the "native" language class. The problem is: this is exactly what they are, email messages, so it is hard to find another meaningful name for them. Do you have this problem often? How do you manage it? Edit: @mgkrebbs just commented about using fully qualified names. This is our current approach, but a little bit too verbose, IMHO. I would like something cleaner, if possible.

    Read the article

  • how to give meaningful id to the things in database

    - by gcc
    There are a lot of manuals. I am trying to create an database to hold information of these documents. But, there is a small problem. How can I give meaningful id to the manuals? Are there any standard or logic behind the giving meaningful id to the documents? If there is no standard, can you tell me how I should do that? example: table : manual id | manual name EDIT: Not Meaningful ID 1 or M1 or foo 2 C2 bar 3 P123 name ... ... ... (i) (ii) (iii) (i) Not meaningful for me because if some item deleted, there can be gap. ex 1 33 100. (ii) random character can be confusing when one try to give a name to new manual (iii) Why giving name is not preferred is because finding a name to the manual as ID is hard after 500 manuals. Meaningful : New ID * Can be easily produced even if after 1000 manuals * Should not be so complicated

    Read the article

  • Why do most of us use 'i' as a loop counter variable?

    - by kprobst
    Has anyone thought about why so many of us repeat this same pattern using the same variable names? for (int i = 0; i < foo; i++) { // ... } It seems most code I've ever looked at uses i, j, k and so on as iteration variables. I suppose I picked that up from somewhere, but I wonder why this is so prevalent in software development. Is it something we all picked up from C or something like that? Just an itch I've had for a while in the back of my head.

    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

  • Is it wrong to use a boolean parameter to determine behavior?

    - by Ray
    I have seen a practice from time to time that "feels" wrong, but I can't quite articulate what is wrong about it. Or maybe it's just my prejudice. Here goes: A developer defines a method with a boolean as one of its parameters, and that method calls another, and so on, and eventually that boolean is used, solely to determine whether or not to take a certain action. This might be used, for example, to allow the action only if the user has certain rights, or perhaps if we are (or aren't) in test mode or batch mode or live mode, or perhaps only when the system is in a certain state. Well there is always another way to do it, whether by querying when it is time to take the action (rather than passing the parameter), or by having multiple versions of the method, or multiple implementations of the class, etc. My question isn't so much how to improve this, but rather whether or not it really is wrong (as I suspect), and if it is, what is wrong about it.

    Read the article

< Previous Page | 8 9 10 11 12 13 14 15 16 17 18 19  | Next Page >