Ok gotcha that sounds like a good idea. I seem to be running into
implementation problems now. I am having a hard time figuring out how best
to leverage the CFCs. So far I am looking at creating an instance of each
major CFC in the application scope in the Application.cfm. That way I have
the class available where ever I am. Then I can create instances from that.
So say something like:
user = createObject('component','user');
currentUser = user.getUser('1');
Now current user is just the query object that's returned. Not the actual
user right? This is whats confusing me I think. See I want a user object.
It should have the properties of cFirstname, cLastName, cEmail, cUsername,
cPassword. Now when you first call the createObject() function I would like
to initialize these, and then use getters and setters to affect them. I
can't seem to see how to make it work like I want though. I was thinking
that by using 'this' maybe. I remembered something about the code you put
in the component, but not in a function, will execute when you first
instantiate the object, so a constructor of sorts. Kewl, but how do I deal
with variables? Do I necessarily want all of my properties to be private,
so instead of being currentUser.cFirstName, I want to do
currentUser.getFirstName()? Do I have to do a currentUser.setFirstName();
first, or is it ok to have a single method that does the pull and then dumps
the values into the variables?
Timothy Heald - setting the world on fire, one brain cell at a time.
Overseas Security Advisory Council
U.S. Department of State
"that the free Constitution, which is the work of your hands, may be
sacredly maintained" - George Washington, Farewell Address 1796
-----Original Message-----
From: Ben Doom [mailto:[EMAIL PROTECTED]
Sent: Wednesday, April 02, 2003 5:00 PM
To: CF-Community
Subject: RE: OOCF, CFCs and the questionnaire app
I would create a QuestionGroup object, which contains an array of questions.
Then, you could populate it by category, who posed it, who answered it, etc.
So, in theory, you could select all questions about food posed by BenB and
answered by Candace. You could also simply populate it with everything, or
nothing, or whatever. Kind of a recordset for questions.
I would also create types Answer and AnswerGroup so you could do the same
thing. A QuestionGroup contains a Question which contains an AnswerGroup
which contains specific Answers to that Question.
Make sense?
-- Ben Doom
Programmer & General Lackey
Moonbow Software, Inc
: -----Original Message-----
: From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
: Sent: Wednesday, April 02, 2003 2:10 PM
: To: CF-Community
: Subject: OOCF, CFCs and the questionnaire app
:
:
: Ok,
: The boss and I are using the questionnaire app to expand our skill set
: some during lunch. We are looking at how to objectify it, what methods to
: have, what might be good to break into a web service. During this process
: several questions have arisen.
:
: 1. Why the hell won't CF 5 close my CFMX tags like cfcomponent or
: cffunction? I know I am being lazy but so what.
:
: 2. How do you break up things that deal with one of an object
: (getQuestion()) and deal with several instances at once
: (getQuestionsByCat())? Say I want to list all the questions in a
: category.
: Is that properly a method of the question object, or do I need a category
: object?
:
: So far we have decided on the following objects and methods
:
: User
: newUser - constructor, will be used after login to create as a
: session object that will go through the site with the users credentials,
: basically just a db query to pull the users info and check the login
:
: getUser - used to look up users, say in an address book
: like manner
:
: setUser - input new user info, used for registration. Should this
: be broken up more in to things like setAddress, setEmail? Also can your
: override functions in CFMX? I guess I could get the same effect just by
: doing some conditional work inside the method right?
:
: addQuestion - enter a new question. Question would still
: need to be
: approved by an administrator - calls question constructor??
:
: Administrator - extends user
: newAdministrtator - constructor - called if the user has admin
: rights. What's the way to make this happen in the newUser constructor
: automatically?
:
: approveQuestion - Approve a user entered question
:
: approveUsers - Approve a new user application. Figured
: make it so it
: can handle many users at once. Should it be for a single user
: and then just
: something you do many times?
:
: getNewUsers - Gets the listing of new user application
:
: Question
: newQuestion - question constructor
:
: getQuestion - pulls a specific question
:
: getAnswers - pulls the answers for a specific question
:
: getAnswersByUser - pulls a users answers
:
: getQuestions - list of all questions
:
: getQuestionsByCategory - pulls questions by category
:
: answer - answer a question
:
: setCategory - set the questions category
:
: setQuestion - edit/enter a question
:
: I guess that's about it. See anything I am missing? Am I
: putting anything
: in the wrong place?
:
: Timothy Heald
: Overseas Security Advisory Council
: U.S. Department of State
: "that the free Constitution, which is the work of your hands, may be
: sacredly maintained" - George Washington, Farewell Address 1796
:
:
:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=5
Subscription:
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=5
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.5