There is a plenty coding guidelines/standards available for c# language. However I couldn't find anything "official" regarding XAML. I'm particularly interested in naming conventions of the visual elements, but something about formatting would be also useful. At the moment my XAML files look like a big soup of tags, not really human read...
Hi,
I've been coding on and off my whole life. I've mostly coded Perl, but also some Java, PHP, C, C++. I've even took a stab at Emacs Lisp, and I've done the occasional shell script. However, I've never actually engaged the subject to gain any kind of expertise – other things have had higher priorities for me. I don't consider myself to...
In scala it is possible to define a local block in a function. The local block evaluates to the last statements, for example,
val x = {val x =1;x+1}
Here x==2, the inner val x is local to that block.
However those local blocks can cause sneaky bugs when writing anonymous classes. For example (from scala's reference)
new Iterator[Int...
What is a good strategy for dealing with changing product and feature names in source code. Here's the situation I find myself in over and over again (most of you can relate?)...
Product name starts off as "DaBomb"
Major features are "Exploder", "Lantern" and "Flag".
Time passes, and the Feature names are changed to "Boom", "Lighthous...
Just found StyleCop, looks like something worth using for my projects. Then I found out you could use it with ReSharper (a tool I've also never used). So I downloaded ReSharper, as well as StyleCop for ReSharper. I'm just a bit confused about it, though:
With just StyleCop installed (no ReSharper), I get yelled at for referring directl...
I know this question has no answer, but I'm curious to know what other people think.
In a language like Java, it's a convention to begin classes with capital letters, and objects with lowercase letters. But what about JavaScript, where everything is an object?
I've seen some people suggest capitalizing only objects that are treated as ...
When programming in a C-like language should one's "default" integer type be int or uint/unsigned int? By default, I mean when you don't need negative numbers but either one should be easily big enough for the data you're holding. I can think of good arguments for both:
signed: Better-behaved mathematically, less possibility of weird...
I have been looking at the differences between Lucene 2.9 particular the redone tokenstream API and it just occurs to me its particularly ugly compared to the old just return a new or repopulate the given with values if your reusing said Token.
I have not done any profiling but it seems using a MAP to store attributes is not that effic...
Ch 7.6 of Code Complete 2 is confusing me, I've attached some sample code (in php) mind telling me which style is the best? or suggest something better? thanks
Style 1
public function register($user, $pass) {
if($this->model->isRegistered($user)
{
return false;
}
else if($this->twitter->login($user, $pass))
{
return $this->mod...
I am new to work but the company I work in hires a lot of non-comp-science people who are smart enough to get the work done (complex) but lack the style and practices that should help other people read their code.
For example they adopt C++ but still use C-like 3 page functions which drives new folks nuts when they try to read that. Als...
Not using operators makes my code obscure.
(aNumber / aNother) * count
is better than
aNumber.divideBy(aNother).times(count)
After 6 months of not writing a single comment I had to write a comment to the simple operation above. Usually I refactor until I don't need comment. And this made me realize that it is easier to read and pe...
Our static analysis tool complains about a "useless type qualifier on return type" when we have prototypes in header files such as:
const int foo();
We defined it this way because the function is returning a constant that will never change, thinking that the API seemed clearer with const in place.
I feel like this is similar to expli...
I'm curious to know, how many spaces of indentation do you prefer in PHP code?
function one()
{
$one;
function space()
{
$space;
}
}
function two()
{
$two;
function spaces()
{
$spaces;
}
}
function three()
{
$three;
function spaces()
{
$spaces;
}
}
function four()
{
$four;
function spaces()...
public void handleParsedCommand(String[] commandArr) {
if(commandArr[0].equalsIgnoreCase("message")) {
int target = Integer.parseInt(commandArr[1]);
String message = commandArr[2];
MachatServer.sendMessage(target, this.conId, message);
} else if(commandArr[0].equalsIgnoreCase("quit")) {
// Tell the...
I have large C++ code base. It is quite inconsistent where uses underscore_identifiers and where CamelCaseIdentifiers, but is consistent within groups of files. Think about it as a smaller library merged into bigger one.
I want to standardize it within this project to Google C++ Style Guide.
How can I semi-automatize it ? Preferably wit...
Disclaimer: I tried to search for similar question, however this returned about every C++ question... Also I would be grateful to anyone that could suggest a better title.
There are two eminent loop structure in C++: while and for.
I purposefully ignore the do ... while construct, it is kind of unparalleled
I know of std::for_each and...
Possible Duplicates:
A good open source Python project to read code?
How to learn Python: Good Example Code?
I've been reading through Coders at Work and there is a repeated theme: hackers tend to read a lot of other's code and learn from it. I program in Python, there are plenty of open source code in it.
Which codebase you...
Is there a macro or preference setting that would automatically align method parameters along the columns and colons in Xcode?
Basically a shortcut to turn this:
[object methodWithParam:theParam another:theOtherValue something:theSomethingValue else:theElseValue];
automatically into this:
[object methodWithParam:theParam
...
Eclipse's default template for new types (Window > Preferences > Code Style > Code Templates > New Java Files) looks like this:
${filecomment}
${package_declaration}
${typecomment}
${type_declaration}
Creating a new class, it'll look something like this:
package pkg;
import blah.blah;
public class FileName {
// Class is acces...
I had come experience with PHP a time ago and now I'm learning to use Ruby on Rails. But one simple question bothered me in both these languages, so I think I can cross-post it to both tags.
As you know, one of the concepts there is that one can embed PHP or Ruby code into web page template. Then these statements are executed and resu...