The tag has no wiki summary.

learn more… | top users | synonyms

1
vote
4answers
299 views

Try/Catch or test parameters [duplicate]

Possible Duplicate: Arguments for or against using Try/Catch as logical operators Efficient try / catch block usage? I was recently on a job interview and I was given a task to write ...
5
votes
2answers
1k views

Constant values in the interface

Some time ago I have read two different books and each of them gives totally different answer for the question if it is a good pattern to define constant values in the interface (in java). So I am ...
10
votes
7answers
934 views

Is it bad style to redundantly check a condition?

I often get to positions in my code where I find myself checking a specific condition over and over again. I want to give you a small example: suppose there is a text file which contains lines ...
2
votes
1answer
263 views

Effective handling of variables in non-object oriented programming

What is the best method to use and share variables between functions in non object-oriented program languages? Let's say that I use 10 parameters from DB, ID and 9 other values linked to it. I need ...
19
votes
7answers
1k views

Does software rot refer primarily to performance, or to messy code?

Wikipedia's definition of software rot focuses on the performance of the software. This is a different usage than I am used to; I had thought of it much more in terms of the cleanliness and design of ...
4
votes
4answers
607 views

Reusable VS clean code - where's the balance?

Let's say I have a data model for a blog posts and have two use-cases of that model - getting all blogposts and getting only blogposts which were written by specific author. There are basically two ...
103
votes
11answers
33k views

Why is Clean Code suggesting avoiding protected variables?

Clean Code suggests avoiding protected variables in the "Vertical Distance" section of the "Formatting" chapter: Concepts that are closely related should be kept vertically close to each other. ...
24
votes
5answers
2k views

Pass ID or Object?

When providing a business logic method to get a domain entity, should the parameter accept an object or an ID? For example, should we do this: public Foo GetItem(int id) {} or this: public Foo ...
3
votes
4answers
784 views

What pitfalls are inherent in using partial classes?

Over at this question in the comments I mentioned that I heard that partial classes are best avoided if possible. What if any is the reason for this sentiment? Or If this is an invalid sentiment, how ...
15
votes
8answers
1k views

Ways to break the “Syndrome of the perfect programmer” [closed]

I am probably not the only one that feel that way. But I have what I tend to call "The syndrome of the perfect programmer" which many might say is the same as being perfectionist but in this case it's ...
6
votes
4answers
251 views

How do I link an domain object in memory to its database records without cluttering the domain with database concerns?

Your domain model contains a set of objects. I'm here presenting a side project, but I have a much more complicated work project falling to its knees because I didn't do a good separation of the ...
7
votes
4answers
802 views

Design pattern for handling a response

Most of the time when I'm writing some code that handles the response for a certain function call I get the following code structure: example: This is a function that will handle the authentication ...
9
votes
3answers
629 views

Do I suffer from encapsulation overuse?

I have noticed something in my code in various projects that seems like code smell to me and something bad to do, but I can't deal with it. While trying to write "clean code" I tend to over-use ...
12
votes
5answers
3k views

The rule of 5 - to use it or not?

The rule of 3 (the rule of 5 in the new c++ standard) states : If you need to explicitly declare either the destructor, copy constructor or copy assignment operator yourself, you probably need to ...
11
votes
6answers
903 views

Is there a case study that convincingly demonstrates that clean code improved development?

I'm in my first real job as programmer and what I see is just the "Big Ball of Mud" code (without useful comments too), but I like to do clean code, and it's really hard for me to code in a worse way. ...
3
votes
1answer
598 views

Is Ruby on Rails' Active Record an example of Aspect-Oriented Programming?

From Clean Code, about Cross-Cutting Concerns: Note that concerns like persistence tend to cut across the natural object boundaries of a domain. You want to persist all your objects using ...
5
votes
3answers
619 views

Is the COCOMO model a good argument when defending a programming language choice?

Currently, I'm following a course on embedded software development. The lecturer has chosen J as an architecture language for model-driven software development. J itself is a very terse programming ...
27
votes
9answers
2k views

How clean should new code be? [duplicate]

