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

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
307 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
421 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
201 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
790 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
642 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
353 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
920 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
870 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 ...
126
votes
13answers
30k 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
235 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
531 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
618 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
333 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
450 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
926 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
649 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
617 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
498 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
928 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
703 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
797 views

How to improve the training of students regarding maintainability?

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
252 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
809 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 ...
15
votes
6answers
5k views

Efficient try / catch block usage?

Should catch blocks be used for writing logic i.e. handle flow control etc? Or just for throwing exceptions? Does it effect efficiency or maintainability of code? What are the side effects (if there ...
4
votes
6answers
1k views

The bracketless if statement is frowned upon, but is it still bad style if your IDE is equipped for it?

This type of conditional statement is generally frowned upon if(condition) statement; because if you add another statement, like this if(condition) statement; statement; it gives the ...
6
votes
3answers
417 views

What is your approach to multi-paradigm programming?

I have been learning some Ruby recently and I had the following experience. I had written a small tool of about 200 lines of code and, as an inexperienced Ruby programmer, I had used several loops to ...
7
votes
5answers
464 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) ...
5
votes
5answers
1k views

How not to degenerate into only a programmer who stitches together APIs? [closed]

This one I heard when I was recently interviewing a person and asked him why he was looking for a change within an year of joining his previous company. Particularly a company which is known to be in ...
9
votes
5answers
1k views

When to stop inheritance?

Once upon time ago I asked a question on Stack Overflow about inheritance. I have said I design chess engine in OOP fashion. So I inherit all my pieces from Piece abstract class but inheritance still ...
3
votes
3answers
262 views

How to be productive as an infrequent programmer?

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 ...
5
votes
4answers
256 views

Should I include dependencies for which I have the source as projects in my solution?

We have various projects in source control for web and desktop applications. Invariably, many of them use third-party open source projects or even common libraries within our organization as ...