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

6
votes
3answers
6k views

Is it a better practice pre-initialize attributes in a class, or to add them along the way?

I'm sorry if this is a ABSOLUTELY sophomoric question, but I'm curious what the best practices are out there, and I can't seem to find a good answer on Google. In Python, I usually use an empty class ...
4
votes
2answers
3k views

Why put a simple query into a stored procedure in a web service?

I'm working as a junior programmer, and the senior programmer above me has instructed me to follow a certain unofficial policy for constructing new queries on our web development projects. Generally, ...
1
vote
2answers
343 views

What are the problems which I will face if all the classes I use are loosely coupled

Loosely coupled classes gives flexibility. If I understand it right, Event flow, Observer Pattern and Design Patterns like MVC focus on loose coupling. So in this context I am aiming towards making a ...
14
votes
10answers
4k views

Preferring Python over C for Algorithmic Programming

I've been studying a bit of algorithms and have been looking at sites like SPOJ.pl TopCoder etc. I've seen that programmers prefer C or C++ usually for most algorithmic programming contests. Now ...
28
votes
15answers
2k views

Is it wise to be going back and forth between two programming languages? [closed]

I have been writing quite a lot of PHP for nearly two years. Now I am doing .NET (mainly c#) development. However, sometimes I go back and do some php. My main question is, is it wise for me to ...
82
votes
12answers
7k views

How big does my project need to be for me to unit test it? [closed]

I assume that my project is decoupled enough to allow for unit testing. But how big, exactly, in terms of clases and functions does my project need to be to make unit testing worthwhile? We all make ...
3
votes
2answers
209 views

How long does one have to wait to consider design change in code?

I had a few days ago. I was having trouble with threads. Had lots of questions asked on StackOverflow and honestly for the first time I did not get the answer I was looking for. Finally, I decided to ...
38
votes
12answers
5k views

Unwritten rules of rewriting another team member's code [on hold]

We are practicing collective code ownership. To my understanding this means that any developer can change any line of code to add functionality, to refactor, fix bugs or improve designs. But what ...
1
vote
3answers
282 views

Why categorization into “Property” and “Methods”

I am looking at the String class in Actionscript 3.0. It has a property called String.length . Internally it's a getter function (or method ?) that returns the length of string. Why can't it be ...
6
votes
4answers
2k views

What is a good starting point for small scale PHP development and would a framework be overkill?

I'm a web development intern working on a small PHP application (just a few pages with a little database access) which has fast become a couple of very non-DRY, non-OO, individual scripts. A ...
7
votes
4answers
684 views

Do some best practices depend on skill?

Is there evidence that some software development best practices depend on programming skill level? I mean, these methods are good, but maybe the way the are used or the extent might vary? This ...
1
vote
3answers
616 views

Next step after creating mock-up screens

I have created some mockup screens for my app in HTML/CSS. I have 4 screens in total. They contain no client-side coding i.e. Javascript or jQuery. The screens themselves are quite bland at the ...
0
votes
2answers
710 views

I cannot understand the application of oops How can I develop the understanding of application of oops? [closed]

I am a developer in PHP technology, I am aware of almost all the basics of OOPS, but still cannot find out the way to apply these concepts over a procedural programming. I do it in very orthodox way, ...
2
votes
3answers
2k views

Does mobile based (Android) development, benefit from Object Oriented Programming?

My development on Android is based on scientific programs and while I'm building these most of the code is in one or two long classes. When I come to deploy these programs I try to decouple everything ...
1
vote
1answer
195 views

How to handle encryption key with a large development team?

If we have a large development team, say 100, and we would like to keep our encryption key hidden from developers who are not directly involved in the encryption module/algorithm, what are some best ...
42
votes
17answers
4k views

Best practice on if/return

I want to know what is considered better way of returning when I have if statement. Example 1: public bool MyFunction() { // Get some string for this example string myString = GetString(); ...
0
votes
2answers
115 views

Guided Questioning iOS App

I'm making an iPad app that will display a few choices and based on your choice will display a series of questions with each question triggering a different set of questions. I was wondering if there ...
-1
votes
1answer
137 views

Are there any valid ways of eliminating/reducing state?

For definitions and examples of "state", see: http://en.wikipedia.org/wiki/Program_state , http://en.wikipedia.org/wiki/Finite_state_machine , http://en.wikipedia.org/wiki/State_diagram A diagram ...
1
vote
4answers
170 views

In a web application, is it ok to group multiple pages in one view class or one class per page?

If you are building a web application, and you have a user management component, is it recommended to do: class UserAdminView extends View { } or class UserAdminUpdateView extends View { } ...
15
votes
4answers
778 views

Can applications affect power consumption in a substantial way?

Is there anything that can be done for a single general purpose application to affect the power consumption of the device it is running on? I am not familiar with how optimizations to individual ...
1
vote
2answers
945 views

How do you accept arguments in the main.cpp file and reference another file?

I have a basic understanding of programming and I currently learning C++. I'm in the beginning phases of building my own CLI program for ubuntu. However, I have hit a few snags and I was wondering if ...
9
votes
7answers
971 views

Entry level engineer question regarding memory management

It has been a few months since I started my position as an entry level software developer. Now that I am past some learning curves (e.g. the language, jargon, syntax of VB and C#) I'm starting to ...
0
votes
1answer
139 views

Pending and Approval process

So let's say I have a DB table with 8 columns, one is a unique auto-incrementing used as ID. So I have a page that pulls in the info for each row based on query string ID. I want to give my users ...
2
votes
6answers
2k views

Dynamic Fields/Columns

What is the best way to allow for dynamic fields/database columns? For example, let's say we have a payroll system that allows a user to create unique salary structures for each employee. How ...
2
votes
4answers
672 views

The benefits of using RAII in C++ [duplicate]

Suppose I'm a teacher and I want to explain to my students what are the benefits of using RAII in C++: I need a very good example, full of details, but that is easy to understand. Which approach ...
18
votes
7answers
1k views

How to become a good team player?

I've been programming (obsessively) since I was 12. I am fairly knowledgeable across the spectrum of languages out there, from assembly, to C++, to Javascript, to Haskell, Lisp, and Qi. But all of ...
5
votes
4answers
3k views

using static methods and classes

I know that static methods/variables are associated with the class and not the objects of the class and are useful in situations when we need to keep count of, say the number of objects of the class ...
-3
votes
2answers
629 views

Microsoft UI stack

I am a C#, WPF developer and would like to know and understand the Microsoft UI Stack. I could not find much on the internet. I guess that this would be a huge topic, and might not be feasible to ...
8
votes
1answer
469 views

Is there a website where we can discuss and improve upon code snippets?

Is there a website where we can discuss and improve upon code snippets? For example, if I have written some function and want to know what others think of it.
1
vote
1answer
196 views

Best practice for writing a service

We currently have a C++ socket server used by a java client. All of the socket code in both C++ and java is stick-built at a low-level with messages passed via JSON strings. Are there cots packages ...
8
votes
1answer
210 views

Integrated ads in phone apps - how to avoid wasting battery?

Considering the PCWorld review that came out in March: Free Android Apps Packed with Ads are Major Battery Drains ...Researchers from Purdue University in collaboration with Microsoft claim ...
1
vote
1answer
135 views

Should I provide fallbacks for HTML5/CSS3 elements in a web page at this point?

I'm wondering if I should bother providing a fallback for HTML5 tags and attributes and CSS3 styling at this point in time. I know that there's probably still a lot of people out there who use older ...
10
votes
1answer
2k views

Best exception handling practices or recommendations? [closed]

I think the two main problems with my programs are my code structure/organization and my error handling. I'm reading Code Complete 2, but I need something to read for working with potential problems. ...
7
votes
3answers
254 views

Should I modify an entity with many parameters or with the entity itself?

We have a SOA-based system. The service methods are like: UpdateEntity(Entity entity) For small entities, it's all fine. However, when entities get bigger and bigger, to update one property we ...
6
votes
7answers
6k views

Non-zero exit status for clean exit

Is it acceptable to return a non-zero exit code if the program in question ran properly? For example, say I have a simple program that (only) does the following: Program takes N arguments. It returns ...
80
votes
17answers
5k views

Are my negative internship experiences representative of the real world? [closed]

I'm curious if my current experiences as an intern are representative of actual industry. As background, I'm through the better part of two computing majors and a math major at a major university; ...
2
votes
2answers
289 views

Reflective practice in programming using keystroke playback

I'm thinking of applying Reflective Practice to improving my programming skills. To that end, I want to be able to watch myself writing code. In general, what is a good method for applying ...
5
votes
5answers
585 views

When decomposing a large function, how can I avoid the complexity from the extra subfunctions?

Say I have a large function like the following: function do_lots_of_stuff(){ { //subpart 1 ... } ... { //subpart N ... } } a common pattern is to decompose it ...
3
votes
3answers
213 views

Which is more important in a web application code promotion hierarchy? production environment to repo resemblance or unidirectional propagation?

Lets say you have a code promotion hierarchy consisting of several environments, (the polar end) two of which are development (dev) and production (prod). Lets say you also have a web application ...
3
votes
5answers
816 views

How to deal with colleagues refuse to follow practices?

I was discussing with another colleague about what we should be used when an DB entity is referring to another. I don't think there is any good reason to break the practice of putting the Primary Key ...
36
votes
8answers
2k views

What is the term for a really BIG source code commit?

Sometimes when we check the commit history of a software, we may see that there are a few commits that are really BIG - they may change 10 or 20 files with hundreds of changed source code lines ...
36
votes
8answers
3k views

Is OOP becoming easier or harder? [closed]

When the concepts of Object Oriented Programming were introduced to programmers years back it looks interesting and programming was cleaner. OOP was like this Stock stock = new Stock(); ...
11
votes
7answers
401 views

Generalise variable usage inside code

I would like to know if it is a good practice to generalize variables (use single variable to store all the values). Consider simple example Strings querycre,queryins,queryup,querydel; querycre ...
4
votes
5answers
14k views

How to unit test a jsp file?

I'm developing a Java 6 EE application and I'm testing my jsp code with another one with a testing version of the function calls and code used in the original one but it seems loose and impractical. ...
5
votes
6answers
557 views

What are best practices when switching between projects/coming back to projects frequently?

The nature of my job is that I have to switch back and forth between projects every few weeks. I find that one of the biggest impediments to my productivity is the ramp-up time to getting all the ...
4
votes
3answers
3k views

is it a bad practice to call a View from another View in MVC?

I have some plain Views, they don't have any logic behind them (there is no action or controller behind them), their only propouse is to alert the user about something like "We have sent you an email ...
56
votes
22answers
4k views

Why do some programmers think there is a contrast between theory and practice? [closed]

Comparing software engineering with civil engineering, I was surprised to observe a different way of thinking: any civil engineer knows that if you want to build a small hut in the garden you can just ...
5
votes
3answers
310 views

When module calling gets ugly

Has this ever happened to you? You've got a suite of well designed, single-responsibility modules, covered by unit tests. In any higher-level function you code, you are (95% of the code) simply ...
11
votes
4answers
3k views

Motivation and use of move constructors in C++

I recently have been reading about move constructors in C++ (see e.g. here) and I am trying to understand how they work and when I should use them. As far as I understand, a move constructor is used ...
3
votes
5answers
422 views

returning null vs returning zero, which would be better?

I inherited a project that I am managing and having to maintain pending the redevelopment of the code base. At the moment I am being tasked with adding little features all over the place and have ...