IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Suggestions on how to structure something
I'm working on my autoresponder, and need some feedback on how to structure it.

Basic componenents/tables are:

subscriber -- self-explanatory

responder -- A mailing list. Users subscribe and get both scheduled posts (send per-user $x days after signup) and immediate posts (send now to all current members).

message -- A scheduled post.

mail -- An immediate post. (I'm not convinced this should be separate from "message". The only thing different is how it's scheduled.)

When a new "mail" is created, it populates a queue of userID/mailID pairs.

The subscriber table contains a comma-delimited list of which "message"s a subscriber has received.

Once per hour, a script runs that first does a query to determine what users should receive a message during the current run and works through those, then starts working through the mail queue. (There is a per-hour cap to comply with host limits, so either process may not send everything in one run.)

The whole system is built procedurally, no classes in sight. And lots of copy-paste -- I'm talking hundreds of lines at a time here -- where there could at least be functions.

I'm refactoring it, and I'm not sure where to hang some of the methods/properties, primarily around formatting and sending the mail. I'm going to create a "queue" class -- I'm thinking static, not an instantiated object -- to insert to and process the queue. But should formatting and sending the message be a method of the "queue" class or the "message" class?

Second, should I make the queue class static or instantiate the object?
--

Drew
New Re: Suggestions on how to structure something
majordomo? /me flees
New Har-dee-har
If I wanted something that sent the same message all at once to everyone currently on a list, I could use my host's built-in list feature. I need the scheduling.
--

Drew
New Re: Suggestions on how to structure something
Messages format themselves (or have an associated formatter). Queues send messages.

As to the other question, who cares. If there's only going to be one, use a Singleton or static. If you might have different queues (immediate vs. scheduled, maybe, or high vs. low priority, whatever) than instantiate one for each.

Did you look for any open source utilities that do this already?
Regards,
-scott
Welcome to Rivendell, Mr. Anderson.
New I'm using one
There are a bunch of options to pay for a hosted solution, and several pricey shrink-wrap packages. But this doesn't seem to have attracted much OS love, probably because it's viewed as spam tools by most people.

The one I'm using already does 95% of what I want, but the last 5% is a bitch to add because it's so badly structured. And the bug I'm trying to trace is somewhere in the middle of a 620-line file with only two functions in it -- the ones I added for logging, and managing a lock file. I suspect about 200-250 lines of it will be redundant once I refactor it.
--

Drew
New It's in PHP, isn't it?
Welcome to my world. PHP isn't a bad language in and of itself. Unfortunately, most PHP programmers are barely average. I've inherited several PHP projects now and most of it is pretty shitty. I've even spurned PEAR modules for their inherintly poor design and coding.

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
New You've got a typo there
Unfortunately, most PHP programmers are barely average. I've inherited several PHP projects now and most of it is pretty shitty.

Languages that are harder to work with may filter out some of the lesser programmers, but that just means the ones that are left cause more subtle and obscure bugs. The language doesn't exist that keeps the determined idiot from writing shit with it.
--

Drew
New I was speaking only from my own experience. :-/
Which is inheriting PHP code. But point taken. I'm embarking on some serious Java programming here and it's just occurred to me that I might find some shit in there, too, despite the presence of such involved things like Hibernate and Struts which need to be complex enough that most programmers are bad at writing.

FWIW, I've noticed that obscure languages (e.g. Icon) tend to have better programmers because there's a certain enthusiasm required to use it.

Wade.

Q:Is it proper to eat cheeseburgers with your fingers?
A:No, the fingers should be eaten separately.
     Suggestions on how to structure something - (drook) - (7)
         Re: Suggestions on how to structure something - (boxley) - (1)
             Har-dee-har - (drook)
         Re: Suggestions on how to structure something - (malraux) - (4)
             I'm using one - (drook) - (3)
                 It's in PHP, isn't it? - (static) - (2)
                     You've got a typo there - (drook) - (1)
                         I was speaking only from my own experience. :-/ - (static)

Powered by discarded rayon underwear!
80 ms