|
-
Dec 7th, 2004, 03:57 PM
#1
Thread Starter
Frenzied Member
How would you guys do this?
I have created a very simple text editor with basic functionality. It's all in one class, and this is what bothers me. I wanted it in different classes, but just couldn't seem to get it done. So, what I ask from you is your input on the different classes you would use if you wrote this program. Mine has the following functionalities: Save, SaveAs, New, Find, Replace, and other crap like that. I know it's simple enough to have it in just one class, but I was hoping to get practice with using multiple classes.
Any help would be appreciated.
Last edited by System_Error; Dec 8th, 2004 at 06:19 AM.
-
Dec 7th, 2004, 05:32 PM
#2
Re: How would you guys do this?
Are you already using the Swing editor model? Or do you do everything yourself? If you do it yourself, you could try separating the document and the view of it. That's all I can think of. Separating the functionality you listed doesn't make sense.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 7th, 2004, 05:48 PM
#3
Thread Starter
Frenzied Member
Re: How would you guys do this?
Im doing everything myself. I don't know of a swing model.
-
Dec 7th, 2004, 05:50 PM
#4
Re: How would you guys do this?
Well, then go ahead and create a Document class and a View class.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 7th, 2004, 08:45 PM
#5
Thread Starter
Frenzied Member
Re: How would you guys do this?
I hope you don't mind me asking, but what do you mean by a document class and a view class?
-
Dec 8th, 2004, 05:37 AM
#6
Re: How would you guys do this?
The document class stores the data. It offers operations to save, load, create new, modify etc. Ideally it emits notifications if it is changed.
The view class displays the data. It stores a reference to the document and has some UI elements that can be used to work on it. For example, it offers a text area where it displays the data, and when the text area is modified, it tracks the modifications in the document.
The advantage is that you can have more than one view of the same data. You could have another view that parses the data and displays a class browser, for example.
All the buzzt
 CornedBee
"Writing specifications is like writing a novel. Writing code is like writing poetry."
- Anonymous, published by Raymond Chen
Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.
-
Dec 8th, 2004, 06:18 AM
#7
Thread Starter
Frenzied Member
Re: How would you guys do this?
 Originally Posted by CornedBee
The document class stores the data. It offers operations to save, load, create new, modify etc. Ideally it emits notifications if it is changed.
The view class displays the data. It stores a reference to the document and has some UI elements that can be used to work on it. For example, it offers a text area where it displays the data, and when the text area is modified, it tracks the modifications in the document.
The advantage is that you can have more than one view of the same data. You could have another view that parses the data and displays a class browser, for example.
Thank you. This idea is definitly one worth trying. Again, thank you for helping.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|