5
$\begingroup$

At my university, my fellow students and I cannot apply practical subjects well... For example, when we are asked to do a software project, we cannot analyze its requirements to know the steps that must be followed to do so, and we cannot translate what we learned in theoretical subjects into practical application easily... How can I develop? My skills are in the practical aspect of programming...and what are the best ways to raise my skills in practical applications of computer skills in general? The project requirements were:

Computer Programming 2: Final Project

Make a C++ program to manage students records and grades. Every student record must have:

  1. id >> a variable of type: int.
  2. first_name >> a variable of type: string, this variable should contain letters only [shouldn’t contain any numbers and special characters], and the first letter should be capitalized.
  3. last_name >> a variable of type: string, this variable should contain letters only [shouldn’t contain any numbers and special characters], and the first letter should be capitalized.
  4. major >> a variable of type: string, this variable should contain one of the following values (“IT”, “IS”, “CS”, “CYS”) all letters should be capitalized.
  5. level >> a variable of type: int, should be from 1 to 4 only.
  6. marks[] >> an array of type: int, the content of each index in the array will represent the marks of one subject which will be between 0 – 100.
  7. size >> a const variable of type: int, should be 6 [ no need to ask the user ] this would be the size of the marks[] array.
  8. total_marks >> a variable of type: int, which is the sum of all the subjects in the marks[] array. This means that the number in this variable should be between 0 – 600.
  9. grade >> a variable of type: float, this variable contains the result of dividing total_marks and size.
  10. student >> an array of type: Student, the type you will create as a struct.

Software Requirements Specifications (SRS) :

  1. The program should contain:
    • Functions: all of the program’s main operations should be done using functions.
    • Structs: the student will be created not as a single variable, but as a struct.
    • Arrays: as mentioned in the previous section, the marks will be an array. And you will also have an array of the student struct.
    • Files: the data in the program will be stored/restored from a file.
    • Header file: this is a library that you will create and make all of the functions and structs inside of it. Then you will include it in your project as well as some of the main built-in header files you will include such as iostream, … etc.
  2. The Main Menu of your program should look something like this:
    1. Add a new Student Record.
    2. Edit a Student Record.
    3. Delete a Student Record.
    4. Search for a Student Record.
      o Search by the student’s id
      o Search by the student’s name
    5. Display All of the Students Records.
      o Display the students ordered by id.
      o Display the students ordered by name.
      o Display the students ordered by grade.
    6. Exit.
$\endgroup$
2

4 Answers 4

7
$\begingroup$

To translate a program specification like this into a working program, a few things are required.

First, you'll need an understanding of what's being asked. Define all terms in the assignment. For example, do you know what a "struct" is? How about a "function"? If a term is unclear, revisit earlier lectures or research online or in your textbook. Write down any knowledge gaps and build up from first principles, writing simple standalone programs that help you learn about one concept in isolation from the overwhelming complexity of the full app.

Once you've defined the problem, break the problem down into small enough pieces that you can begin making progress on something, even if it's just printing "hello world" on the screen. Once you have that, work on the next achievable step, such as creating an integer id, or a Student struct with an integer id, and print that. If you're not sure about how to use structs, you could ignore that requirement in the short term and use loose variables, or begin working on something else, like displaying the main menu. Programs are developed incrementally, using temporarily simplified requirements. Re-compile your code after every change and verify that it still works.

Functions are a useful simplifying tool. Once you have a piece of working code in a function, you can verify its inputs and outputs on its own, then set it aside and call it when you need it, without worrying about the steps inside it, like you do when you use a C++ library function.

But if you haven't used functions, that's OK--parts of the program can be written without them, then you can refactor to add functions later. Same with user interaction--you can skip that and hardcode the user input initially. Likewise, you can skip the file storage requirement at first and have the program work in memory only. Then, once that's working, introduce the file storage functionality.

Another simplification opportunity are the student record operations. You'll eventually need to add, edit, delete, search and list student records, but for starters, set most of these operations aside and just focus on listing student records from hardcoded data. Then work in the other behaviors one by one, verifying as you go.

To summarize:

  1. Understand the problem. Confront any knowledge gaps as soon as possible.
  2. Break the problem down into small pieces and begin working on the first one. Temporarily simplify requirements, and don't be afraid to go all the way back to first principles if necessary to find a foundation to build on.
  3. Compile and run frequently, fixing errors and validating your code as you work, using multiple inputs. Debugging and testing are important skills which take practice.
  4. Build on your sub-problem solutions, gradually introducing complexity until all the pieces work together and you've solved the large problem.

