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

15
votes
18answers
4k views

New grad with my first programming job lined up: What is the advice you wish you had at this stage? [closed]

I am a new grad with what appears to be my first job lined up (1 solid offer, another place still courting me, so not sure exactly what I will be doing yet). What advice do you wish you had when you ...
-2
votes
1answer
33 views

Considerations when making data structure and algorithm choices [on hold]

What are some reasons you may choose a worse runtime algorithm? And what are some advantages of a linked list vs a hash table/array where access is constant time.
8
votes
2answers
598 views

Can I ask the job interviewer to show me their code before joining the company? [duplicate]

Possible Duplicate: Asking for a code sample of the company at an interview Last year I changed jobs twice.. In the interviews with the companies, everything was so ideal and perfect. ...
2
votes
4answers
67 views

Keeping a ratio column that's the division between two other columns

I'm about to build a SQL table where I want to store currency orders. That means that I need to store how much I paid for a certain quantity, and the ratio between both quantities. So for example: ...
1
vote
1answer
46 views

Service/component based application in Java

I have a Java project whose architecture is quite component-oriented, and I am wondering if this is a common way to organize code which rules/patterns are used, if there is a name for this coding ...
2
votes
4answers
137 views

Cleanup & Arrange practices during unit testing to avoid dirty databases

I'm coding UnitTest in C# and I settled with this structure: try { // ========== // ARRANGE // ========== // Insert into the database all test data I'll need during the test // ...
21
votes
8answers
2k views

How did you become a const correctness convert? [closed]

After 15 years of C++, I've still haven't learn to love using const. I understand it's use, but I've never actually been in situation where being const correct would have avoided the problem I was ...
0
votes
1answer
99 views

JavaScript & AngularJs Modules Implementation technique and structure

So Im building an app and I'm trying to implement the structure of the app so that its robust and scalable in future. My app is mostly divided into JavaScript Modules (revealing pattern): // ...
6
votes
3answers
358 views

When testing is it OK to use a method of the subject to test another method of the subject?

