Moving to an OOP model from an classically imperitive one

Chris Angelico rosuav at gmail.com
Wed Apr 23 19:12:18 EDT 2014


On Thu, Apr 24, 2014 at 7:42 AM, Ethan Furman <ethan at stoneleaf.us> wrote:
> On 04/23/2014 01:57 PM, tim.thelion at gmail.com wrote:
>>
>>
>> There is one problem though.  Currently, I have these functions logically
>>  organized into source files, each between 40 and 170 LOC.  I fear that if
>> I were to put all of these functions into one class, than I would have a
>>  single, very large source file.  I don't like working with large source
>>  files for practicall reasons.
>
>
> I'm curious what these practical reasons are.  One my smallest source files
> has 870 lines in it, my largest nearly 9000.
>
> If the problem is your editor, you should seriously consider switching.

It's probably not the case here, but one good reason for splitting a
file into pieces is to allow separate people or systems to update
different parts. Lots of Linux programs support either
/etc/foobar.conf or /etc/foobar.conf.d/ where the former is one file
and the latter is a directory of separate files, generally deemed to
be concatenated to the main config file. (Example:
/etc/apt/sources.list and /etc/apt/sources.list.d/ - the main config
for your Debian repositories, the directory for additional ones for
VirtualBox or PostgreSQL.) It's easier to allow someone to completely
overwrite a file than to try to merge changes.

But that's not often the case with source code.

ChrisA



More information about the Python-list mailing list