Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+7 votes

I just want some advices of how to get started writing a code that has to be created completely by my own with no instructions.

asked in CSC201 Spring 2021 by (1 point)
0

Thank you for the question! I am also stuck at kickstarting the project. And thanks for all the answer as they are very helpful for me.

6 Answers

+4 votes

There are three approaches, and you will probably want to do some of each --

  1. Designing Top Down (trying to think about the big picture, and what functions and classes you might need, and then what helper functions you might need, to break it into smaller pieces/steps, etc). This is where some pseudocode can help.

  2. Implementing Bottom Up. Can you write one of the small helper functions, and test it? Does it doe what it is supposed to? Can you write another small helper function, and test it? Can you write a custom class with some instance variables, and test it by itself?

  3. Incremental development. Start by writing a program that displays a blank/empty window. Then, add one feature/thing, to get it one step closer to your eventual project. Test it. Change one more thing, or add one more feature. Test it. After each small change, make sure to test.

IF you try to write all of the code for your project at once, before testing any of it, then your code will have so many syntax errors and bugs, that it will take forever to track them all down and fix them, and the bugs will interact with each other to make it hard to tell what's wrong, when you can't even run it to test it!

Thus, it is crucial to take smaller steps, and test smaller pieces at a time!

answered by (1.2k points)
+2 votes

I think what's really helping me is writing out some pseudocode.

For instance, my project started with three sentences, then from those VERY rough sentences I fleshed out what the beginning of the code should have, then maybe a couple of classes that would be helpful, maybe what I would want in the main function and what other functions might be helpful. Mind you, no actual code has been written yet.

But just getting a general idea of what the structure would look like in human language has been helpful to me this far.

answered by (1 point)
+2 votes

Personally, I think that you should have a big picture plan for what you want to do. For examples, if you want to do games, you will want to list out the features for the game. Then, it is helpful to list out the functions or classes needed to make create those features. After that, you could starting coding by writing the functions at the lowest level.

answered by (1 point)
+2 votes

I agree with Elizabeth with writing pseudocode first. Another thing I have found really helpful in just getting started is reviewing past labs that would have pieces that you need, and roughly following their format, BUT with your variable names.

Examples that I have found most helpful for me are: class Button, Lab 7, Lab 8, clicking and moving circles examples -- these have good examples of how to use Classes/functions you make and use them in your main

answered by (1 point)
edited by
+2 votes

I definitely agree with what everyone has said so far. I think writing out pseudocode would be the best place to start. I think this would help out developing a structure to the code and it would help organize your thoughts as well.

answered by (1 point)
+2 votes

I think that creating psuedo code and comments in your code to help keep organized would help alot. I also think that keeping things in sections under different functions could also help alot.

answered by (1 point)
...