5 ms·
Start using Git right away. The time dimension of code is the most useful to organize. Then learn and use some object oriented programming. Don't go too deep-
by tboyd47 9y ago
Start using Git right away. The time dimension of code is the most useful to organize.
Then learn and use some object oriented programming. Don't go too deep- just enough.
Then organize your code into files and folders based on the class relationships that start emerging. It's really that easy.
One more thing: don't read any books about structuring code or go by any blog posts. They will only teach you someone's opinion. Code structure is a team decision. Make an effort, even a small one, with clear advantages, and your work will be appreciated. Overload your team with demands based on something you read somewhere and they will resist.
- EpicEng 9y ago>It's really that easy It's really not. Neither git, OOP, nor nice folder structures are a panacea (nothing is, of course). I've seen beautiful C in Source Safe and I've seen awful, overly engineered class happy crap in git repos. Writing good, non-trivial systems requires experience and skills in many areas. No design pattern or source control system will save you from yourself if you're just not at that level yet.
- tboyd47 9y agoI'm not sure mystifying good code design is the right approach to take here. I wanted to emphasize that it's something attainable to anyone, and therefore, worth the effort. I'm of the belief that most sloppy or "noodly" code is usually written that way not because the person is unable to produce good code, but because they just aren't trying. There are a lot of reasons why people don't try, and feeling intimidated by other devs is actually a pretty common one.
- EpicEng 9y agoI didn't intend to 'mystify' design patterns, but how useful are they really without experience? Take polymorphism for example. Personally, I didn't have my 'ah ha' moment there until I was faced with a problem which really benefited from it (early career and designing a device which had many supported hardware configurations.) It seems obvious now, but it took experience (i.e. making mistakes) to get here. Maybe I'm just a slow learner, but I don't believe being shown a bunch of class Animal {}; class Dog : Animal {} examples really bring the point home. It's a combination of knowing what tools you have available to you and having the experience to know when and how to best use them. In other words, gifting me a high end set of tools will not turn me into a great craftsman overnight. I think the "they're just not trying" argument is going to be hit or miss. Definitely true for some, not true for others. If you're 10+ years into your career and still writing unmaintainable spaghetti... then yeah, you're probably right.