+ 1
Are multiple if statements within for loops considered bad code?
I just started to write some code in Excel VBA and have never programmed before. Now that someone revisited my code, there were a lot of hints I got. Since I am starting to study computer science beginning next month I wanted some insight before implementing 'bad' habits. So while I was already very proud of the code I wrote I got told that using for loops inside if statements which are inside for loops and so on are bad because the program could crash because of spaghetti code. Is that true? Thanks a lot.
8 Respostas
+ 6
Well, the program won't crash because of the spaghetti code... if there are no bugs, it will just run. If you're lucky enough it will run as expected.
But everytime you have to search and correct a bug in dirty code after some time, you will just hate it.
So, it's good to know how to write clean code. Take a look at this to start from - or simply google 'Uncle Bob' ;)
https://cleancoders.com/
+ 6
That depends on which language your university starts with. I guess it's easy for you to find that out on their website.
And use the search function here. There are many threads about 'which language should I learn first'.
+ 6
Maybe read something about oop in general, that will help you for sure.
Java is a huge language, so the earlier the better...
+ 6
Your welcome ^^
+ 1
Thanks for the answer. Do you think it is a good idea begin with c++ as a basic language now and then start java when my studies start?
+ 1
As I said I will learn Java in university. But since C++ is such a deep language and what a read online I think it can help me quite a bit
+ 1
I will look into it. Thank you very much :)
0
I would start with C++. It will be hard but the understanding that you can gain about what actually happens when you run code, is invaluable. Makes learning/understanding other languages easier.