conventions

Should I Use self Keyword (Properties) In The Implementation?

自作多情 提交于 2019-11-27 01:40:24
问题 I believe I understand properties for the most part. My question is, if I have a property for an instance variable, and I am setting or retrieving it from within a method in my implementation file, should I use self.myProperty or just myProperty ? I know either one works, but I have seen mixed conventions, sometimes code accesses the variable directly and other times through the property. Is there a technical reason for doing this? Is it just convention/personal preference? And I'm not

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

和自甴很熟 提交于 2019-11-27 00:27:05
问题 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 get the rules about no mixed case, hyphens, keywords, etc. I've also read section 7.7 (Unique-Package-Names) of the Java Language Specification. As far as I can tell, the rules from Java are to use the reverse domain to insure uniqueness... and if

When to use ellipsis after menu items

旧城冷巷雨未停 提交于 2019-11-27 00:13:36
问题 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 looked at various windows applications, and this is what I have come to: Ellipsis Menu items which opens a form that require user input to do something (Replace, Go to, Font) No ellipsis Menu items which just does something (Cut, Paste, Exit, Save)

What is the benefit of nesting functions (in general/in Swift)

耗尽温柔 提交于 2019-11-26 23:11:57
问题 I'm just learning some Swift and I've come across the section that talks about nesting functions: Functions can be nested. Nested functions have access to variables that were declared in the outer function. You can use nested functions to organize the code in a function that is long or complex. From here So if the purported benefit is to "organize the code", why not just have the nested function independently, outside of the outer function? That, to me, seems more organized. The only benefit

How do you USE Fortran 90 module data

夙愿已清 提交于 2019-11-26 22:21:58
问题 Let's say you have a Fortran 90 module containing lots of variables, functions and subroutines. In your USE statement, which convention do you follow: explicitly declare which variables/functions/subroutines you're using with the , only : syntax, such as USE [module_name], only : variable1, variable2, ... ? Insert a blanket USE [module_name] ? On the one hand, the only clause makes the code a bit more verbose. However, it forces you to repeat yourself in the code and if your module contains

Learning Ant path style

烂漫一生 提交于 2019-11-26 21:29:06
Where can I find resources to learn Ant path style conventions? I've gone to the Ant site itself, but couldn't find any information on path styles. user11153 Ant-style path patterns matching in spring-framework : The mapping matches URLs using the following rules: ? matches one character * matches zero or more characters ** matches zero or more 'directories' in a path {spring:[a-z]+} matches the regexp [a-z]+ as a path variable named "spring" Some examples: com/t?st.jsp - matches com/test.jsp but also com/tast.jsp or com/txst.jsp com/*.jsp - matches all .jsp files in the com directory com/**

Why do you not declare several variables of the same type on the same line?

落爺英雄遲暮 提交于 2019-11-26 21:14:29
问题 Why is it bad practice to declare variables on one line? e.g. private String var1, var2, var3 instead of: private String var1; private String var2; private String var3; 回答1: I think that there are various reasons, but they all boil down to that the first is just less readable and more prone to failure because a single line is doing more than one thing. And all that for no real gain, and don't you tell me you find two lines of saved space is a real gain. It's a similar thing to what happens

How to organize large R programs?

我的未来我决定 提交于 2019-11-26 21:13:08
When I undertake an R project of any complexity, my scripts quickly get long and confusing. What are some practices I can adopt so that my code will always be a pleasure to work with? I'm thinking about things like Placement of functions in source files When to break something out to another source file What should be in the master file Using functions as organizational units (whether this is worthwhile given that R makes it hard to access global state) Indentation / line break practices. Treat ( like {? Put things like )} on 1 or 2 lines? Basically, what are your rules of thumb for organizing

maven project: SWT 3.5 dependency: any official public repo?

China☆狼群 提交于 2019-11-26 20:40:43
问题 Well, in short, I may need to grab new SWT version instead of 3.3 we're using for now. The project now has only this dependency and builds fine: <dependency> <groupId>org.eclipse.swt.win32.win32</groupId> <artifactId>x86</artifactId> <version>3.3.0-v3346</version> </dependency> AFAICGoogle, there is no more recent version in the public maven repo: http://repo1.maven.org/maven2/org/eclipse/swt/ So: Is there some public maven repo with recent builds? If not, where do you get the jars you

Code line wrapping - how to handle long lines

旧街凉风 提交于 2019-11-26 19:57:11
问题 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 look bad. So I'm looking for some ideas on what I should do for it. Here's the line: private static final Map<Class<? extends Persistent>, PersistentHelper> class2helper = new HashMap<Class<? extends Persistent>, PersistentHelper>(); I'm open to both