Go Back   Flash Flash Revolution > General Discussion > Critical Thinking > Homework & Help
Register FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
Old 01-20-2008, 03:45 PM   #1
dooey100
FFR Player
FFR Veteran
 
dooey100's Avatar
 
Join Date: Sep 2006
Posts: 370
Default [Highschool - computers] I don't understand the purpose of interfaces. (In java)

Hi, I'm taking a course in java programming and I just learned how to use interfaces. I know how to use them properly, but I don't see the point. You still have to write the methods for each class that uses the interface, and the only reason I see to use an interface would be to make sure you don't forget any methods.

I know that you can use interfaces for constants, but unless you have a lot of constants, if wouldn't be much trouble to put the constants with all the other variables.

I haven't done any big projects with many classes yet, so they may be more useful in practice then it looks like.

On a slightly unrelated note, didn't there use to be a board for programming?
dooey100 is offline   Reply With Quote
Old 01-20-2008, 04:13 PM   #2
tsugomaru
FFR Player
 
tsugomaru's Avatar
 
Join Date: Aug 2004
Location: The stars come to my aid.
Posts: 3,962
Send a message via AIM to tsugomaru
Default Re: (Highschool - computers) I don't understand the purpose of interfaces. (In java)

We used to have a programming board but it was shut down due to inactivity. I remembered at one point when there was less than one thread created per month. If you have a question like this, your answer would be better answered on a Java programming forum because more people know what they are doing there or the answers may be found there.

~Tsugomaru
__________________
Quote:
Originally Posted by Hiluluk
WHEN do you think people die...?
When their heart is pierced by a bullet from a pistol...? No.
When they succumb to an incurable disease...? No.
When they drink soup made with a poisonous mushroom...? NO!!!
IT'S WHEN A PERSON IS FORGOTTEN...!!!
tsugomaru is offline   Reply With Quote
Old 01-20-2008, 05:10 PM   #3
sleeplessdragn
~Bang that beat Harder~
FFR Simfile AuthorFFR Music ProducerFFR Veteran
 
sleeplessdragn's Avatar
 
Join Date: Jan 2004
Posts: 2,321
Default Re: [Highschool - computers] I don't understand the purpose of interfaces. (In java)

It is often nice, when writing code that other people will be using, to force them into a path, so to say. Interfaces let you keep your code scheme very apparent, as well keeps things clean and easy when dealing with projects that involve heavy inheritance.
__________________
sleeplessdragn is offline   Reply With Quote
Old 01-20-2008, 07:21 PM   #4
dooey100
FFR Player
FFR Veteran
 
dooey100's Avatar
 
Join Date: Sep 2006
Posts: 370
Default Re: [Highschool - computers] I don't understand the purpose of interfaces. (In java)

Ah, that makes sense. I never thought about team/group projects.
dooey100 is offline   Reply With Quote
Old 01-20-2008, 11:40 PM   #5
skishmonkey72
FFR Player
FFR Veteran
 
skishmonkey72's Avatar
 
Join Date: Nov 2006
Location: Canada
Age: 32
Posts: 366
Send a message via MSN to skishmonkey72
Default Re: [Highschool - computers] I don't understand the purpose of interfaces. (In java)

Like sleeplessdragn said, it's really helpful in team projects to have specific classes in a project to implement a particular interface, so one can expect certain things from an implementing class. Another thing is for when you want to have classes inherit certain things. It doesn't always make sense to have a class to inherit everything from a superclass. For example, Arabian can extend Horse, and inherit methods and variables specific to any Horse, but it could also implement Rideable, and inherit specific methods and constants required for a Rideable object. (Rideable objects are not necessarily Horse objects, but could also be something like Camel). But you can't necessarily put those methods and constants in the Horse superclass, because not all horses are intended to be ridden. In short, interfaces are a useful way to circumvent or model multiple inheritance.
__________________
One Handers Ranking List

Last edited by skishmonkey72; 01-20-2008 at 11:49 PM..
skishmonkey72 is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 06:21 AM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright FlashFlashRevolution