• Post Reply Bookmark Topic Watch Topic
  • New Topic

Pseudocode  RSS feed

 
Mark Georgevich
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a project to write for my school It is a program to Create a monitoring system that does all of the following:

Asks a user if they want to monitor an animal, monitor a habitat, or exit
Displays a list of animal/habitat options (based on the previous selection) as read from either the animals or habitats file
Displays the monitoring information by finding the appropriate section in the file
Separates sections by the category and selection (such as “Animal - Lion” or “Habitat - Penguin”)
Uses a dialog box to alert the zookeeper if the monitor detects something out of the normal range
Allows a user to return to the original options

I have to write pseudo code first for this program. I am not asking for someone to write this however I am asking for some hints, assistance in the style of the code and suggestions on methods and classes.

Thanks for any help.

 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you have any ideas on this?  It's probably easier for us to comment on what you've tried.
 
Mark Georgevich
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My ideas are a basic one. I am an employee and I come into relieve the night person. So I log in with credentials, and then check on maybe 3 animals. What their weight is compared to 24 hours before, what they ate and how  much, and  possibly some kind of exercise. I think that would be enough for a beginning program. However, if there is more suggestions to make it more useful, I am open to it.
 
Knute Snortum
Sheriff
Posts: 4288
127
Chrome Eclipse IDE Java Postgres Database VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Great!  Now one more step before pseudocode: explain what you want to do like you're speaking to a young child.  Each step should be logical, simple, and cover all bases.  Then turn this algorithm into pseudocode, that is, how would a computer do this without using a specific programming language.  Then turn the pseudocode into Java.

As you become more experienced, you can often leave out the pseudocode step.
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mark Georgevich wrote:
I have to write pseudo code first for this program. I am not asking for someone to write this however I am asking for some hints, assistance in the style of the code and suggestions on methods and classes.

My advice is to not put the cart before the horse. When you focus right away on "style of the code, ... methods and classes" then you're setting yourself up for a lot of confusion.

Focus first on outcomes. That is, think about what you as a user of the program want to do that is of value/benefit to you.  Then think about how a program can help you achieve your goal and give you that value/benefit. Focusing on outcomes help you think more generally about the problem and its solution and avoid getting trapped in a labyrinth implementation details that often turns into a quagmire of complexity.

What value are you getting out of this as the author of the software? What's your goal? Obviously, as a student, your ultimate goal is to learn how to write programs but what specifically about writing programs do you want to learn through implementing this program? For example, you said you'd like to "log in with credentials".  Ask yourself, "Why?" Is that really necessary now?  How will adding a feature that allows the user to "log in with credentials" help you achieve your learning goal? Is that something that you want to tackle now, with the level of learning that you currently have? Or is there something else that would be more useful for your learning level and learning goals?

As far the program you want to write itself, why do you think a "log in with credentials" feature is necessary? Is authentication and authorization really a big concern in this program to monitor an imaginary zoo and the animals in it? Wouldn't it be more useful to think about other features instead, features that are more directly related to the monitoring of these imaginary animals? Like how is this program supposed to simulate data coming in from the "habitats"? Is this going to be read from a file? I know you said that the list of animals and habitats are to be read from a file but what about updates? If you're monitoring something, the assumption is that the state will change as time passes. Is the user going to enter the new data? Are they going to have to choose a different file? How often is this supposed to happen? Is this supposed to feel like it's in real time or is it some kind of "push a button to get updates" type thing?

How is the data supposed to be presented to the user? How is that information supposed to help them or be of value to them? Do you see how many questions I can come up with just about the main requirements itself? I haven't even touched on those details like logging in with credentials yet. And yet, that's the first thing you asked about. I find it interesting how easy it is to focus on something that's really not very important -- and I'm not saying that all those questions I just listed out are about the really important things either but I think they deserve more attention, at least at the start, than something like logging in with credentials.

Think about these things for a minute and let us know what your learning goals are here and what you think are the more important/valuable features of this program. Then maybe you can start thinking about classes and methods and such.
 
Junilu Lacar
Sheriff
Posts: 11494
180
Android Debian Eclipse IDE IntelliJ IDE Java Linux Mac Spring Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Here are a few more thoughts to ponder:

1. When I learned how to program, "Structured Analysis and Design" was the order of the day. Through that, I learned about functional decomposition, modularization, and managing complexity. I learned that large chunks of code that do many things are BadThings™ and that they pose many different kinds of problems, the least of which is harboring and hiding nasty bugs.

2. It seems to me that the above concepts have somehow been lost in the shuffle of trying to teach people how to program these days. If you look at any posting of code in these forums, you'll see a lot of code that never would have passed muster with the instructors I had back in the day. The main things that are missing: good organization, good structure, and good presentation (I'm talking about indentation and formatting).  You see code where everything is jammed into one or two methods. The code is convoluted and complex. Now, I'm not saying we didn't write bad code when we started learning to program. But heck, many professionals these days still write pretty bad code even after many years of "professional work".  That is no excuse for new programmers to follow the same path though. you should try to learn how to do the right things and do things right.

3. Think of yourself as an author because that's what you're aspiring to be when you set out to learn how to program. There's even a JavaDoc @author tag that you're supposed to use to proudly mark and claim responsibility for the code that you write. Take that title seriously. Good authors know how to organize their work so that it's coherent and understandable by other people who read it. If the work doesn't have those qualities, then it's trash. If you're going to be an author, then don't just learn about grammar and spelling (what you're doing when you learn the syntax and language rules). Also learn about composition (what you do when you think about organization, structure, and modularization). Good programmers and authors know a lot about good composition. That's what separates the real writers from the hacks.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!