code-readability Questions

1

I have been assigned the task of reading a .txt file which is a log of various events and writing some of those events into a dictionary. The problem is that the file can sometimes get bigger than...
Swanskin asked 24/5, 2011 at 18:30

1

Solved

Original Question I a piping a single string and processing it with For-EachObject as follows: "Test" | % { $_.Substring(0,1) } It seems wrong to process a single piped item using For-EachObj...
Ranchod asked 6/3, 2015 at 23:42

6

Solved

I often find myself with an Option[T] for some type T and wish to test the value of the option against some value. For example: val opt = Some("oxbow") if (opt.isDefined && opt.get == "lak...
Apteral asked 23/10, 2009 at 7:31

9

Solved

I'm looking for a tool that works on Windows to reformat some C++ code in my codebase. Essentially, I've got some code I wrote a while ago that I'd like to use, but it doesn't match the style...
Ignatzia asked 17/3, 2010 at 16:19

7

Solved

Return or not return, it's a question for functions! Or, does it really matter? Here goes the story: I used to write code like the following: Type3 myFunc(Type1 input1, Type2 input2){} But r...
Missus asked 26/12, 2013 at 9:7

6

Solved

Recently we had a discussion at work about the impact of local variables on the performance vs readability of Java code. Some of my colleagues are of the oppinion that declarations like this new D...
Hazen asked 31/10, 2013 at 14:33

4

Solved

I am used to test drive my code. Now that I am new to Go I am trying to get it right as fast as possible. I am using the testing package in the standard library which seem to be good enough. (I als...
Fluting asked 5/9, 2013 at 13:38

9

Solved

When indenting long if conditions, you usually do something like this (actually, PyDev indents like that): if (collResv.repeatability is None or collResv.somethingElse): collResv.rejected ...
Reply asked 25/2, 2011 at 12:11

1

Solved

I'm attempting to keep my code to 80 chars or less nowadays as I think it looks more aesthetically pleasing, for the most part. Sometimes, though, the code ends up looking worse if I have to put li...
Besides asked 27/3, 2013 at 16:28

3

The new range-based for loops really improve readability and are really easy to use. However, consider the following : map<Foo,Bar> FooAndAssociatedBars; for (auto& FooAndAssociat...
Kunkel asked 20/3, 2013 at 14:21

2

Solved

I have to create reports based on the user input. User answer a question, and then depending on the answer I go left or right in a treelike structure, and ask a new question. Some nodes will have t...
Bellyband asked 14/3, 2013 at 9:26

2

Solved

Can I (should I) use R attributes to save physical units and similar information as hint for the user? epsilon0 <- 8.854188e-12 # name <- "electric constant" # source <- "CODATA" # unit &...
Elroy asked 26/11, 2012 at 2:2

7

Solved

Say you're making a blog software, and want to show the number of comments an entry got. You might do it this way: [Entry title] [Content........] [ <?php print($numComments;) ?> Comments] ...
Lanham asked 21/7, 2009 at 19:53

8

Solved

I am new to clojure and the main thing I am struggling with is writing readable code. I often end up with functions like the one below. (fn rep ([lst n] (rep (rest lst) n (take n (repeat (f...
Investment asked 10/4, 2012 at 19:37

7

Solved

From observing source code for various Android applications (not written by me), I noticed a pattern of placing certain pieces of code into their own methods, although there really isn't any code r...
Joint asked 30/1, 2012 at 15:10

2

Solved

What does experimental research say about white space in code? Let me be specific: I'm talking about cognitive studies that compare how quickly and effectively people can read and grasp visual info...
Wilton asked 27/10, 2011 at 16:25

4

Solved

I am writing a scientific program in Python and C with some complex physical simulation algorithms. After implementing algorithm, I found that there are a lot of possible optimizations to improve p...
Recession asked 4/9, 2011 at 17:25

4

Solved

My biggest gripe with HTML is that line breaks add a tiny bit of space between elements. (jsFiddle.) This can screw up layouts where child elements are sized to exactly fit their parents. I read ...
Sidelong asked 25/8, 2011 at 6:6

5

I've realised that my greatest weakness as a programming student is my poor ability to comprehend other people's code. I have no trouble whatsoever with 'textbook' code, or clearly-commente...
Jasik asked 2/12, 2010 at 14:54

10

I'm considering the option of using anonymous { } code blocks to logically distinguish "code blocks" inside the same method call, something that (theoretically) should improve readability of the co...
Extremadura asked 25/10, 2010 at 17:28

2

Solved

I just started using Resharper. One of its features is that it suggests changes to the code based on, i suppose, good coding practices. One of the changes it suggested is to change the vari...
Lonnalonnard asked 30/9, 2010 at 21:38

2

Solved

What's the overhead of calling a method in .NET which returns immediately (because a condition which is the first code inside is not met)? I'd argue that no matter how real-time your application i...
Opprobrious asked 2/9, 2010 at 12:11

4

Solved

Before you ignore / vote-to-close this question, I consider this a valid question to ask because code clarity is an important topic of discussion, it's essential to writing maintainable code and I ...
Rodrich asked 27/5, 2010 at 20:7

6

Solved

I am currently writing a formal research report, and I'll be including code with this report. Question: Is there an accepted way of displaying code in research reports? I'm thinking both in ...
Parallax asked 18/3, 2010 at 6:0

2

Solved

As I'm starting to put more tracing in my code, i'm realizing it adds a lot of clutter. I know Visual Studio allows you to hide and reveal code, however, i'd like to be able group code into "tracin...
Encode asked 29/3, 2010 at 20:18

© 2022 - 2025 — McMap. All rights reserved.