Hey /prog/,
If you were to program a BBS similiar to this and wanted to make it object-oriented how would you call the classes? I guess "Reply" would do for any post after the first post. Since you often call the first poster OP (Original Poster) would you call the first post "OriginalPost"? Some suggestions would be great since I'm really bad at making decisions.
The Meme "SICP" is so fucking outdated, give me an answer already or all of you just too stupid? For real, troll on /b/ or somewhere else, but why on /prog/? Really, I thought this was a dececnt please compared to the other boards, seems like I was wrong - stupid shitfucks.
Name:
Anonymous2009-04-10 10:52
>>1
Why you would need a different class for the first post and for replies? Why not just have one Post class? What behaviour would change?
Name:
Anonymous2009-04-10 10:56
>>7
Well, oke, take a look at the /x/ board source code for example. If you wanted to write a scraper for it you would have to do that in two classes because the HTML code for the first post is different than the replies.
Name:
Anonymous2009-04-10 10:57
>>1,6
Have you looked at the source code for the other BBS scripts? Shiichan (that powers dis.4chan.org), Kareha, ect. as examples?
Name:
Anonymous2009-04-10 11:11
class Post(object):
def __init__(self):
pass
class Reply(object):
def __init__(self):
pass
class Thread(object):
def __init__(self):
pass
class Board(object):
def __init__(self):
pass
This or class OrignalPost(object):
def __init__(self):
pass
I think it's obvious which class would be sub-classes of other ones, and this is assuming you are working with a language that allows inheritance (obvious OriginalPoster and Replier are derivations of Poster). It's not everything, but will give you a start.
>>8
But that would be part of the scraper logic, not the structure of the objects themselves. Please discard the mentality that it is necessary to have different classes to have differing behaviour; it is unscientific and ultimately destructive.
Maybe parseThread calls parseOP and parseReplyn, but what it returns should simply be a list of Posts, and maybe some thread metadata like title and thread ID.
Name:
Anonymous2009-04-10 11:52
>>16
So something like this would be better:? class Post(object):
def __init__(self, soup):
pass
>>20
Huh? What did you say? There was so much stupidity in your last sentence that I couldn't understand it. Please have a seat over there and explain it to me in detail.
The advantage /prog/ has over newsgroups such as comp.lang.lisp is that we generally acknowledge we're full of shit, and that's part of the fun of it. The advantage newsgroups have is the people trying not to act like they're all full of shit can occasionally be helpful.
This is a stupid thread and [spoiler]IPHBT[/spoilers].
The problem of making a Shiichan-like imageboard is pretty simple, and using an object-oriented approach would likely only overcomplicate things and add to the overhead, however shiichan's code itself is quite a mess, even if it works. In the event I would use an object-oriented approach at solving such a problem(I wouldn't), I think some of the class names would have such names/structure:
Post - contains an individual post, it has an index, date, name, email, text blob, it's (de)serializable, possibly ID or IP of poster or hash.
Thread - contains an index, a collection of Post, serializable
Board - contains a collection of Thread, board properties, styling, user list(admins)
User - staff user/hash of pass, priviledge level, or even better, a collection of priviledges
BBCodeParser - conversion from bbcode to text which can be stored in a post
From here on, depending on the language you're developing, you're going to have to decide how to render the webpage, how to handle skins(board templates/visual styles), serialization( flat files, binary, databases, etc), what priviledges do admins have, and do you implement them, and so on.
Why are you even a programmer if you can't think about simple things such as these?
>>31 Why are you even a programmer if you can't think about simple things such as these?
There's an implicit premise in this question I feel is unwarranted.
>>35
Your post raises 3 questions.
1. What is a ``fuckehad''?
2. Who are you talking to?
3. Why are you posting here? Perhaps you would feel more comfortable at http://img.4chan.org/b/imgboard.html