code-organization

Where do the Python unit tests go?

If you're writing a library, or an app, where do the unit test files go? It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing. Is there a best practice here? ...

Organizing Extension Methods

How do you organize your Extension Methods? Say if I had extensions for the object class and string class I'm tempted to separate these extension methods into classes IE: public class ObjectExtensions { ... } public class StringExtensions { ... } am I making this too complicated or does this make sense? ...

Should Usings be inside or outside the namespace

I have been running StyleCop over some C# code and it keeps reporting that my using statements should be inside the namespace. Is there a technical reason for putting the using statements inside instead of outside the namespace? Edit: There appears that there is no difference after compliation. The reasons for putting them inside the n...

Python Code Organization Question : Eggs + Packages + Buildout + Unit Tests + SVN

I have several python projects that share common modules. Until now, I've been ... ahem ... keeping multiple copies of the common code and synchronizing by hand. But I'd clearly prefer to do something else. It looks to me now, as if zc.Buildout maybe what I need. I guess that what I should be doing is putting each reusable component of ...

How do you organize code in embedded projects?

Highly embedded (limited code and ram size) projects pose unique challenges for code organization. I have seen quite a few projects with no organization at all. (Mostly by hardware engineers who, in my experience are not typically concerned with non-functional aspects of code.) However, I have been trying to organize my code accordingl...

Extending an existing class like a namespace (C++)?

I'm writing in second-person just because its easy, for you. You are working with a game engine and really wish a particular engine class had a new method that does 'bla'. But you'd rather not spread your 'game' code into the 'engine' code. So you could derive a new class from it with your one new method and put that code in your 'g...

Including one C source file in another?

Is it OK (or even recommended/good practice) to #include .c file in another .c file? What happens when they are included in a project file? ...

jQuery and "Organized Code"

I've been struggling lately with understanding the best way to organize jQuery code. I asked another question earlier and I don't think I was specific enough (found in this question here). My problem is that the richer you make an application, the quicker your client side gets out of control. Consider this situation... //Let's start so...

Why are the controllers on ASP.NET MVC name-based?

In ASP.NET MVC, we're required to use the suffix "Controller" for all controllers. This seems unnecessarily restrictive - is there a technical reason for it? I'm mostly just curious, but can see situations where more flexible naming rules could improve code organization. Couldn't the discovery of possible controller classes be easily m...

How do you organize C# code in to files?

In C#, the questions of what types to create, what members they should have, and what namespaces should hold them, are questions of OO design. They are not the questions I'm interested in here. Instead, I want to ask how you store these in disk artifacts. Here are some example rules: Put all of an assembly's types in a single source...

Organizing Actions in a Swing Application?

My current application has a JFrame with about 15 actions stored as fields within the JFrame. Each of the actions is an anonymous class and some of them are pretty long. Is it common to break actions into their own classes possibly within a sub-package called actions? If not, how's this complexity usually tamed? Thanks ...

best articles about organizing code files in C

Can you recommend me what should I read/learn in order to make a well organized code in C? One of the things I want to learn is the principles of splitting project in .h and .c files, what goes where and why, variable naming, when to use global variables ... I am interested in books and articles that deal with this specific problem. ...

Best way to organize a subversion repository of many small projects

To start out, I have looked at the following pages and don't quite have my answer: how-would-you-organize-a-subversion-repository-for-in-house-software-projects and how-do-you-organize-your-version-control-repository I have also looked at chapter 8 of Pragmatic Version Control using Subversion. They all have good advice, but I'm having...

Should I put many functions into one file? Or, more or less, one function per file?

I love to organize my code, so ideally I want one class per file or, when I have non-member functions, one function per file. The reasons are: When I read the code I will always know in what file I should find a certain function or class. If it's one class or one non-member function per header file, then I won't include a whole mess ...

Organizing your personal utility code repository

Many of us have a personal repository where we keep our code. Sometimes it's just our hobby code, some people include code from their jobs (shame!), but many of us have a repository in one form or another. This is complicated by the fact that alot of us work in many spaces (Web Development, Windows and Web Services, Console apps) and ma...

How can I organize all my code, data, scripts, tasks etc?

What tools or approaches would you recommend to a 'one-man team' to keep organized? I'm doing research that involves a lot of coding, writing hundreds of throw-away perl scripts, C++ binaries that get used until I find some better approach, large amounts of data that gets preprocessed in different ways, where some new preprocessing mak...

What is a good amount of code to have in a single file?

I was wondering today about how much code people normally have in a single source file before they decide to split it into multiple smaller files. Personally I tend to keep my files fairly small (exspecally header files when working with C/C++). That is I will generally only have one class or a bunch of functions in a given file so the ...

Compiling a C++ .lib with only header files?

I'm compiling a C++ static library and as all the classes are templated, the class definitions and implementations are all in header files. As a result, it seems (under visual studio 2005) that I need to create a .cpp file which includes all the other header files in order for it to compile correctly into the library. Why is this? ...

Vim style folding for CSS/javascript in Visual Studio

Is anyone aware of a way to have VIM style folding in Visual Studio? I use #region blocks in c# class files and they're great, but unfortunately there's no equivalent functionality for javascript and css. The site/app I'm currently working on has a rather lot of css selectors and javascript and navigating the monolithic files is becoming...

How do you organize classes on a large project?

We have a ton of features in our application that can be described very concretely as a module. The usually have some sort of setup dialog, then when the user clicks ok, it configures a process to run and runs that process. Sometimes they are more involed and the user will open up the new dialog and work on the dialog for a while, doin...