I never tried out Eclipse, but when I worked with my group creating a multi-threaded network-based blackjack application, one guy created the GUI straight from Eclipse. Or it may have been JavaBeans? Anyways, definitely not with JGrasp. (I coded the logic and deck handling/manipulation portion of the program using JGrasp though.)
The Big Programming Thread - Page 37
Forum Index > General Forum |
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. | ||
EscPlan9
United States2777 Posts
I never tried out Eclipse, but when I worked with my group creating a multi-threaded network-based blackjack application, one guy created the GUI straight from Eclipse. Or it may have been JavaBeans? Anyways, definitely not with JGrasp. (I coded the logic and deck handling/manipulation portion of the program using JGrasp though.) | ||
Disregard
China10252 Posts
| ||
jsmith
United States18 Posts
| ||
Kambing
United States1176 Posts
On February 14 2011 06:07 jsmith wrote: you guys got any suggestions for a good ide to do java in? is it pretty much just use eclipse? Yup as mentioned, Eclipse is the de facto standard for "real" Java development. If you program in Java, you'll eventually want to learn how to use eclipse. If you're starting out with programming or just want to streamline your learning before moving onto Eclipse, then a lightweight IDE like the aforementioned JGrasp or an educational IDE like DrJava (my recommendation) or BlueJ would also be appropriate. DrJava is particularly nice because of the interactive window that lets you quickly experiment with Java language constructs. | ||
Blisse
Canada3710 Posts
And anyone have any advice for the Canadian Computing Competition? I have to write it on March 1. And I have to relearn Python by then. I don't expect to make it to the Second Stage, where you must use Java and C, so Python is fine. | ||
wO-ZiGouNeT
United Kingdom21 Posts
| ||
snpnx
Germany454 Posts
On February 14 2011 06:07 jsmith wrote: you guys got any suggestions for a good ide to do java in? is it pretty much just use eclipse? Yeah, it's pretty much Eclipse. Another good IDE which I wonder why it wasn't mentioned is NetBeans. Both are good, Eclipse is a bit better in my eyes, but Netbeans might be a bit easier if you just start with java. | ||
Blisse
Canada3710 Posts
On February 14 2011 18:31 wO-ZiGouNeT wrote: http://www.wingware.com/ is pretty decent, I've only used the free version but the debugger is pretty much all I ask for from an IDE. Ugh. Not Wing again. ![]() I went to Komodo to get away from Wing. | ||
wO-ZiGouNeT
United Kingdom21 Posts
| ||
jaydubz
21 Posts
I've created three classes. For simplicity we can call them class a, class b, and class c. The problem is each one contains the other (causing a circularity issue, from what I understand). i.e.: class a contains a private member: c obj class b contains a private member: a obj class c contains a private member: b obj Currently, using Dev C++ and trying to compile this won't work. This is because each class contains a class that hasn't been defined yet (from what I understand). Need someone to dumb down how to go about solving this problem. I can supply the header files if needed. | ||
fabiano
Brazil4644 Posts
I think having the headers would help us to help you. | ||
Chaosu
Poland404 Posts
class c; //this initiates the class for the compiler class b; start defining class a then b then c will get you rid of some compiling errors but im not sure if this will solve problem entirely. of course you have to friend classes for access to their privates | ||
jaydubz
21 Posts
+ Show Spoiler + #ifndef exit_h + Show Spoiler + #ifndef exitList_h + Show Spoiler + #ifndef location_h As for friend, adding setter/getter functions for all private members would eliminate this need I believe? | ||
Chaosu
Poland404 Posts
in class exitList: 'exit' does not name a type field 'link' has incomplete type + Show Spoiler + #ifndef combined_h #define combined_h #include <string> using namespace std; /*class exitList; class exit; class location;*/ class location { friend class exit; friend class exitList; private: string title; string description; exitList * exits; public: //some public stuff }; class exit { private: string direction; location leadsTo; public: //public stuff }; class exitList{ struct node{ exit data; node link; } *p; public: //some public stuff }; #endif so your "circularity" issue is fixed, but you need to declare your classes and structures a bit better, not going to help you now because its 230 AM and im going sleep | ||
jaydubz
21 Posts
'exit' does not name a type is the error I'm currently receiving, among others (most likely because of exit class not compiling).It seems combining them still maintains the issue: location contains an exit list, which contains an exit, which contains a location, etc. If I declare class exit; class exitList;prior to declaring class location{ }the order of the errors change but the error still persists. | ||
fabiano
Brazil4644 Posts
Its a design problem. You have the class Exit which I believe represents an exit of a location. The thing is, the attribute leadsTo of the class Exit is highly dependent on what location are you currently in. This way leadsTo actually would have to have 2 values at the same time. For example, if there are Location A and B, and an Exit E which links both locations, the value of E.leadsTo depend where you are currently. If you are in A, leadsTo point to B, if you are in B, E.leadsTo points to A. You could solve it by having 2 attribute leadsTo in the Exit class, however it wont solve your design problem as a whole. The other problem is that you wrote 2 unnecessary classes: Exit and ExitList. A Location is nothing more than a room with its attributes (title, description) and a list to other locations (the exits). So a class describing an exit is redundant and caused you the crossed references. It is hard for me to explain it with text, and even harder when I try to put my thoughts in english, so I hope you can understand me by just looking at the classes I wrote below, which I believe should solve your problem from a design standpoint. + Show Spoiler [LocationData.h] +
+ Show Spoiler [LocationList.h] +
Hope it helps! Edit: thinking again, I think what I did does not solve your problem at all ![]() | ||
djcube
United States985 Posts
| ||
jaydubz
21 Posts
| ||
Frigo
Hungary1023 Posts
On February 16 2011 09:28 jaydubz wrote: I've created three classes. For simplicity we can call them class a, class b, and class c. The problem is each one contains the other (causing a circularity issue, from what I understand). Predeclare your classes and use member pointers instead of member variables. Just think about it, what is the size of class A if it recursively contains itself? Split each of your (non-template) classes to a header file (.h or .hpp) and an implementation file (.cpp). Predeclare the class in the header file before you include anything to guarantee all required types are known, and are at least incomplete types. Use member pointers or some smart pointer like shared_ptr instead of member variables then. You can't use incomplete types to instantiate, as member variables or calling their functions, and in a lot of cases, as template arguments. However you can use them as pointers and member pointers. This makes circular references between classes possible. In fact, this is the best way. It is possible to solve the problem with template trickery, but it is MUCH more difficult and messy. You can include only headers and compile cpp files separately then link them together (the nice way), or just include cpp files after header files (mostly used for template classes, in case they are split at all). + Show Spoiler [A.h] +
+ Show Spoiler [A.cpp] +
+ Show Spoiler [C.h] +
+ Show Spoiler [C.cpp] +
B similarly... | ||
dvide
United Kingdom287 Posts
Now, in location.h you're including exitList.h which itself includes exit.h (ignoring the fact that you're including exit.h directly anyway). If you follow the logic of that, in location.h you're using the class location before it is even defined (by including exit.h, which uses location). What you should do is remove the include to exitList.h here and instead replace it with a forward declaration of the class (i.e. class exitList;). Where you include exitList.h is in location.cpp instead. The reason you can break the circular dependency here and not elsewhere is because you're actually using exitList*, not an exitList itself. So this means any translation unit that includes location.h doesn't actually need to know the full definition of the class exitList (except for location.cpp, because here you'll actually create the exitLists). It only needs to know that there exists a class by that name, which is what you achieve with the forward declaration. By using the forward declaration, you're promising that there exists a definition of the class in another translation unit to be linked in. If you fail to provide it somewhere else you'll get a linker error instead of a compile error. I hope that makes sense as to why you're getting this problem. | ||
| ||