I have two methods in the same helper class one that creates an image (createImage) and one that compares two images (compareImages). Image createImage(Data data); Boolean compareImages(Image from, ...
40
votes
1answer
3k views

Why do programmers use `Acme` as a package, namespace or directory name [closed]

This may or may not be a silly question, but I really would like to know the answer to something which has been bothering me for a while. I quite often see programming examples/conventions where the ...
41
votes
8answers
4k views

When is it appropriate to make a separate function when there will only ever be a single call to said function? [duplicate]

We are designing coding standards, and are having disagreements as to if it is ever appropriate to break code out into separate functions within a class, when those functions will only ever be called ...
12
votes
4answers
1k views

How to do Test Driven Development

I have just 2+ years of experience in application development. In those two years my approach towards development was as following Analyze requirements Identity Core component/Objects, Required ...
25
votes
12answers
2k views

Industry has no place for passionate programmers? [closed]

I've been interning at a place where my manager believes that if you are in a, product company, then you generally spend time tweaking the product and sometimes adding some features, or service ...
10
votes
3answers
441 views

Is it bad to refer to access array elements via pointer arithmetic instead of the [] operator?

I've just started learning to program in C, and to improve my understanding of pointers and arrays, I tried to refer to the elements of an array without creating any pointer at all: for(k1 = 0; k1 ...
59
votes
16answers
9k views

Is the creation of brand new software generally a major part of most programming jobs? [closed]

I have worked in software development for over 10 years now, and it's dawning on me that I rarely get to create anything "new". I realize that "new" is a vague term, but I would define it as anything ...
77
votes
12answers
8k views

Does programming in general become easier to read, write and understand as you gain experience?

I'm a beginner in programming and I've been reading books, studying, reading articles, and whatnot. I'm getting great results since I've started learning programming, and when I was a beginner I used ...
1
vote
5answers
740 views

“Opportunity” to take over maintenance of a small internal website. What should I do?

I have been offered an "opportunity" to take over maintenance of a small internal website run by my group that provides information about schedules and photos of events the groups done. My manager ...
0
votes
4answers
564 views

How do you create interest in your projects? [duplicate]

Possible Duplicate: Ideas to get you programming mojo back? Its almost 10 years for me working in Java based applications (mainly on Web). Sometimes I feel really bored of the regular ...
1
vote
1answer
166 views

what is the task of a coach in acm programming contests? [closed]

In the university that I am working they have decided to participate in the ACM regionals for the first time, they would like to appoint me like a coach. I have never been into that situation before ...
1
vote
1answer
216 views

How does a competition like Rails Rumble Work?

I am not sure weather it is a proper question to ask out here but it is really bothering for a while. As the official website writes: The Rails Rumble is a distributed programming competition ...
4
votes
1answer
416 views

How to handle the input file provided in programming contests?

In programming contests like Google CodeJam, Facebook Hacker Cup, each question is provided with an input file for testing one's code for that program. I get struck at this point only. I don't ...
0
votes
2answers
187 views

Create the fields in class level then instantiate inside methods or create and instantiated inside methods

I'm a newbie in software development. Just wondering which code is better and why should I continue which pattern I should follow. First Snippet: Class TestClass { private Object1 field = null; ...
4
votes
4answers
175 views

Best practice for getting last record inserted in DB

Me and a couple of colleagues are having a discussion regarding the following case: In an OrderStatus table we're keeping track of all the statuses an order goes through in time, including ...
5
votes
3answers
2k views

Should a method do one thing and be good at it? [duplicate]

"Extract Till You Drop" is someting I've read in Uncle Bob's blog, meaning that a method should do one thing alone be good at it. What is that one thing? When should you stop extracting methods? ...
29
votes
15answers
5k views

How can I automate production deployments without experiencing extreme anxiety?

At our shop we use SVN for source control and CruiseControl for CI on handling automatic builds and deployments to our development, test, and integration environments. This all works smoothly however ...
1
vote
0answers
65 views

Function to return a string - Which is cleaner? [migrated]

I was having a discussion with my coworker about a function that returns either an empty string, or a string of a css class. The function is passed an object which has an HTTP status code, and then ...
11
votes
7answers
794 views

Which specific practices could be called “software craftsmanship” rather than “software engineering”? [closed]

Although not a new idea there seems to have been a big increase in the interest in software craftsmanship over the last couple of years (notably the often recommended book Clean Code's full title is ...
42
votes
6answers
9k views

Is it better to check `c >= '0'` or `c >= 48`?

After a discussion with some my colleagues, I've a 'philosophical' question about how treat the char data type in Java, following the best practices. Suppose a simple scenario (obviously this is only ...
2
votes
1answer
2k views

Approaches to reduce cyclomatic complexity

I was running our code through JSHint, and decided to switch checks against cyclomatic complexity, and then went on long refactoring sprint. One place though baffled me, here is a code snippet: var ...
26
votes
7answers
11k views

What's wrong with being a code monkey? (Or, what is a code monkey?) [closed]

Programmers tend to talk about being a "code monkey" in a derogatory way. "Don't work there, you will just be a code monkey!". I have two offers for jobs, one at a small company, one at a very large ...
2
votes
3answers
88 views

Location of development solutions on disk - Common or upto the individual

In our team meeting today a senior member brought up the proposal that we should be having a common location/structure for our development solutions. A couple of his points were: Making it common ...
57
votes
8answers
5k views

If I need to use a piece of memory throughout the lifespan of my program, is it really necessary to free it right before program termination?

In many books and tutorials, I've heard the practice of memory management stressed and felt that some mysterious and terrible things would happen if I didn't free memory after I'm done using it. I ...
53
votes
8answers
6k views

How can we be certain that the lower components of computer programming like compilers, assemblers, machine instructions, etc. are flawless?

Since we are becoming more and more reliant on computing, including very critical tasks of day-to-day life, I was just wondering how those vital components are tested. More technically, how are the ...
215
votes
16answers
16k views

Project is nearly done, but procedural spaghetti code. Do I rewrite or just keep trying to ship it? [closed]

I'm a beginner web developer (one year of experience). A couple of weeks after graduating, I got offered a job to build a web application for a company whose owner is not much of a tech guy. He ...
9
votes
9answers
837 views

Micro-optimizing - BAD vs Game Development

In game development there is a lot of C/C++, in business applications C#. I have seen C/C++ devs express concern over how a single line of code translates to assembly. In .NET some go into IL, ...
1
vote
3answers
137 views

When a class represents a property that might be invalid, how should the validation be done?

I have a Product class which has among others an attribute Ean13 that encapsulates an EAN13 code. Here is a prototype of the Product class: @Entity @Table(name = "tb_produtos") public class Product ...
2
votes
0answers
31 views

Should my application call statsd directly or should I call statsd based off logs?

I'm planning on incrementing counters in statsd based of various events within my application. I have logging in place for these events. So, from my viewpoint I have two options: Update the ...
3
votes
3answers
59 views

Handling Value Unit data

We have some data that is strongly bound to each other and we are using it for calculations. Its a value with a unit type and an optional relation. E.g. 1500 meter above sea level. The unit type ...
4
votes
1answer
49 views

Signature-changing decorator: properly documenting additional argument

Let's say I have a custom decorator, and I want it to properly handle docstring of decorated function. Problem is: my decorator adds an argument. from functools import wraps def ...
0
votes
3answers
396 views

Software design approach for large relational database

I am working on a personal side project that will utilize a complex and large relational database. During the design of the database I had some co-workers give advice to how I should approach my ...
6
votes
1answer
105 views

Is there a standardized practice for ordering attributes in HTML tags?

Thanks for looking. I am working on an AngularJS project and the attributes are numerous in many of my HTML elements: <button type="submit" ng-click="Page.UI.DetailView.ExecuteFunction()" ...
7
votes
2answers
4k views

Might starting variables/members with an underscore puzzle the compiler?

I've been taught since high school that defining variables like this: int _a; or int __a; should be consider bad practice because this would eventually puzzle compilers that use variables starting ...
190
votes
17answers
20k views

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

How would one know if the code one has created is easily readable, understandable, and maintainable? Of course from the author's point of view the code is readable and maintainable, because the author ...
2
votes
1answer
184 views

How to implement a facade correctly

I have read multiple websites on this topic but none of them gave me a 'good' solution for the problem I am having. The problem is described in the following (related) questions: How do I couple the ...
9
votes
7answers
2k views

Checking if a method returns false: assign result to temporary variable, or put method invocation directly in conditional?

Is it a good practice to call a method that returns true or false values in an if statement? Something like this: private void VerifyAccount() { if (!ValidateCredentials(txtUser.Text, ...
1
vote
2answers
84 views

Throwing exceptions in application configuration providers

Simple question: What is the best/common practice regarding to throwing errors for application configuration providers? Given is a simple key/value-based configuration source: class Configuration ...
5
votes
6answers
539 views

Is it an overkill to write unit tests for a small code base? [duplicate]

I am the sole maintainer of a code base of about 2000 lines of code. It's not big, but over time the code became so unmaintainable my boss agreed to give me time to rewrite it from scratch. Since the ...
49
votes
6answers
3k views

Is making a small change, testing it, then “rinse and repeat”, a bad habit?

I am a programmer with a number of years of experience. I realized I got a certain habit. I'm not sure whether it's really a bad habit or not. I get a list of tasks to perform for a solution, even ...
1
vote
1answer
101 views

Extensible way to create bash program

I have a bash script that should be extensible with additional functions with as little change to the script as possible. The basic function is as follows. It loops through a list of files to check. ...
11
votes
5answers
687 views

For what reasons should I keep “using” section clean in C#?

Once when I was refactoring my code, I went up the IDE to the using section of my C# class, and cleaned unused namespaces and duplicate namespaces, and sorted them all. My pair (pair programming) ...