6 ms·
Would people reccomend this as a way to cement an understanding of Python / OOP in general? I’m typically more geared towards data science style scripting use c
by vavooom 5y ago
Would people reccomend this as a way to cement an understanding of Python / OOP in general? I’m typically more geared towards data science style scripting use cases and want to explore more problem focused programming.
- weaksauce 5y agoDoubtful unless you do it in a way that facilitates that understanding. it could be like a year or two ago where you build up a computer from the ground up and do things with it where it would be more oop but a lot of the times they are self contained and don't require that much structure. if you do it deliberately it's a good way to learn a new language.
- gameswithgo 5y agoit can be a great way to learn a language and to explore other programming paradigms.
- dr_kiszonka 5y agoI'd say AoC is more about problem solving and less about Python. The puzzles tend to be pretty good and I usually learn something from them. You could have a look at the previous edition to see if AoC is something you'd enjoy [0]. What I found informative was looking up other people's solutions on reddit and GitHub. There is also Rosalind for more data oriented challenges [1]. 0. https://adventofcode.com/2020 https://adventofcode.com/2020 1. http://rosalind.info/problems/locations/ http://rosalind.info/problems/locations/
- nijaru 5y agoI just started rosalind after someone posted it on here last week. They're definitely focused on bioinformatics similar to euler being more math focused. I haven't gotten too far, but the initial problems don't seem too hard in higher level languages. They are very good problems to get better at IO, string manipulation, and data wrangling in your language of choice though.
- sundarurfriend 5y ago> I just started rosalind after someone posted it on here last week. Same. > I haven't gotten too far, but the initial problems don't seem too hard in higher level languages. True. But the info boxes in the top are interesting and informative, those make it worth it to keep going. > They are very good problems to get better at IO, string manipulation, and data wrangling in your language of choice though. For me, it's also a way to peek into BioJulia and get some familiarity with it. (I don't mind "cheating" this way since this was my primary goal with the site anyway.) So far I'm pretty impressed by how fast it is!
- WoahNoun 5y agoI usually use AoC with some specific goals or limitation in mind to teach myself. The problems will not require OOP, but if you force yourself to solve each problem using OOP... Last year I did typescript and tried to really focus in on the type system.
- bashbjorn 5y agoI highly recommend it to explore new programming styles in general. As some others, I use it as an excuse to learn a new language each year. While I think python is a really great language for advent of code, I'm not sure I'd recommend going for an OOP-heavy style. Although that might just be a matter of personal taste - I think OOP is a poor strategy for most problems.
- heelix 5y agoYup. Very much a chance to learn a new (for me) language. Looking to do Golang this year - brushing up on the basics of the language as we roll into a long turkey weekend.
- BeFlatXIII 5y agoI'm torn between Clojure (totally n00b) or Elixir (mostly to force myself to use it rather than defaulting to Python)
- ravi-delia 5y agoI'm something of an elixir zealot, but I have to say that Clojure has the most pleasurable syntax for this kind of thing out of any programming language.
- BeFlatXIII 5y agoThat's good to know. What is it about the AoC that makes it play into Clojure syntax so well?
- ravi-delia 5y agoClojure is the most practically expressive language I've ever had the pleasure of working with. For some reason the example that immediately comes to mind is how you can use a collection as an accesser for itself, so ({:a 2 :b 3} :a) returns 2. Just a neat bit of syntactic sugar, but now if 'blacklist' is a set, you can just do (remove blacklist guests) to remove everything in blacklist from guests. There's a hundred little things like that which combine to make it a really fun and concise language to work with.
- rak1507 5y agoPython, sure, but not OOP. Most solutions will not be very large and there's really no need for OOP (ever) but particularly not for something like this.
- exdsq 5y agoDon't hate on poor old OOP :( It's a good way to take that step from scripting to software engineering. Sure it can get out of hand with AbstractSingletonProxyFactoryBean's but so can other paradigms.
- lostcolony 5y agoI mean...it forces you to plan and organize your code, if that's what you mean. But I also think it encourages you to do it in a way such that the organization becomes more important (and oftentimes, more complicated) than the problem you're solving, and I'd contend that's kind of a bad way to take that step, especially for people not otherwise experienced enough to know how to avoid that complexity.
- benttoothpaste 5y agoYou can apply OOP principles to even the simplest problems. Search for “fizzbuzz enterprise edition” to get some ideas.
- exsf0859 5y agoAoC won't teach you anything about OOP. The problems are designed to be solved in Python with less than 100 lines of code, by taking advantage of Python's extensive library of data structures and algorithms.
- Barrin92 5y agoquite strongly disagree with this. You can solve the problems with fewer than 100 lines of code, but you can certainly also take it as an opportunity to flesh your programs out in OOP style. In general, programming is about what you want to do and learn, and the problems aren't designed for any specific paradigm. A lot of people have taken Advent of Code as an opportunity to not lean on any external libraries for example. There's numerous problems from board or combat game simulations, to mazes and the intcode computers that lend themselves to be approached in OOP style. The context OP is coming from is data science scripting, it's fine to start with small examples.
- lpapez 5y agoI did AoC2020 with C++ and did it in a enterprise, over-the-top, well-structured way. E.g. need to find two items whose prices sum up to 123? Implement a multidimensional knapsack just in case you need it later (spoiler: I did need it). If you take the time, and don't bother with the leaderboard, you might find AoC to be a really fun and engaging way to explore new concepts and solutions.
- gordaco 5y agoYes, this is the way I do it as well. There were quite a few cases where I went all in with an apparently overengineered solution, and then I could use the code directly for the second problem with almost no changes. I don't go for being the fastest or anything, I just want to do everything in a way that I like. Last year I did everything on the same day it got out; I plan to do the same this one, unless there is a particularly bullshitty problem that puts me off.
- grumple 5y agoContrary to other responses, you can certainly use OOP programming to solve these problems, and I think that is a better way to do it. You wouldn't write 100 line blocks of dense algorithms in prod code, why do it here? Thinking about breaking things into objects makes a lot of the problems easier to solve in my opinion. That said, I don't think it's great for really getting in depth understanding of any language in particular - you'll only use a limited subset of language features for these problems.
- gramie 5y agoA couple of years ago I decided to learn Kotlin by doing AoC puzzles. It was a really good way to get comfortable with the basic syntax and data structures of the language.
- heavyset_go 5y agoI think most problems would be solved elegantly with a pseudo-functional approach in Python, so AoC wouldn't be the best for OOP. Make an API client, a GUI or game if you want to use OO in Python canonically.
- nulbyte 5y agoMaybe they could be, but that doesn't mean they have to be. My intcode computer was written using OOP.
- bccdee 5y agoOOP's toolset is useful for abstracting over interchangeable parts, which is the sort of thing that doesn't really come up a lot in Advent of Code problems. AoC is lots of fun, and Python is a great language to do it in, but I don't think it's a good place for OOP.
- lalaland1125 5y agoAdvent of Code is generally to small to help with OOP practice. It will help get you familiar with Python though.