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

5
votes
5answers
555 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
197 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
781 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 ...
33
votes
8answers
3k views

Is OOP becoming easier or harder?

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
396 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
12k 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
527 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
2k 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
308 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
2k 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 ...
1
vote
9answers
2k views

When calculating how many days between 2 dates, should you include both dates in the count, or neither, or 1?

I am trying to make an algorithm that counts the days between two dates, e.g. between 3/1/2012 and 3/2/2012. What is the correct answer, or the most popular choice? Should be the one I use? In ...
4
votes
2answers
422 views

Is it a good pattern that no objects should know more than what it needs to know?

I am implementing a controller class to manage a view. I have a file uploader class, Grabber, which could communicate in one of 2 ways: 1) Offer some kind of notification event to the controller on ...
0
votes
2answers
203 views

Asynchronous Designing and Programming

Me and a friend are looking to team up for some freelance web designing. We both are very strong PHP coders and website designers, but I am better at design and he is better at PHP. So, I'll be ...
37
votes
10answers
6k views

Is writing software in the absence of requirements a skill to possess or a situation I should avoid?

I find that some software developers are very adept at this, and often times are praised for their ability to deliver a working concept with abstract requirements. Frankly, this drives me crazy, and I ...
7
votes
3answers
828 views

Interfacing application code with unit tests

I am working on a project in which we have to implement and unit test some new module. I had a quite clear architecture in mind so I quickly wrote down the main classes and methods and then we started ...
5
votes
7answers
662 views

What are some ways to maintain codebases written in two languages that implement the same logic?

I have a logic intensive algorithm that I need to code in two languages (actually I finished it in one language satisfactorily and am about to start coding in the other language). By logic intensive ...
0
votes
3answers
357 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 ...
8
votes
2answers
923 views

How to optimise an sentiment analysis algorithm for larger data sets?

I am a noob to sentiment analysis and found a good resource for Bayesian Opinion Mining and a way to make it self improving. I was wondering though, if the optimum analysis is dependent upon the ...
0
votes
3answers
229 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 ...
2
votes
5answers
1k views

Effective way to gain practical knowledge

I am currently nearing the end of my first year of my CS degree and have been disappointed with the lack of coding I have been asked to do (one unit). I am basically looking for an effective way to ...
-4
votes
6answers
3k views

Is having two conditions in an IF statement faster than having two separate IF statements?