By the way, the process I've described can take an unbounded amount of time, so I suggest beginning it as soon as you receive an assignment (or sooner, preparing your fundamentals independently by working on basic exercises, similar to learning a musical instrument).

See also: Find a Simpler Problem by Eric Lippert.


On a broader level, when you're facing a difficult problem, it's normal to want to blame your circumstances (professor, school, etc) but doing so will only harm yourself. You'll inevitably encounter unhelpful professors (later: coworkers, clients, etc), but don't let them stop you from reaching your goals. Try to reframe "we cannot" into "we cannot right now, but if we develop a plan and build in small steps, we can".

Real world software specifications are often much less concrete than this assignment. But regardless of whether you're a student or professional, if you're truly stuck after applying the strategies in this post, you can ask professors, colleagues and clients for clarification (but sometimes you won't get much!).

$\endgroup$
0
3
$\begingroup$

The lab requirements you've outlines are very concrete and straightforward. If many students in your class are having trouble decomposing the problem into sub-problems, then that suggests to me that the course might be simply moving too quickly.

Since you are not free to change the pacing of the course, I strongly recommend building some side-projects in C++. You can work on something you'd find fun, or you can use a site like Project Euler to give you some interesting problems to tackle. The goal here is to simply give yourself some time to code and absorb some of the ideas better. This extra time can help you to construct firmer mental models of what programs do and how they work. Even a little bit of progress in this will be likely to help you enormously in your course.

These core ideas (input and output, problem decomposition) take time to digest, so I recommend giving yourself that time.

$\endgroup$
0
2
$\begingroup$

I think that one key issue I see all the time is asking students to build contrived applications. You need to give them an actual problem to solve. The final assignment you were given seems pretty lazily thrown together by the professor. This is why it's hard to take what you were taught and apply it.

Anecdote: My little brother almost dropped out of college because he just couldn't grasp calculus and failed the class. He ultimately went back the next year and had a different professor, and now he's published a paper and is on a fast track to be a professor at that college. He told me that it all came down to the difference in teaching style. He said the second time it was easy and intuitive.

The ultimate point here, is that you're paying that school to teach you. If that teacher is doing a poor job, you should find a different teacher, or a different school/program.

I've worked with quite a few people now who took an online code camp course, and they have all turned out to be good hires.

$\endgroup$
4
  • 2
    $\begingroup$ Welcome to the site! Although the assignment won't win any "wow!" awards, it is a complete CRUD application with persistent storage, which seems representative of a large chunk of real-world programming. As far as professor quality: in programs I've been through, I'll inevitably run into an upper-division teacher I don't gel with in a required class. As an instructor, there are students who don't gel with me. While unfortunate, I think it's an important skill to take one's educational outcome into one's own hands at a certain point and learn the material regardless of who's at the helm. $\endgroup$
    – ggorlen
    Feb 16 at 23:38
  • $\begingroup$ I'm not saying that they didn't get along, they got along fine, I'm saying the teacher was not good at teaching. If the professor is being lazy with their teaching assignments, it's going to be a lot more difficult for the students to understand what's going on. $\endgroup$ Feb 23 at 21:59
  • 1
    $\begingroup$ I'm not sure "not good at teaching" is an objectively measureable thing. I suspect it's more a matter of fit. I've had some great classes that were pretty hands-off from the teacher and had a blast hacking on my own most of the semester, while other students didn't care for the course. But assuming there are teachers who simply cannot teach (they probably exist, just less than many students assume), as a student, should you blame the teacher and quit as a result of that, or should you learn what you're there to learn anyway? I vote the latter option in most cases. $\endgroup$
    – ggorlen
    Feb 23 at 22:14
  • $\begingroup$ Im with Kelly on this. CRUD is fine; C++ is also fine (ahem). But CRUD in C++ is not. I see this as a bad question $\endgroup$
    – Rushi
    Feb 27 at 6:40
0
$\begingroup$

In addition to what has already been said. Learning to program at the same time as learning C++ is too hard (cognitive load theory in teaching says: Keep detractions to a minimum. Keep steps small.).

Therefore, first learn to program, then if necessary learn C++.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.