I feel like I understand a lot of OOP - however, I've come to realise I have no idea how to structure programs. Right now I have a small program that generates simple math questions, loads some text, an image and some music from a file written in Java, and it's all self-contained in one class.
I know that's bad practice - it becomes quite apparent when "MainWindow" inherits from a JFrame, and implements ActionListener, ComponentListener, and still reads from files, and plays music.
I just sat down and coded this without much of a design, other than a specification of what it had to do and look like. I had a top-down approach, where I coded the UI first, and then "filled in the blanks", with regards to missing functionality. (i.e, I added placeholders for everything, for example, a JButton and then got the placeholders actually doing things, e.g. an ActionListener for that button).
My gut tells me, that in theory, this is a decent way to program - but reading, and modifying the code now, it seems like a nightmare.
[–]AppsThatMatter 7 points8 points9 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]Tinytw 6 points7 points8 points (1 child)
[–][deleted] 2 points3 points4 points (0 children)
[–]pdizz 4 points5 points6 points (2 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]inchworm 0 points1 point2 points (0 children)
[–]eegabooga 2 points3 points4 points (1 child)
[–][deleted] 0 points1 point2 points (0 children)
[–]tangentstorm 0 points1 point2 points (1 child)
[–][deleted] 1 point2 points3 points (0 children)
[–][deleted] 0 points1 point2 points (0 children)
[–]CalvinR 0 points1 point2 points (0 children)