Learning to write organized and modular programs
Asked Answered
Q

4

6

I'm a computer science student, and I'm just starting to write relatively larger programs for my coursework (between 750 - 1500 lines). Up until now, it's been possible to get by with any reasonable level of modularization and object oriented design. However, now that I'm writing more complex code for my assignments I'd like to learn to write better code.

Can anyone point me in the direction of some resources for learning about what sort of things to look for when designing your program's architecture so that you can make it as modularized as possible?

Quintuplet answered 18/4, 2010 at 18:4 Comment(0)
A
1

refactoring by martin fowler is the book that has helped me most among the 20 or so books that I have read on oo, patterns, test driven development and general software engineering over the last two years. particularly the section on smells can help you see what you need to avoid as you are developing more complex code.

Alyciaalyda answered 18/4, 2010 at 22:59 Comment(0)
L
2

This question has been asked here before, and the answer has generally been there is no such book. The reason for this is that there are no "rules" that can be applied to the problem - you have to go on experience. My experience is that you should write multiple libraries with a clear, singly directed dependency graph, but beyond that I wouldn't like to commit myself.

Lovieloving answered 18/4, 2010 at 18:29 Comment(0)
C
2

Read Clean Code by Robert Matin

Catchfly answered 18/4, 2010 at 18:42 Comment(7)
No, don't. Or any other book by that blowhard nitwit.Lovieloving
I sense that Neil might dislike that author, but I'm not sure.Merari
@Neil: Any specific reason why you wouldn't recommend this book?Incompletion
I think that Clean Code requires that the reader has seen some dirty code.. so not the first book I would recommend.Patois
@Krystian The reviews I've read of it, my experiences of his other books, and his posts on usenet over the years. I'd class him as the Herb Schildt of the bullshit circus.Lovieloving
@GMan My shrink told me not to bottle up my feelings.Lovieloving
@greyfade Cruel to Herb, I know, but he's survived much worse.Lovieloving
A
1

There is one important thing which will make it easier when developing modular apps, or even turning an app modular at a later point, which is Dependency Injection.

It allows your modules to work separately of everything else, as it receives whatever data it needs to perform its task, without needing to know anything about the application itself.

It may take some experience to produce good quality context-neutral DI code, which is why it's important to begin thinking about and experimenting with it as soon as possible.

Anatomy answered 18/4, 2010 at 18:34 Comment(2)
That's one way of designing code - there are lots of others. I, and many, many others manage to write modular code without using it.Lovieloving
sure, but he asked for any resource, not a definitive all-encompassing solution.Anatomy
A
1

refactoring by martin fowler is the book that has helped me most among the 20 or so books that I have read on oo, patterns, test driven development and general software engineering over the last two years. particularly the section on smells can help you see what you need to avoid as you are developing more complex code.

Alyciaalyda answered 18/4, 2010 at 22:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.