Re: [dwm] I merged the whole source to one file and wanna let you know the implications

From: lobzang <lobzang_AT_free.fr>
Date: Sun, 16 Sep 2007 21:24:40 +0200

That works, and I agree that's simpler.

On Sun, 2007-09-16 at 13:06 +0200, Anselm R. Garbe wrote:

> I think one can argue a lot about how to organize source code
> the right way. Especially if your codebase is huge.
>
> Anyway, I realized that I reorganized the dwm code base a couple
> of times, and this has been due to one fact: dwm's code base has
> been organized following two different paradigms - separating
> code into logically equal parts on one side (client.c, event.c,
> screen.c, layout.c, tag.c, ..) and functionally equal parts
> (draw.c, main.c, util.c)i on the other side...
>
> Due to this separation often the need arised to enforce
> consistency into the one or the other direction. I believe that
> also other projects who thought carefully about these questions
> noticed the same.
>
> However, I browsed through the old Unix tools several times, and
> they often cosist of only a single source file. That's because
> they want to meet the goal "do only ONE thing, and do it well".
>
> So organizing dwm in a single dwm.c (see hg tip) will enforce
> to reach the ideal much more in my conlusion. There are also
> some positive benefits in this decision.
>
> The overhead to differentiate between static and extern
> variables/functions is gone now, you can call all functions and
> use all global variables within dwm.c. config.h can refer to any
> global variable or function now. This includes extending dwm
> with different layouts - you only need to write a .c file now
> (no need to write a .h file), include that .c file in config.h
> right before the Layout-array initialization and it will simply
> work.
>
> You can declare all functions static in external layout
> implementations, simply because they will be part of dwm.c
> anyways after CPP did its job.
>
> I will do the same with dmenu as well.
>
> Regards,

Lobzang
___________________
http://lobzang.free.fr
Received on Sun Sep 16 2007 - 21:25:46 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 14:53:24 UTC