I just wonder if having two conditions in an IF statement executes faster than having it separated into two like these: Single Statement, two conditions if ( (conditionA == true) && ...
5
votes
1answer
888 views

How to unit test large legacy systems? [duplicate]

Possible Duplicate: Best practices for retrofitting legacy code with automated tests When working in large legacy systems (large systems with no unit testing ever) I often come across ...
9
votes
2answers
2k views

Properties under ARC: Always or public-only?

After reading an article humbly named "The Code Commandments: Best Practices for Objective-C Coding" by Robert McNally a little less than two years ago, I adopted the practice of using properties for ...
138
votes
13answers
32k views

Should we avoid object creation in Java?

I was told by a colleague that in Java object creation is the most expensive operation you could perform. So I can only conclude to create as few objects as possible. This seems somewhat to defeat ...
9
votes
5answers
1k views

How do companies keep websites hidden when in development?

I am new to this and also a new 19 year old PHP developer that just got hired so I am unsure as to how this works. Many companies when developing their websites keep their sites hidden from being ...
1
vote
1answer
240 views

Synchronously write file

I am implementing a server in C for a course project. The server should serve more than one client simultaneously. The description of the project states that fork() should be used to serve more than ...
2
votes
7answers
534 views

Should I refactor single letter variables for constructs like pointer/structure names?

And No, i am not referring to single variables in loops or exceptions. Lets say pointer/struct names in large c ,c++ programs . Are there any languages where this type of naming is acceptable or is ...
4
votes
1answer
2k views

How to avoid context switching while developing full stack web apps?

To give some context, I've been a Ruby & Rails developer for the past few years, and just recently started doing quite a lot of JavaScript to add more responsiveness to the apps. When programming ...
2
votes
2answers
667 views

Using a DSN database connection is a bad practice?

During all my professional lifetime that I have been programming in Windows enviroments, I advised my friends and coworkers to not use a DSN database connection in their applications, based on my own ...
-2
votes
2answers
216 views

Do you use interface as tagging system for the code? [closed]

Do you use interface as a tagging system for the code, or you have a better way to remember which object does what? how do you keep in mind a complex system, after the use of the abstraction.
2
votes
4answers
339 views

Linking in code comments (to other unique anchors/comments)

How would you recommend creating "anchors" in code comments, so that during maintenance, developers can easily cross-reference other code comments. I realise that software should be intelligently ...
14
votes
7answers
2k views

A defense for boilerplate?

To me, boilerplate code is obviously bad. However I've met a developer who displays resistance in any attempt to reduce boilerplate. I realized I didn't have a readily formed, well thought out ...
9
votes
3answers
453 views

How to gain personal practice at heavyweight development methodologies?

I'm in a new job where the project needs to meet strict quality standards, be heavily documented, managed in great detail, UML diagrams, and all those things that are opposite of "cowboy coding" where ...
4
votes
2answers
938 views

Manage query strings in JDBC methods

I am trying to find out which is the best practice when organising the PreparedStatement strings in a application which uses JDBC to connect to the database. Usually this is the way I retrieve the ...
5
votes
3answers
669 views

What should I consider when deciding if I should use a web service backend instead of traditional MVC?

We're trying to decide what architecture to use for an upcoming web application that will eventually have a mobile portion as well. The core of the project is a social networking web application, and ...
4
votes
5answers
331 views

Is it normal to feel like you forgot many things in language after a lapse? [closed]

I'm coming back to C++ after a month. I still didn't start practicing but seeing my old code gives me nauseous feeling like I'm seeing something new even with simple small code. Is this normal? Will ...
13
votes
2answers
2k views

Best overview to modern C++ paradigms? [closed]

I used to write C++ extensively between 8 and 10 years ago. I have since moved on to C# for professional reasons. However, from time to time I see statements like "If you're still manually ...
20
votes
9answers
6k views

Alternatives to the singleton pattern

I have read different opinions about the singleton pattern. Some maintain that it should be avoided at all costs and others that it can be be useful in certain situations. One situation in which I ...
8
votes
3answers
634 views

When comparing a combination of String literals, is it convention to call .equals() on the literal? [closed]

There are benefits to each, and I understand the differences - but what is considered best / standard practice? Why? "myString".equals(myStringVar) Avoids a potential NPE and does not require a ...
2
votes
11answers
312 views

Build functionality around the design, or the other way around?

When you build an application, is it better to design the UI first (in Photoshop or whatever), then implement the functionality following the UI you just designed, or do the programming and build the ...
4
votes
5answers
513 views

variable comparison without initialising

I am working with a project in VC++ which involves co-ordinate system having x,y,z axis. I am trying to check for if a variable(Point with x,y,z values) is assigned on the coordinate system or its a ...
2
votes
3answers
2k views

Any Course/Lecture videos on Design Patterns

I am planning to read some design patterns and I took the book on "design patterns in C++' by gang of four. However, I am not really some one who reads book and prefers reading slides/watching course ...
14
votes
4answers
958 views

Writing a company-wide developer's handbook

I work for a small company. The software development arm of the company before I was hired consisted of one self-taught overworked guy. Now that I've been writing software for the company for a few ...
-3
votes
1answer
774 views

Writing-Reading a hashtable to a text file

I'm implementing a hashtable structure for a dictionary. Dictionary is in a text file. There are 2 words on each line. I'm generating the hashtable by using the first word as a key. I'm holding the ...
18
votes
7answers
801 views

How to improve the training of students regarding maintainability? [closed]

Maintainability is a major stake of professional software development. Indeed, maintenance is nearly always the longest part of a software life cycle, as it lasts from the project release until ...
6
votes
2answers
253 views

Any recognized convention for repository changelogs?

We use TortoiseSVN, but we have no bug tracking system. I know, lame, but beyond my control. There were times when svn wasn't in daily use. Now I've had succeeded in pressing for using it regularly, ...
1
vote
1answer
857 views

Effective programming of data layer management/access

Short Version: What is the term/concept which describes the efficient design of programming the data layer for efficient data access and what are some sources/books/articles/website which discuss this ...