The computer science department has the worst instructors that I have ever seen . . . even worse than philosophy instructors.

I usually daydreamt in class for the most part. What helped me was the fact that I was a self-learner. My textbook was always my teacher and best friend. So, I opened my book and would read the chapters in a day and then sit to program. If the teacher's textbook of choice were terrible, I would go to the library and borrow a better textbook. If you are not one who grasps something quickly, get the book, get the professor's lectures and practice as many problems as possible. Practice makes perfect.
Thank God for the internet too. Now having the best textbook is not the only way to tap resources. The internet has too many articles on subjects of one's choosing. I sometimes consult the internet articles for help on programming.
If you happen to be someone who does best with group work, then befriend someone and study with them. I remember my probability and computation class was dead boring. I would get hungry, sleeping (for the first time), feel fainty, etc. until I stepped out of the class. The professor was intelligent but would never give an example or explain it and he spoke soooo slow and low as if he was dying. Therefore, I closed my ears and couldn't listen to him. Then the time for the midterm came and I was in trouble because the textbook we were using was a tiny handout he wrote himself without explanation and proofs. Luckily I ran into a classmate of mine who had the patience to listen to him. And then she told me how it works. I got it promptly. I studied and performed great in the test. That little head and tail was a miracle!!! So, find someone who can help you.
I hope that helps. The CS professors will remain terrible until the young people take over. Most of the current professors are old people who were formerly math majors but switched. They cannot teach and do not know practicality.