Hi, I’m fairly new to Ruby (3 weeks) and I always find my code for my
little projects to be awefully cluttered and excessive. Also, I’m never
sure when to use what. I’m sure a lot of this comes with practice and
experience, but it would be nice if someone could give me some general
pointers for good-practice or link me to a site that already has some
tips. I don’t want to get too deep into my bad practices and habits. =)
Here’s just a sample off the top of my head:
- What’s the stance on global variables? When to use them, if at all?
- Two arrays that have related info. (i.e. a relates to b) or one
- If I’m storing data and know I need to collect statistics on that
should I store everything and then iterate through them to capture
store and collect simultaneously?
I guess what I’m looking for is what’s common practice out there in the
professional world. Sometimes I write 100 lines of code and find someone
else implemented the same thing in 3 lines. =(
Anyway, anything would help! THANKS!