Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Bonnie Martin13,671 Points
This part was really confusing and disappointing for me.
I found this process to be SUPER confusing and it didn't even reduce the amount of code.
I was following along great before this, and I felt like I really understood what was going on. Then with this whole rearrangement, everything is much less clear. If you asked me what each line of code was doing, I couldn't tell you anymore.
Plus, I still have the same amount of code. I saved the original version that we'd been working on previous to this, and made a new version as I followed along with this video. Both have the exact same number of lines of code.
So now I don't know what to think. If this was a real-world situation, what would be the better solution? To keep something I understand, or to use code that is supposedly "better" but in reality is way more confusing?
Nicholas Gaerlan9,501 Points
In the real world, you would refactor using the same general ideas instead of leaving the code as-is. I think this is one of the fundamental ideas in OOP to grasp. Maybe one of the biggest hurdles to clear in order to progress past script / markup languages. It's a challenge, but the "aha!" payoff is worth it. Plus, I think if you can grasp it, then it opens the door to idiomatic programming ideas / design patterns / and other abstract ways of thinking about how to solve problems as a programmer. When you read that programmers end up learning way more than one language, it's because they're all pretty similar and refactoring code into functions and objects is a big part of it. On the other hand, simpler things like wordpress will not require this sort of thing and you can definitely make a living with a simpler combination of wordpress, PHP, and SQL.
Christian van Lierop13,758 Points
This video was pretty confusing to me too. Although I do understand the basic concept of what he's trying to say, the pace seems to have stepped up to triple, rushing over very important and reasonably complex concepts.
Also, although the code is shorter c.q. takes up less characters (does that speed up the code significantly?), for a beginning programmer like me it's actually MUCH harder to read. Instead of understanding what each line of code does, I now have to go back to every function and decrypt the syntax, to decypher what it actually does...
I can understand that for an advanced programmer, this makes perfect sense. But if I were to see this code fresh out the box, I'm not shure I would be able to decrypt it and understand what it does, at all... I guess I still have a long road ahead of me...
Armin MemicCourses Plus Student 7,481 Points
Yeah, I agree that it was a bit confusing. I think the positives are that the code is easier maintained, especially if you are working with other people or have to change your code in the future. There is a huge difference in coding alone in a text editor and in a project with other people.