Let’s say I want to learn how to cook. You will probably recommend a book of recipes you like. This would be great if I just want to make a particular type of food. All I would do is to repeat the steps in those recipes and enjoy the results. But that will be a terrible answer if I have greater aspirations. That's if i want to really impress my friends, to do something new or unique. To be an "improvisational cook," I need to understand what's going on in the minds of those recipe authors. I need to understand the practice, not just theory.
For example, write a simple to do list with HTML form elements. You have to learn Data Object Model (DOM) manipulation to properly handle when the user interacts with the page. In some institutions and organizations, they start by teaching how to make a fun game. Sometimes they teach you how to build simple apps like digital clock.
The other way to this is to make your mind solve a real problem. If you want to use computers to solve problems, the hardest thing you need to learn is not the "computer" part: it's solving problems. Once you've crafted a real solution, making the computer do it will not be the problem. The challenges come from thinking not typing with the computer.
In essence learning programming can be fun if you practice and practice more than you read and secondly if you practice by trying to solve a problem. You can also read our posts on areas you can build a tech startup around to have more insights on solving real problem with technology.