Programming Practices are the commonly or not so commonly used practices in development of software. These can include things like Agile Development, Kanban, Coding shortcuts, etc.

learn more… | top users | synonyms

1
vote
1answer
64 views

Eventual consistency in Banking systems

I keep hearing people say Banking systems like ATM use Eventual consistency model for data synchronization, but I am wondering if it is true. Definitely the amount you withdraw might be delayed ...
-4
votes
2answers
164 views

Offensive Variable Names

Everyone knows that all manner of obscenities are included in commits and comments, but is it ever a good idea to have 'offensive' words in the actual code? The best argument I can think of is: when ...
0
votes
1answer
27 views

Best way to indicate more results available

We have a service to return messages. We want to limit the number returned, either allowing the caller to specify the max number to return, or else to use an internal hard limit. We also have thought ...
1
vote
1answer
52 views

How to deal with interactions between many objects

I've been working on a game in my spare time. I'm pretty much done defining the primitives and until today everything was pretty well segmented and encapsulated but now it's come time to implement ...
2
votes
1answer
76 views

equivalence in callback and non-callback javascript

I'm pretty sure that the following two snippets are equivalent but I wanted to double check: CALLBACK STYLE function foo(input, callback) { // do stuff with input callback(); } function ...
0
votes
1answer
177 views

Does it make sense to choose UTF-32, based on concern that some basic rule will be broken for UTF-8?

I'm working on an cross platform C++ project, which doesn't consider unicode, and need change to support unicode. There is following two choices, and I need to decide which one to choose. Using ...
0
votes
2answers
82 views

How to plan for multi-platform application development [closed]

In my earlier days of programming, I was using Visual Basic for learning. It taught me many concepts, and I was able to make some cool programs (in my opinion, anyways...). I have expanded my horizon ...
0
votes
1answer
37 views

Automating form error handling

I'm not sure if I'm being clever or making things more difficult. I'm working within a custom MVC framework, and within some of my "views" which contain forms I'm preserving input and styling errors ...
0
votes
2answers
103 views

Is it fine to reuse a class instance?

I ask in terms of high cost classes, with a particle engine as an example. I read somewhere that an instance of a class with a high cost to initialize, like a particle manager, should have its state ...
2
votes
4answers
180 views

Should refactoring be the exception or the rule? [closed]

I had a discussion with a co-worker yesterday about design philosophy. The other coder is more experienced then me, and I fully admit that he is likely much better at properly automating his testing, ...
1
vote
2answers
97 views

ID properties on Domain objects in DDD

In my domain I have an Account object. e.g. class Account { public string Number; public string SortCode; } Within the context of DDD, should this account object have an ID property? The ...
1
vote
5answers
285 views

What are the advantages of recursion compared to iteration? [duplicate]

I'm trying to understand when is preferred to use recursion rather than iteration. Actually I've encountered recursion only in Javascript but never in Python. I imagine that recursion should be used ...
1
vote
3answers
103 views

Is it really possible to have libraries not depend on other libraries?

I often see the advice that you should try to make each library independent. And yet in reality I can never seem to achieve this. Is this BS advice or is it actually possibly in any realistic way? ...
0
votes
1answer
87 views

When is it suitable to use inheritance [duplicate]

I recently had a small "argument" about inheritance with a friend. I think people overuse it a lot. Intuition tells me that that the only good reason for class inheritance is polymorphism - when there ...
-1
votes
1answer
62 views

What are arguments against using articles in method name? [closed]

I want to use articles in method names sometimes. Like some service method 'getStudentsOfATeacher()'. What are arguments against that?
1
vote
0answers
99 views

How much segregation is too much in this design?

We are working on ASP.NET webforms application developed using WCSF (MVP pattern). In the application, there is a search screen that allows the user to enter some fields and display the results. We ...
4
votes
1answer
205 views

If TDD is design, how do you know your TDD is well designed? [duplicate]

