File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes Shouldn't I know this already? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Shouldn Watch "Shouldn New topic
Author

Shouldn't I know this already?

Ish Del
Greenhorn

Joined: Dec 05, 2012
Posts: 18
Hello everyone, I have a question as a newbie who just finished an object oriented comp sci course probably a standard 200 level or 2nd course for most people in a degree program. We used Java as a teaching method. It dealt with a lot of theory but not a lot of coding so I am taking it up to myself to practice a lot of coding as well as continue the constant reading. So I googled "simple programs for beginners" and something that keeps coming up is to try and program a calculator. So I start trying to code a calculator but at every step I realize i need to hit the javadoc or google to look things up. For example I know and have a general overview of the swing components of frame, titlebar, menubar and the contentpane. I know i want a row and column of buttons but I dont know how to get those columns so I look it up. Then I realize i dont know what to use to display the input/output portion of a calculator(the screen) so do i want a jlabel, jtextarea, jpanel etc... so i look that up. I read about layout managers like border layout and boxlayout etc... but still need to look them up for implementation and to refresh what each looks like exactly. This is just for Swing i find this happening with other packages as well and especially when I start a new project. For a new project I really need to break out the pencil and paper to think about okay how many classes do i need? What should they be? How do i really break this down into its simplest components using concepts like coupling, cohesion and responsibility driven design?
I just constantly have questions like this in my mind and it really feels like i just will never know as a beginner or how can i have done this for for the whole class and still have so many questions. I guess my question is, is this normal? Was there an AHA moment when you started when it just all started to click for you? Is this just a matter of writing program after program? Maybe I was hoping other coders would share their starting experiences to see how they progressed.

I like doing math problems in java like the initial stuff i found on project euler as i can just use a single class lol, there its more about the math and algorithm kicking your butt.

Thanks everyone reading this, i hope this was the right forum for this post. I didn't see a general chat type forum, everything else was highly technical.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61218
    
  66

Please discover the use of the paragraph. Thanks.

They will make your post easier to read.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Tony Docherty
Bartender

Joined: Aug 07, 2007
Posts: 2289
    
  49
I guess my question is, is this normal?

Yes this is normal. Welcome to the world of programming.
Somethings will become second nature but writing out the problem on a piece of paper is always a good place to start. If you can't describe the problem and solution in detail in your native language then how can you possibly write the code?
Other things like the Java API Docs are your best friend and you will/should constantly refer to them as long as you write code in Java.

Was there an AHA moment when you started when it just all started to click for you?

I'd written code in numerous languages over many years before coming to Java so for me the language side was easy, the part I found difficult was moving from structured programming to OOP and yes, for me, there was that moment of sudden clarity.

Is this just a matter of writing program after program?

There is no substitute for sitting down and writing code but books/articles are very useful for learning good programming techniques etc. My advice is write as many simple command line programs as it takes you to feel comfortable with the language and then move on to GUI based programs. Swing is a complex subject and trying to learn Swing at the same time as learning to code will only add to your frustration and confusion.
Joe Areeda
Ranch Hand

Joined: Apr 15, 2011
Posts: 318
    
    2

I agree with the comment about paragraphs, I'm not sure exactly what you are asking. But that won't stop me from discussing what I think you might be discussing.

I think the question is how long does it take to become so familiar with Java, Swing and all the libraries one would use to write a program? I don't know. I've been writing code since the mid 1960's and have yet to write a program that did anything of significance that I didn't have to look something up. I tend to spend a lot of time using javadoc to annotate my code because I refer to it often.

The actual mechanics of writing a section of code is not what software development is all about. The real skill is starting with a problem, understanding it well enough to design and implement a solution. Then debugging, refining and documenting that solution so that someone else can actually use it.

As you get more experience using a language and development environment the less you have to refer to documentation and do web searches but that need never goes away because we are always working on new things, using new libraries and yes relearning things we once thought we understood.

Feel free to discuss the process. This is a good forum for that stuff.

Joe


It's not what your program can do, it's what your users do with the program.
Jayesh A Lalwani
Bartender

Joined: Jan 17, 2008
Posts: 2376
    
  28

You'll never stop looking at Javadocs as long as you program in Java. No one (that I know of) remembers all the APIs. It;s more important to teach yourself how to find information, than to try to remember all the information.

It's the old adage.. "give a man a fish, he will eat for a day; teach a man how to fish, he will feed himself forever". The java equivalent is "show a programmer how an API works, s/he will write a program; teach a programmer how to read API docs. s/he will program forever". THis is one of the reasons why coderanch frowns against posters giving solutions. We encourage people to learn for themselves
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18570
    
    8

Yes, I recognize that. I have written applications where I was learning the underlying technology at the same time. Some of these applications are still in production at the place where I work, even though technically speaking they leave a lot to be desired.

As for Swing -- I find that no matter how good you think you are, it still challenges you and demonstrates that you aren't that good. If you're a beginner, you'll find out that you weren't paying attention in the object-oriented design class and that you don't really know how to break down the GUI into separate classes. If you aren't a beginner, you'll find out that you didn't understand MVC properly and that you have view code in your model. And after you complete your first non-trivial Swing application and wait six months, you'll realize that it is really a steaming pile of spaghetti and needs to be redone. All of that is normal and you shouldn't be surprised that it's happening.
Ish Del
Greenhorn

Joined: Dec 05, 2012
Posts: 18
Paul Clapham wrote:Yes, I recognize that. I have written applications where I was learning the underlying technology at the same time. Some of these applications are still in production at the place where I work, even though technically speaking they leave a lot to be desired.

As for Swing -- I find that no matter how good you think you are, it still challenges you and demonstrates that you aren't that good. If you're a beginner, you'll find out that you weren't paying attention in the object-oriented design class and that you don't really know how to break down the GUI into separate classes. If you aren't a beginner, you'll find out that you didn't understand MVC properly and that you have view code in your model. And after you complete your first non-trivial Swing application and wait six months, you'll realize that it is really a steaming pile of spaghetti and needs to be redone. All of that is normal and you shouldn't be surprised that it's happening.


HA thanks. It does feel like I am learning Swing while trying to write/test the actual program part of the program. You guys are spot on about that. I might take the advice above and leave Swing for now to make sure my program works and just use input/output via the console. That way I can concentrate on the object oriented design portion instead of struggling with aligning gui buttons where i want them and passing data to swing components or actionlisteners. Good to know its not so uncommon to always be learning something new or when you think you know something it turns out there is a better way.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Shouldn't I know this already?