Thread: Computers Nerd homework
View Single Post
Old 10-13-2021, 10:19 PM   #22
Bearcat Bearcat is offline
Would an idiot do that?
 
Bearcat's Avatar
 

Join Date: Nov 2000
Location: Arizona
Casino cash: $2914931
Quote:
Originally Posted by cdcox View Post
He shouldn’t try to write the entire code all at once. It can be too hard to hold the whole logic flow in his head all at once, even for a small problem like this. Instead, he should break it down into simpler projects that will contribute to the larger solution.

1. Turn an rgb strip on.
2. Make an rgb strip show random colors.
3. Make an rgb strip turn on only when the touch pad is touched.
4. Make an rgb strip intensity responsive to pressure.
5. Combine 2 and 4. Done.

This process of breaking problems down into smaller manageable parts and then composing the big solution from smaller solutions is a very important skill for engineering or software. As a budding engineer, he should focus on one tiny task in isolation of the others and just keep pounding on it until he gets a breakthrough. Most likely he will find the activity of solving small problems all consuming.

This will be the process he follows his entire career. If he tries to grapple with the big problem all at once, it can get confusing and frustrating very fast. Imagine trying to design a whole commercial airplane all at once. Every engineer breaks complicated problems into smaller, manageable parts and knocks them down one at a time.
Exactly. And he wouldn't believe how minuscule the problem can be in programming, and if you write a bunch of code, you're basically doing what Fish said and trying to reverse-engineer it.

I learned this in college when I'd write a bunch of code, then would get so frustrated with it I'd start deleting shit until I found the dumbest bullshit ever that I would have found if I had only written the first few lines and tested.

I would also suggest outputting status and variables along the way... so when he sets valeur4 to a random number, add a line to echo that so you know what that value is, and then in the first if statement, have it output "in the first if statement", valeur4=(whatever), valeur5=(whatever).... to ensure it's doing what you expect it to as you follow the wisdom above and go step by step.
Posts: 55,195
Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.Bearcat is obviously part of the inner Circle.
Thumbs Up 2 Thumbs Down 0     Reply With Quote