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

-3
votes
0answers
21 views

E-olymp: Cake. Giving Wrong Answer

Cake This is the question. While I am submitting in normal Gnu C++ then it is giving 27% accurate result and when I am submitting in Gnu C++ 4.7.1 then it is giving 8% accurate result?? What is the ...
4
votes
3answers
72 views

Creating two-way object references and keeping data integrity

I have two different classes; a Player and a Group. I need to be able to query a Player which Groups they are registered to (player.getGroups()), and which Players are registered to a Group ...
-4
votes
0answers
167 views

China Style - How to code faster? [on hold]

Background: I've joined a Mainland Chinese company where it suppose to be a relaxing environment not until the newly appointed TL that keep rushing us. He succeeded to create a very stressful ...
3
votes
1answer
540 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 ...
1
vote
3answers
54 views

Programming to an Interface and Interface Segregation in the Context of a User Class

I try to program to an interface whenever possible, but its not clear to me how I could apply it to a model as broad as a user. Which can hold many disparate fields (name, age, phone number, ssn, ...
1
vote
1answer
124 views

What is the best way to remember a successful execution over several program calls?

I'm working on a build process, that is called manually over the command line. To check if it exited unsuccessfully during the build I want to set a lock file (symbolic link) and remove it on ...
-2
votes
1answer
58 views

Programming to an Interface and Keep Testability in Unique Classes [duplicate]

I try to program to an interface whenever possible, but when I have a class that fulfills a very specific and unique purpose, one that can't be abstracted. Is it correct for me to say that I've ...
-3
votes
0answers
36 views

Fastest way to gather Provider data [on hold]

What's the most efficient and quickest way of mining medical providers data in order to list them under a website and categorize them by city and state? Is it through an algorithm?
24
votes
11answers
2k views

Is it okay to use a language that isn't supported by your company for some tasks?

I work for a company that supports several languages: COBOL, VB6, C# and Java. I use those languages for my primary work, but I often find myself to coding some minor programs (e.g. scripts) in Python ...
0
votes
0answers
30 views

Logging private data

In general, I write a debug log whenever one of my functions is entered, including the parameters. For instance: function execute_query($query, $conn_string) { ...
32
votes
9answers
4k views

Why would a program use a closure?

After reading many posts explaining closures here I'm still missing a key concept: Why write a closure? What specific task would a programmer be performing that might be best served by a closure? ...
16
votes
2answers
317 views

Has variable width types been replaced by fixed types in modern C?

I came across an interesting point today in a review over on Code Review. @Veedrac recommened in this answer that variable size types (e.g. int and long) be replaced with fixed size types like ...
0
votes
2answers
75 views

guideline on void methods that do not throw exceptions

In our codebase I saw a method that is similar to following: public void doSomething() { try { ... } catch (Exception e) { ... //log something ... } } ...
1
vote
1answer
33 views

Filtering additions to a list

Hopefully Iʼm posting this in the right SX, and Iʼve tagged it correctly. I have a legacy system that Iʼm making additions to which contains a custom list object. This list object can contain two ...
17
votes
8answers
3k views

Importance of bitwise thinking [duplicate]

I take interview for my company. During interview I've faced many candidates having 1 to 3 years of experience in their field. Typically, they had experience in C#, Java, J2ME, iOS and similar ...
5
votes
1answer
103 views

Modern Interpretation of the Unix Philosophy of “Rule of Generation”

According to Wikipedia, Eric S. Raymond said that one of the 17 Rules of Unix is the "Rule of Generation", stating that: Developers should avoid writing code by hand and instead write abstract ...
4
votes
3answers
346 views

@SuppressWarnings in generic array declaration

While doing a coding test, I ran into a problem where I need to initialize an array of generic type in Java. While trying to figure out how to do that, I looked at this Stack Overflow question and it ...
0
votes
6answers
118 views

Would you create a specialized type just to wrap a primitive? [duplicate]

Often times in programming, we need to represent some value which can easily be represented using a simple primitive type. For example, in a game we might need to represent the velocity of a moving ...
1
vote
3answers
73 views

Using auto-increment clustered key and guid primary key together

My boss is the db administrator in a new software project and he came up with that design where every table will have both a auto-increment clustered key and a guid primary key (or possibly composite ...
0
votes
4answers
252 views

Checking for emptiness of collections with (in)equalities - what's the best practice?

For a long time now I've been in the habit of checking whether a collection (array, dictionary, whatever) is non-empty with a nonequality. Like this: if ( MyArray.Length < 1 ) { // Do ...
29
votes
9answers
9k views

Should the methods of a class call its own getters and setters?

Where I work I see lots of classes that do things like this: public class ClassThatCallsItsOwnGettersAndSetters { private String field; public String getField() { return field; ...
242
votes
16answers
42k views

Why are shortcuts like x += y considered good practice?

I have no idea what these are actually called, but I see them all the time. The Python implementation is something like: x += 5 as a shorthand notation for x = x + 5. But why is this considered good ...
0
votes
0answers
27 views

What are some common patterns for managing a polyglot persistence layer?

I am pretty interested in the idea of using multiple datastores to support a single application and understand the benefits in theory but would like to know a little more about how things are done in ...
22
votes
12answers
2k views

Should developers be forced to check-in before leaving work each day, even if the code does not compile? [on hold]

During a previous consulting position, the developers where told to check-in code on a nightly basis, regardless if it complied or was complete. Managers were afraid of losing any code and said now we ...
2
votes
2answers
39 views

WCF service with methods to fetch data

I'm planning on building a WCF service that will fetch data entities from a Sql Server database. And I'm currently struggling with best practices issues. The thing is that there's a few different ...
6
votes
2answers
164 views

Is there something peculiar to Matlab or Mathworks that supports so much “undocumented” code?

I've been drilling into a lot of Matlab recently trying to interface with an in house algorithm engineer's work to modularize it for use in a test bench outside his suite of applications. I've come ...
86
votes
5answers
32k views

Choosing between Single or multiple projects in a git repository?

In a git environment, where we have modularized most projects, we're facing the one project per repository or multiple projects per repository design issue. Let's consider a modularized project: ...
1
vote
3answers
70 views

When is a event listener invoked during program execution?

I am using the Obervable-Observer Pattern. MyClass extends Observable{ invokeListeners(){ doSomething; setChanged(); notifyListeners();//This invokes onUpdate() in "implements ...
6
votes
2answers
1k views

What is the difference between function() and function(void)?

I have heard that it is a good practice to write functions that do not receive anything as a parameter like this: int func(void); But I hear that the right way to express that is like this: int ...
1
vote
1answer
25 views

Rails validation: Which method is preferred

In Ruby on Rails there are two ways to validate, for instance, the presence of input fields. Say I want to make sure the user has filled out my fields called value and name. I could put in my model ...
76
votes
14answers
8k views

Is my mentor's concern for code quality excessive? [closed]

To tell you a little about myself: I'm a newbie programmer working internships and learning a lot from experienced programmers. I can't believe I used to think I was good in college. The one I'm ...
-2
votes
0answers
19 views

Instance Variables Not Updating [migrated]

When I run my little game, battle commences but after every turn, the players attack but health doesn't go down (i.e. the game never ends and it keeps printing the same health over and over). I know ...
-1
votes
0answers
41 views

Should I spend time cleaning code I don't touch? [duplicate]

One piece if advice I've seen frequently on this SE is the "Boyscout Rule", which is: "Always check a module in cleaner than when you checked it out." Boyscout Rule Good words to live by when ...
3
votes
3answers
109 views

How to maintain modularity in C?

I am writing C code with multiple modules like LCD display, flash memory, and GSM module etc. The project consists of thousands of lines of code, in different files. The behavior of the system can be ...
3
votes
2answers
131 views

What is a proper way to chain instructions if previous one is ok [duplicate]

I'm currently working on a big file I have to parse and process and each step needs to be done in an order as I do SQL queries and need inserted IDs to make other insertions ... The problem is I often ...
0
votes
0answers
99 views

Test-first iterative development in Common Lisp environment

Given: I want to practice proper test-first, continuous delivery-style software development in Common Lisp environment. Problem: How each red-green-refactor iteration of the process should look ...
158
votes
23answers
16k views

How would you know if you've written readable and easily maintainable code?

How would one know if the code he has created is easily maintainable and readable? Of course in your point of view (the one who actually wrote the code) your code is readable and maintainable, but we ...
0
votes
0answers
38 views

Implementing peristent events using WCF-MSMQ

I am implementing a WCF-MSMQ based message queue that will follow the pub-sub model in which multiple publishers would publish an event and multiple subscriber would listen to it i.e a many to many ...
6
votes
1answer
621 views

What benefits do I get from learning Scheme?

I'm a java programmer and I've decided to learn a bit about theoretical computer science. I don't have a degree in that and a little background would help me a lot since I don't know anything other ...
2
votes
1answer
120 views

C Module - Where to put prototypes and definitions that do not belong to the public interface?

Since I am mainly an Electrical Engineer, forgive me if I am somewhat off with some terminology. I am currently programming a display driver/interface module. And like so many times before, I have ...
3
votes
3answers
292 views

How to be productive as an infrequent programmer? [closed]

My current day job is mostly project management and client liaison work, but I sometimes get involved in actual coding. I do this either because I have a clear vision of what I want the result to look ...
2
votes
1answer
170 views

Events in WCF Service Architecture (Server Side)

Problem: Now, I have some events that will take place when the client submits a request to the server. These events will arise on the server and they will be subscribed by the services themselves ...
3
votes
3answers
639 views

If possible, would it be a bad practice to use Nullable for non value types?

Update After writing this question I found out that Nullable<T> has a type constraint of struct on T so you cannot actually use Nullable for reference types. However, some good answers ...
1
vote
2answers
108 views

Non-printable characters and editors

Today I was presented with a very nasty problem and I do not quite know where to ask this but hope here is ok. So I have the following string: "\0" (at least that's how it looks in visual studio). If ...
1
vote
1answer
47 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 ...
49
votes
7answers
7k views

Is it good that testers are competing to see who opens more bugs?

I'm a software developer. There is a team of testers who follow and run test cases written by the analyst, but also perform exploratory testing. It seems like the testers have been competing to see ...
5
votes
1answer
120 views

Good way to program an orchestration / processflow

I'm programming a process in which clients will be separated in 3 different groups, and for every group a different action will be performed. My question concerns the process of deciding which client ...
75
votes
7answers
7k views

Short circuit evaluation, is it bad practice?

Something that I've known for a while but never considered is that in most languages it is possible to give priority to operators in an if statement based on their order. I often use this as a way to ...
-2
votes
1answer
79 views

Copying desired bits from variables [closed]

What's the best way to copy desired bits from char, int or any other variables? I want to see all possible and the most efficient techniques for this purpose. I have for example 16bit variable 0000 ...
2
votes
1answer
56 views

Making use of constant data

My team is working on an android app. A co-worker and I have different ideas on how to load constant data. To clarify, the data we are going to use are 100 × (n × 〈integer-integer pair〉) where 10 ...