program-structure

How do you find a needle in a haystack?

When implementing a needle search of a haystack in an object-oriented way, you essentially have three alternatives: 1. needle.find(haystack) 2. haystack.find(needle) 3. searcher.find(needle, haystack) Which do you prefer, and why? I know some people prefer the second alternative because it avoids introducing a third object. However,...

How does a program look in memory?

How is a program (e.g. C or C++) arranged in computer memory? I kind of know a little about segments, variables etc, but basically I have no solid understanding of the entire structure. Since the in-memory structure may differ, let's assume a C++ console application on Windows. Some pointers to what I'm after specifically: Outline of...

Dealing with similar code in multiple C "projects"

I am playing around with some C code, writing a small webserver. The purpose of what I am doing is to write the server using different networking techniques so that I can learn more about them (multithread vs multiprocess vs select vs poll). Much of the code stays the same, but I would like the networking code to be able to be "swapped o...

What are some best practices for structuring cherrypy apps?

I'm writing a cherrypy app and I was wondering what the best way is for structuring my handlers and code for larger applications? I realize assignment is simple trough cherrypy.root, but what are some practices for writing the handlers and assigning them? (Allow me to prove my confusion!) My initial thought is to write a standard handl...

Origins of the name 'main' for program entry point?

Out of curiosity, what are the origins of the name 'main' for a program entry point? ...

C - program structure (avoiding global variables, includes, etc.)

I'm using C (not C++) and I'm unsure how to avoid using global variables. I have a pretty decent grasp on C, its syntax, and how to write a basic application, but I'm not sure of the proper way to structure the program. How do really big applications avoid the use of global variables? I'm pretty sure there will always need to be at lea...

Resources for software structure design

I am looking for a good book that I can get a better understanding of software structure design. I know there are many good programs out there that help with this but I still don't really know proper techniques, etc. Has anybody read or heard of a recent book published that would help me get a better understanding? ...