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
5answers
599 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
128 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
115 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
vote
0answers
128 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
271 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 ...
1
vote
1answer
64 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
125 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
478 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
218 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
119 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
73 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
247 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
542 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
137 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 ...
15
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
166 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
212 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
55 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
89 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
484 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
183 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
132 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
277 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
170 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
866 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
175 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
199 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
984 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 ...
4
votes
3answers
243 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
86 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
900 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
2k 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
352 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
184 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
119 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
112 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
249 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 ...
5
votes
6answers
420 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
666 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 ...
-1
votes
1answer
258 views

How big can a mobile development team be without being too big? [closed]

I work for a company that is moving heavily into mobile. We find the majority of our customers use our mobile app pretty regularly. We have tons of things we want to add to it -- as well as to ...
5
votes
6answers
5k views

Is CSV a good alternative to XML and JSON? [closed]

Is CSV considered a good option against XML and JSON for programming languages? I generally use XML and JSON (or sometimes a plain text file) as flat file storage. However, recently I came across an ...
1
vote
2answers
175 views

Parser and interpreter knowledge as a way to gauge programmer ability [closed]

This is only anecdotal evidence but from my past encounters with programmers at various workplaces the programmers that understand the fundamentals of parsing and interpreting seem to be overall ...
0
votes
2answers
430 views

In PHP, should I delete objects immediately after use?

I've read in PHP Advanced and Object Oriented Programming by Larry Ullman that it is good programming practice to delete object immediately after use but reason is given nowhere. I am a student web ...
2
votes
1answer
92 views

Are there any known effects on cognitive load of many files with one file per object?

There has been a trend in the Ruby/Rails community to create lots of objects that have very small functionality (SRP anyone?) and live in their own file. These are often extracted from large, bloated ...
0
votes
2answers
274 views

Is there any way without looking at the source code to know how modular the code is [closed]

I've been working with TDD, most patterns, mostly OO code and still not found a way of knowing if a particular piece of code confirms to modularity , without the need reviewing the code. On a recent ...
1
vote
2answers
72 views

Auto Transaction Failsafe's, Third Party API's, Coldfusion Schedule Files

I have an automated invoicing web app and I'm trying to build in some failsafes and a structure that will, under no circumstance, allow an invoice to be double charged. All things working perfectly, ...
0
votes
0answers
61 views

Access Control List with many roles

I normally have 2 roles in most of my websites, i.e. Admin and Member and create one folder for each Role like /Root /admin /member but now I have come up with 10 Roles besides Admin and ...