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

2
votes
1answer
93 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
245 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
117 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
53 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
117 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
230 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
226 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
443 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
122 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
107 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
71 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
123 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
265 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 ...
0
votes
1answer
60 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
121 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 ...
2
votes
1answer
1k 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
458 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
193 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
34 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
115 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
61 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
230 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
465 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
133 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
138 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
203 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
50 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
85 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
345 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
1k 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
167 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
119 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
247 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
168 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
620 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
165 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
194 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 ...
10
votes
3answers
835 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
213 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
85 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, ...
4
votes
2answers
892 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
1k 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
345 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 ...
1
vote
2answers
167 views

Is it bad practice to follow up a call to a terminating function with exit()?

I'm currently working on a php frontend. Specifically, the authentication process. I'll spare everyone the exact details of the decision tree, but it includes a lot of checks and about half of them ...
0
votes
1answer
102 views

Significance of many-to-many relationships? [closed]

How important are to-many relationships in iOS programming? Do you often hold a list of pointers to objects in an array in your codes? I don't think I fully understand the concept of to-many ...
0
votes
1answer
110 views

return Trivial booleans?

I am writing a simple piece of code. Its a function that allowed the user to withdraw some money. There are some restrictions to this though. The user can't withdraw more than the given withdraw ...
0
votes
5answers
195 views

Fail-fast paradigm overheads

Fail-fast seems like a right way since it simplifies bug detection. But it's a harm for performance cause of multiple checking the same thing at several levels of the system. Simple example. There is ...
4
votes
3answers
213 views

is it a bad programming practice to return a new object in a property

I've always had this question and I think it is time to settle the answer, is it a heavy load to do this : public Rect Bounds { get { var Top = (_targetPosition ...
14
votes
2answers
650 views

Which is better: a bunch of getters or 1 method with a selection string parameter?

Our knowledge domain involves people walking over a pressure-recording plate with their bare feet. We do image recognition which results in objects of the 'Foot' class, if a human foot is recognized ...