I'm the lead designer in our team, which means I'm responsible for the quality of the code; functionality, maintainability and readability. How clean should I require my team members' code to be if ...
46
votes
20answers
4k views

Should you write good documentation and clean code to increase the “Bus Factor”?

One of the main goals of software development companies is to increase their Bus factor This is also advocated in a talk that was organized by Google. That means that you should code and document ...
14
votes
4answers
2k views

Is code like this a “train wreck” (in violation of Law of Demeter)?

Browsing through some code I've written, I came across the following construct which got me thinking. At a first glance, it seems clean enough. Yes, in the actual code the getLocation() method has a ...
95
votes
16answers
5k views

Should I remove unreferenced code?

I'm working on a medium sized (100k lines) code base, it's all relatively recent code (less than a year old) and has good unit test coverage. I keep coming across methods which are either no longer ...
28
votes
12answers
3k views

What is best practice on ordering parameters in a function?

Sometimes (rarely), it seems that creating a function that takes a decent amount of parameters is the best route. However, when I do, I feel like I'm often choosing the ordering of the parameters at ...
4
votes
3answers
319 views

UnitTests, will cleaning up your act-statement make your test more or less clear?

Lets say that we are testing FooClass with the following method: public void Foo(string stringParameter, int intParameter, Action<Bar> successCallback, Action<Exception> ...
15
votes
15answers
1k views

Is there any benefit to obsession with making code “look pretty”?

Sometimes I spend ridiculous amounts of time (hours) agonizing over making code "look pretty". I mean making things look symmetrical. I will actually rapidly scroll through an entire class to see if ...
13
votes
3answers
360 views

Low impact refactoring and code cleaning of sloppy code while waiting for requirements

I inherited an existing code base for a product that is reprehensibly sloppy. The fundamental design is woefully inadequate which unfortunately I can do little about without a complete refactor (HIGH ...
2
votes
3answers
327 views

Where should I include comments in my “self-documenting code”?

I'm currently developing a web-app by myself and have made it a point to use descriptive variable and method names (sometimes at the expense of brevity) in order to minimize commenting. The plan was ...
5
votes
2answers
1k views

What to do with private fields with getters and setters in Java [duplicate]

When are Getters and Setters Justified is an excellent question which focuses on using getters and setters as part of the external interface. What I am struggling with is ... by having getters and ...
5
votes
1answer
503 views

How to apply OOP, SOLID principles and Design Patterns in a library which does parallel processing without the caller's knowledge?

I want to explore the contentions between the two hot topics: Clean code vs. Good performance. (In progress ... please post comments to help me flush out the details of this question. Thanks.) ...
3
votes
6answers
673 views

Should you use “internal abbreviations” in code comments?

Should you use "internal abbreviations/slang" inside comments, that is, abbreviations and slang people outside the project could have trouble understanding, for instance, using something like //NYI ...
12
votes
4answers
2k views

Good use of try catch-blocks?

I always find myself wrestling with this... trying to find the right balance between try/catching and the code not becoming this obscene mess of tabs, brackets, and exceptions being thrown back up ...
1
vote
5answers
129 views

How to structure reading of commands given at a(n interactive) CLI prompt?

Let's say I have a program called theprogram (the marketing team was on strike when the product was to be named). I start that program by typing, perhaps not surprisingly, the program name as a ...
22
votes
18answers
2k views

Why write clean, refactored code? [duplicate]

This is a question I've been asking myself for a long time. Thought of throwing out it to you. From my experience of working on several Java based projects, I've seen tons of codes which we call ...
6
votes
6answers
286 views

Is code maintenance typically a special project, or is it considered part of daily work?

Earlier, I asked to find out which tools are commonly used to monitor methods and code bases, to find out whether the methods have been getting too long. Most of the responses there suggested that, ...
26
votes
6answers
846 views

What payoffs have you seen from taking care of technical debt?

This article on technical debt has some good points, including: Working on the "technical matters" works best when it is driven by stories. The code base is probably in need of work everywhere, ...
33
votes
15answers
3k views

What does Clean Code mean to you? [closed]

A group of developers and I recently started a book club, and our first book of choice is Clean Code by Robert C. Martin. It is a great book on software craftsmanship and I would highly recommend it. ...