code-organization

Organizing a large Python project that must share an internal state?

I'm currently in the middle of porting a fairly large Perl The problem is that it uses little Perl tricks to make its code available for useing. I've done about the same with Python, making the codebase one big module for importing. I've had a firm grasp of Python for a long time, but I have no experience with large projects written in P...

How do you organise your MVC controller tests?

I'm looking for tidy suggestions on how people organise their controller tests. For example, take the "add" functionality of my "Address" controller, [AcceptVerbs(HttpVerbs.Get)] public ActionResult Add() { var editAddress = new DTOEditAddress(); editAddress.Address = new Address(); editAddress.Countries = countryService.Ge...

HTML site development: div's vs ul's for navigation and menus

I'm working on developing a Web 2.0 site, and I've been looking at how sites deal with menus and nav-bars. Many sites (like twitter) use UL's whereas sites such as stackoverflow use div's that are ID's containing links. Is there an advantage to not using UL's other than it eliminates some IE bugs? is there an advantage to using UL's? ...

Organizing GUI code

My question has two parts: Does anyone have any tips or references to some documentation on the web about how to write GUI code that is easy to read, write, and maintain? Example. I find that the more extensive my GUI forms become, I end up with a long list of fairly short event handler methods. If I try to add any private helper m...

Pros and Cons regarding extended use of branches.

I want to be able to choose the right branching strategy for most thinkable situations and organizations. So I'm looking for a extensive list of positive and negative effects of extending the use of code repository branches in a development organization. Please only post one pro or one con in each post, so that the voting system can he...

Organizing a Subversion Repository of thousands of elements

Before I begin: I have spent a long time on many forums (including Stack Overflow - and yes there are a lot of SO questions on organizing svn), searching Google, and reading documents (I own a few Subversion books). I still have not found a good way to organize our code base in Subversion. We currently use RCS as our revision control s...

How do you prefer to organize your test data in Ruby On Rails?

How do you prefer to organize your test data in Ruby On Rails: fixtures, object factories or anything else? Why? ...

Where to keep unit tests?

Are unit tests kept in the same file as the code, a separate file in the same directory, or in an entirely different directory? ...

C++ project source code layout

One of the popular way to organize project directory is more or less like this: MyLib +--mylib_class_a.h mylib_class_a.cpp mylib_library_private_helpers.h mylib_library_private_helpers.cpp MyApp +--other_class.h other_class.cpp app.cpp app.cpp: #include "other_class.h" #include <myl...

Referencing JAXB jars - best practice

My first post, so go easy on me. I'm looking for advice on organising and referencing third party jars for use in my j2ee web application. The jars I need to organise and reference are the JWSDP-2.0 JAXB api jars. I'm using Eclipse and Tomcat 5.5. My web app exchanges XML with a web service, and therefore needs to do some XML marshall...

Best Practices - CSS Stylesheet Formatting

This may seem like a strange question...but here goes: I'm currently working on creating a fairly large site using table-less design/css (obviously the best way to go). Unfortunately, I have a requirement that is completely out of my control that states I must have only one stylesheet for the site. In some regards this is better becaus...

How to code a simple versioning system ?

I want to do a simple versioning system but i don't have ideas on how to structure my datas, and my code. Here is a short example: User logs in User has two options when uploading a file: Submit a new file Submit a new version of a file Users should be able to see the tree. (the different version) The tree can only be up to 2 leve...

Best way to organize the files in my project

What is the best way to organize the files in your project? For example do you put all user controls in a separate folder or do you place them in a sub folder? Do you have business logic folder? A helper classes folder? I used to organize my projects like this: Project/User Controls/Module Name/ Project/Classes/Module Name/ Now I ...

Worth the headache to organize SQL files by application subject?

At my company, we save each database object (stored proc, view, etc) as an individual SQL file, and place them under source control that way. Up until now, we've had a very flat storage model in our versioned file structure: DatabaseProject Functions (all functions here; no further nesting) StoredProcedures (all stored procs in h...

Is it impossible to separate javascript from HTML?

To be specific, I'm talking about avoiding this type of code: <input type='text' id='title_33' class='title' onfocus='updateCharsLeft(33);' onkeypress='updateCharsLeft(33);' /> Here I would like to put the onfocus and onkeypress event handles separately, i.e in a .js file. Like this: $(document).ready(function() { $(".titl...

Where should I put my JavaScript - page or external file?

In VS 2008, I have an ASP.NET content page having one master page. I would like to add JavaScript functions for client side validation etc. for this page. My questions are: Should I write these scripts in a separate .js file, or embedded within the .aspx file. Does this choice affect the performance of the website? Are there any rules...

Is it naughty to have a large utility file?

In my C project I have quite a large utils.c file. It is really full of many utilities of different sorts. I feel a bit naughty just stuffing different miscellaneous functions in there. For example it has some utilities related to low level stuff such as a lowercase() function, and it also has some quite sophisticated utilities such as c...

Why is each public class in a separate file?

I recently started learning Java and found it very strange that every Java class must be declared in a separate file. I am a C# programmer and C# doesn't enforce any such restriction. Why does Java do this? Were there any design consideration? Edit (based on few answers): Why is Java not removing this restriction now in the age of ID...

Creating classes or just using associative arrays for XML data in PHP?

From a maintenance and code organization standpoint, in PHP5, does it make sense to create/define objects and classes for XML data coming from a web service? Using Twitter's API as an example, I would have a class for each API method (statuses, users, direct_messages, etc). For statuses/public_timeline, I would have something like this...

Why does django enforce all model classes to be in models.py?

I have just learned that splitting model classes into different files breaks many of django's built-in functionalities. I am coming from a java background. There, it is not accepted as a good practice writing very long class files. But django's enforcement of single file for all model classes will probably cause programmer to write ver...