Given a large group (50+) of programmers: All given the same problem, All using Test-Driven Development (TDD), All pair programming, All doing group-based code review, I have personally seen the ...
-2
votes
1answer
138 views

What is a “real” education in programming? [closed]

Looking for well defined explanation that is based on a statistically significant correlation to what "real" world programmers are paid to do as a team and what they are told to learn; not for ...
0
votes
1answer
52 views

Contradiction of layered design and global data access for analytics reporting

While developing an application (mobile app for Android), our team always strives to use best development practices such as interfaces, layering and separation of concerns. When it comes to reporting ...
1
vote
2answers
105 views

Is it okay to user other open source libraries when building your own or should that be avoided?

Seems like an odd question, but I've been questioning this myself for some time now. I've been told that, if you're working on a open source library/project, you should avoid adding dependencies for ...
-4
votes
0answers
57 views

A dynamic programming solution required

I have solved the following question using bitmask dp. http://community.topcoder.com/stat?c=problem_statement&pm=4442 Find below a method that takes: the size of the 'target' vector, variable ...
2
votes
1answer
997 views

Where should variables be declared [duplicate]

Considering I have a for loop in a method of a class. Should the incremented variable be declared as member of the class, or should it be declared in the method it uses it(or even in the for loop, ...
4
votes
2answers
436 views

Unit testing of non-atomic methods [duplicate]

I'm new in unit testing. For last two days I'm thinking how to test non-atomic methods with unit tests. When i need to write tests for some simple, atomic method situation in pretty easy - i'm taking ...
0
votes
2answers
156 views

Python - only one return per method? [duplicate]

I'm trying to sort out whether this is just a personal preference thing or whether it's actually bad practice to do this one way or another. I did try to reference PEP8 first, and I did not see an ...
1
vote
1answer
31 views

Performance and data retrieving

I'm currently developing a mobile application in Objective C for iOS devices. While doing the application I reach the point where I have to retrieve data from a database and show it on a table (the ...
-2
votes
2answers
107 views

Using words instead of numbers for versioning? [closed]

Would it be considered acceptable to use word compounds instead of numbers for version iterations? For example in a pattern: "[Adjective] [Noun]" The first version could be something like: ...
1
vote
1answer
37 views

Alternatives to JDT Annotation - License issues

I have used the JDT Annotation library in my Java project as I am quite fond of what it offers. To be more exact, I used the @Nullable and @NonNullByDefault annotations as I can use the synergy with ...
1
vote
3answers
189 views

Does designing a method that changes the argument's (if was object) values a good practice?

The premise is using a language (e.g. C#, javascript) which passes an object by reference into a method. Assume there is an object "Player" which has a property "Level" and there is a method takes ...
3
votes
2answers
339 views

Asterisks in Multi-line comments

Using Visual Studio 2012 with C#, when I write multi-line comments, VS automatically begins each line with an asterisk, like this: /* * * */ I was just curious if this was the case in ...
3
votes
2answers
121 views

Best practice for security checks, in surface or deep layer? [closed]

Let's take a server-side WebServices app, we need to make sure that all function applies every security rules, and keep the code clean. In such a case, I usually prefer to place my security checks on ...
14
votes
7answers
1k views

Should I refactor large functions that mostly consist of one regex? [closed]

I just wrote a function that spans approximately 100 lines. Hearing that, you are probably tempted to tell me about single responsibilities and urge me to refactor. This is my gut instinct as well, ...
1
vote
1answer
84 views

Global variable vs. local-static variable for storing state

I am writing an application for my graduation coursework, in C, using GTK+ UI library. Sometimes I ask for user input, which I need to save for later use. The doubt comes on how to store this data. I ...
2
votes
4answers
182 views

Basic OOP Question for a Report

I'm in development of a sample project in Android for a friend's phone that keeps track of his sales. At first, one of the requirements was to create yearly reports of this sales data. This would be ...
0
votes
1answer
44 views

How to mark unit/integration tests when they do not apply for the current test configuration - Inconclusive or Passed?

In my test environment we are running the same set of integration (and sometimes unit) tests against different systems that have different capabilities. Some of the tests cannot be executed against ...
2
votes
2answers
76 views

Constants vs public properties for configuration

My application has a few high level configuration options such as directories which will be used for various things, database connection information and a few other settings which are required for the ...
0
votes
5answers
194 views

Is it a good practice to wrap collection in Java? [closed]

I came across a snippet like this, and find it's over engineering. Is it a good practice? public class SchoolList extends ArrayList<School> { } public class School extends ...
5
votes
3answers
489 views

How to prepare for rewriting an application's glue [closed]

Assume you have a project that (in your opinion) is mostly decently well written, modularized, etc. and you want to keep much of it's functionality. However, an essential portion of this project is ...
-1
votes
2answers
124 views

How to assure client that we will complete our project and won't run away with the money [closed]

I have decided to work as a freelancer. I have developed a software and have successfully given the presentation demo. The client liked it and has agreed to implement the project in his organisation. ...
1
vote
2answers
99 views

How to document self explanatory setter functions? [duplicate]

Often boolean setters are pretty self-explanatory, like setLogErrors($bool). I do see some benefit of providing some additional information in the documentation, in this instance maybe where these ...
1
vote
4answers
192 views

is it considered plagiarism to comment out code I copied from elsewhere?

If the plagiarized code is commented out because I found another way to solve the problem, but I forgot to remove the comments, is that considered plagiarism? I used the copied code to help me debug ...
0
votes
2answers
149 views

Is it better to use already build plugins/extensions or code your own in programming projects [duplicate]

I am building a web app in PHP and Symfony. Basically if we search there are plugins / extensions / bundles for almost 60% of stuff. The advantage of using them is that you can easily get your ...
1
vote
1answer
306 views

Is there a practical use from learning Brainfuck? [closed]

Brainfuck is an esoteric programming language created in 1993 by Urban Müller. It was designed to challenge and amuse programmers, and was not made to be suitable for practical use. But still, it ...
1
vote
1answer
146 views

Pythonic version of Java interfaces

I fully acknowledge that Python and Java are different programming languages and should be used differently. That said, "Program to an interface, not to an implementation" is good language-agnostic ...
6
votes
2answers
175 views

How to put lessons learned, good practices, etc into the “work flow”

As the title states it, I would like to get some suggestions about putting knowledge into action. We have many additional requirements that concern: coding practices feature development (all of them ...
9
votes
3answers
677 views

Are these programming “classics” still relevant today and should I read them? [closed]

I have come across numerous older posts that highly recommend the following language agnostic programming books: Code Complete by Steve McConnel The Pragmatic Programmer - Andrew Hunt and Dave ...
3
votes
3answers
183 views

How do I maintain consistency between hard-coded values in different files?

I have a C source file and another (non-code) file in a project which contain the same hard-coded value. Ideally, the value would be specified in only one location and be copied to the other location ...
0
votes
2answers
74 views

Should functions be prepared for overlapping buffers?

So I have a function in C like this: void crunch(const char *in, char *out, size_t inLen, size_t outLen) { //... } If the two buffers overlap, the function may mess up the input buffer as well, ...
3
votes
2answers
860 views

When is it worthwhile to replace working mature code with frameworks+patterns

I fear that frameworks in many cases have become a fashion or trend and are being abused. In many ways people are sacrificing speed just because they want to keep up with every single lib that comes ...
4
votes
4answers
243 views

Returning null or a empty value/throw exception? [duplicate]

Various programming books suggest that methods should not return null values (Clean Code for example). Instead of returning null default values (0 or empty string or empty object) should be returned ...
1
vote
3answers
297 views

I know what I want to do, but I have a hard time coding it? [closed]

After doing some interviews, I've realized that I usually know what I want to do to solve a problem, but I often get my logic complicated (and introduce a lot of bugs) when I'm actually coding. For ...