r/adventofcode • u/Run_nerd • Dec 06 '20
Other Advent of code is humbling! I'm realizing I have a lot to learn...
I'm what I would consider a beginning programmer, and I've been having fun working through the first six days of Advent 2020. I've been able to get through the first six days OK, but it usually involves a ton loops, and creating many count variables.
It's pretty impressive looking through the solutions other people have been posting and seeing there are much more elegant ways of solving these problems (requiring a lot less code). It's making me realize I have a ton to learn when it comes to programming.
I'm not sure how far I'll get through the 25 days, but these exercises have been pretty fun so far.
Anyway, thanks to /u/topaz2078 and the rest of the community for creating such a fun exercise every year. For some reason I'm finding myself more motivated to work through these daily problems than other similar sites (codewars, etc).
9
u/0161WontForget Dec 06 '20
Yep. I understand basics concepts but have struggled at times. I think I’ll be on the sidelines looking in for the most part.
Im fine with that. I’ve learnt a hell of a lot this year and i’m excited to learn so much more.
112
u/jerrocks Dec 06 '20
Sometimes the shortest amount of code isn’t the right amount of code for production systems. I agree it’s impressive to see one line answers, but if someone submitted that to a repo I own I’d very likely ask for changes to make it clearer wtf is happening without having to spend 10 minutes of head scratching.
Tldr; keep learning but try not to get sucked into the golfed answers being intrinsically “better” code.
30
u/fmpundit Dec 06 '20
It’s actually been a confidence builder for me. My code might not always be perfect. But so far I’m having no issue working through the problems. Even if I did spend 6 hours of my day off to fix an issue I was having with the passport task only to find it was because I didn’t fully understand what the regex was doing.
18
u/aardvark1231 Dec 06 '20
Started off doing Advent of Code with a limited understanding of C#. I've gone back and done all of the problems and have learned so much. The thing I found that helped me learn the most, was going back to old code some time later and refactoring it to be more efficient.
Not only did that help me learn, and see how far I have come, but it also showed me how important it can be to write clean and legible code, especially if it's something you'll eventually come back to.
Glad you're enjoying the event and I hope you continue to have much fun and learn a lot along the way!
9
u/sharkbound Dec 07 '20
the fact AOC secretly teaching you how to write stuff like binary searches is what i love about it, it forces you to learn, and try new stuff or experiment with data structures.
its really unique in this regard, as its not hard enough to normally make you wanna quit, but tough enough to learn and grow
7
u/LadySqrrl Dec 06 '20
I agree!! I’m a very beginner and I know I’m doing things in like the least efficient way possible. It’s really fun and a great way for me to learn. I’m going to compare some of my earlier days’ solutions to ones I find on here and try to learn ways to improve. 😊
6
u/bkendig Dec 07 '20
Pick a language, solve a challenge, then go see how other people solved it in that language. More often than not you'll pick up some good tips to add to your toolkit!
And then remember you can go back and improve your code. :-)
4
u/MattieShoes Dec 06 '20 edited Dec 06 '20
Line count depends mostly on what language you're doing it in...
Like I'm using Perl, so reading a file is one line, and conversions from strings to ints are implicit so those are 0 lines. Regex is baked into the language so that's zero additional lines to use... Anyway, that's great for speed of coding, but that doesn't make it inherently good.
I think the problems thus far really emphasize regex and hashes (or dicts, or associative arrays, etc.) -- at least, I used both in a lot of my answers. If you aren't familiar with those, I'd recommend looking into them. You'll encounter both regardless of what programming language you happen to be using.
The binary one, problem 5... That was probably the least friendly to beginners. I think a lot of experienced coders will cotton on to it being regular old binary with different letters right away, and newer folks will not, then will have to reinvent the wheel writing functions to encode decimal numbers in binary when they could have used
sprintfor something. :-)3
u/enderflop Dec 07 '20
I always try my hardest to solve the problem, and I've managed to do all the 2020 challenges so far. Working through the 2015 challenges in my free time and I've resorted to copy pasting code for days 7 and 9 so far. Even if I don't come up with the code myself, I type it out and look up the methods I don't know. I didn't solve the problem, but I learned more about recursion, what a set() is, what .setdefault does, and how map handles iterators.
Even if you eventually hit a problem you can't solve, don't give up. Find a solution you can kinda understand and work through it until you fully know what's going on. It's worth it :)
3
u/[deleted] Dec 07 '20
What really makes it fun is the second half of the problems... it forces you to keep your code general purpose, so that it only takes a small tweak to get the second answer.
It would be nice if we could enter the programming language we solved the problem in after getting the second half answer write, and break it out somehow by language.
3
u/evert Dec 07 '20
If you're a beginner and made it to day 7 you are doing excellent! Being able to break down the problem in smaller logical steps is the hard part!
2
u/SecureCone Dec 07 '20
It's definitely humbling. My first AoC was in 2018 and I wrote such crazy long code for it. After day 7 I started needing to do a ton of research to be able to learn the algorithms to do the problems. It taught me so much. Two years later I'm much better at it and have learned so much about programming I never would have otherwise learned.
2
u/J-Swift Dec 07 '20
The most important aspect of software is that it does what its supposed to do. Everything else comes next.
2
u/nutrecht Dec 07 '20
I'm in a few groups with developers that are definitely not 'beginners' and even we learn a tons of stuff from each other. Even if another approach is not really better; it's still incredibly interesting to see all those other ways a certain problem can be tackled. In fact; I think it's a defining quality of 'senior' developers is that they know there's no single 'right' answers to most questions.
For example, in day 5 I definitely did recognize the binary search but I did not see at all that those tickets were simply binary numbers. So I still learned something.
2
u/phrodide Dec 07 '20
It is nice doing these. As a long time programmer I often find myself in the weeds doing boilerplate or fixing buttons on a webpage or similar mundane tasks.
Challenges like these let me go on programming vacation, so to speak, from the routine.