Re: [dev] suckless shell prompt?

From: Markus Teich <markus.teich_AT_stusta.mhn.de>
Date: Fri, 22 Nov 2013 19:49:25 +0100

Andrew Gwozdziewycz wrote:
> My guess is the biggest objection (certainly mine) is that everything happens
> in `main` instead of breaking the work down into smaller functions that do one
> thing.

Actually I started with that approach[0], but I found it too confusing for such
a small and linear program and therefore I inlined all functions which were only
called once. In python context I've read about a functions McCabe complexity and
that it should not be above 10. Should I extract some methods out of main()
again or do you think it is enough, if I comment the linear process in main()
more detailed?

> I don't know of a "suckless" approved style guide[0], but I'd guess most
> people here would tell you to read the C section here at least:
> http://doc.cat-v.org/programming/
>
> In general, good code is modular, has consistent formatting, and attempts to
> make complicated processes simple and easy to understand. There's lots of
> examples of good code out there, but I like to refer people to this one[1]:
> http://www.cs.princeton.edu/courses/archive/spr09/cos333/beautiful.html

Thanks, I will read up on the links I don't know yet.
And many thanks for a constructive post! ;)

--Markus

[0]:
https://github.com/schachmat/slcp/blob/1ddb3ab48be5c77a79a5459c858aa4201257c8b2/slcp.c
Received on Fri Nov 22 2013 - 19:49:25 CET

This archive was generated by hypermail 2.3.0 : Fri Nov 22 2013 - 20:00:08 CET