• Post Reply Bookmark Topic Watch Topic
  • New Topic

Where to begin...  RSS feed

 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, so you have a wonderful idea for a Swing based project. You know how to program, you know how to use the SWING API. And you know what you want the application to do.
So the question is now, where do you begin?
I have battled with this over time and I typically begin building the main part of the GUI and then filling in actions as I go along. Keep in mind that I do not have the luxiury of someone coding the View while others code the work. Most things I do are for personal purposes, so I have to do it all. So what I am wondering is if anyone has any helpful tips on the SWING app design process.
Thanks.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dont know if this'll be helpful or not but I just started an app, well ok, started a year ago, but was rudely interupted for 9 months. My whoe itent was to create something usefull but mainly to learn better practices in OO design. Most of my work to date has been in web apps with ASP. so I figured I could improve my design skills, my Jaa skills and learn something at the same time.
My whole approach was to act like it was a real project from a client. I wrote a requirments document, I started using UML to try to model it before I got started ( that didn't work too well ). Wrote out use case scenarios and kept track of just about every little idea or thought I had on the project for about 3 or 4 months before I even started to write code. Boy was that tough!!
Now, that I'm actually coding I find that much of what I thought of and diagramed out wont work or cn be done better so I am learning a lot. But you didn't ask about that.
I guess the best place to start (from my minimal experience) is with a clear understanding of what the app will do. I even roughed out some GUI ideas for views and dialogs. When I started coding I started with an app loader and a splash screen. I've been adding pieces as I go, but trying to do it in a way that'll make adding more pieces later easier. So I end up spending a lot of time revising and refactoring things.
The other thing is that I'm trying to do it in stages, building one view at a time or implementing one thing at a time and then thingking about it and how it is going to interact with the other pieces of the app.
It was real hard not to start off extending JFrame and adding things to it as soon as I thought of the idea. I'm glad I didn't though because it'd probably be a huge mess by now.
Not sure if that helped or not....
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My approach in the past has been what you didn't want to do. I started out with a JFrame and added parts as I needed them. Of course, that caused me a lot of going back and changing classes which in turn made me change other classes...in short, it was a pain to keep updating so that every peice worked together.
I've also caught myself on several occasions concentrating on one particular module for so long, I lost motivation for the rest of the app, or even forgot my direction.
I have in the process been able to come up with some better ways of doing things. Like building my menus so they can be accessed and maintained easier in case I need to add or remove things later. Also, I learned that putting main() in the same class you extend JFrame in is not always the best idea. If you pull main out into it's own class and use it as a Launcher for the rest of the app, if you need to change what happens when on the load, it is easier to maintain a smaller file.
Anyway, that is not really the point either. I guess what I am looking for is beyind the 3 to 4 month planning phase, and more at the "I am ready to write some code" phase. And where is the best place to start? Should you start with a JFrame? Should you start building a meny first? Should you start building your actions and the work that needs to be done that isn't really GUI related? Things like that.
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I started with an app loader. Initialy I wasn't sure what all it was going to do. Wait, actually I was pretty sure I knew. Now that I've actually been coding I realize my initial thoughts were pretty far off so I keep revising that as I go and changing little things in it. My next step was the main window. Basically it is just a frame that'll hold the other views, so it was pretty straight forward. After that it was the menu bar. Mostly the menu bar right now is just to have it up there, I end up adding to it as I see the need or as I incorporate some new functionality.
At one point I took a side track into setting up preferences and a preference manager and the functionality to retrieve them - have not worked on the actual view to change them yet.
So, I guess, the way I started was with a loader that created the main window. After that I added things to it as they made sense or as the urge took me. There is no real logical progression to the way I'm doing things. A lot of adding and testing pieces as I go. I did think I needed the main window in order to have something to actually hold all of the menus and dialogs, as opposed to creating a testing framework. That way I can incorporate all of the event handling, parent frames, and other minor details as I go instead of having to move it later. I like this way of doing it as opposed to creating smaller parts and then trying to integrate them later. This way they ae part of the app and I know they work where they are and how they are suppposed to. Of course, if something later on breaks them it might be harder to fix them
Let me know how it goes and what track you take. I'm actually trying to keep notes on my thoughts and ideas as I go so I can go back late and make a sort of planning document for myself for future use.
 
Gregg Bolinger
Ranch Hand
Posts: 15304
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Dave. I will be sure and let you know the route I take. I have been keeping up with your other thread as well on the whole MVC thing. Can I ask what type of application you are making?
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You might find it interesting to build all the bits of your application that do real work with no GUI at all. I built a program that ran fine in console mode, and added a GUI in no time at all. It already used a pub-sub listener kinda thing to announce model changes from many threads to the main thread, so it was simple to make the GUI the listener. This approach assures your model will be clear of any view dependencies!! And makes it much easier to use JUnit from the beginning!!
[ November 12, 2003: Message edited by: Stan James ]
 
Dave Vick
Ranch Hand
Posts: 3244
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Gregg
What I'm trying to create is an interface to use with mySQL. I know there are a bunch out there, and that some fo them are pretty good. At my previous job though I coulcn't find one that did everything I wanted it to so I decided to make my own. This way I'll have one that does what I want it to and more importantly, I'm learning a lot from the experience.
Stan,
That's not a bad idea but unfortunately the whole point of mine is to be a GUI . But for the most part it is the controllers that do all of the work and they don't have a GUI per se but they get all of their instructions/info from the GUIs so I guess that doesn't count.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!