7 ms·
99 Bottles of OOP now available in Python
- teraflop 2y agoHN's automatic title editing strikes again. The title of this submission should presumably be: "99 Bottles of OOP now available in Python".
- deleted 2y ago[deleted]
- Stratoscope 2y agoNote to anyone who submits an article: If the title gets mangled like this, edit it.
- codetrotter 2y agoIt definitely took me quite a bit of time from I joined HN until I learned that if you edit your submission title then you can override the automatic edits that HN makes to the title you originally submitted. And I would guess that likewise there are still a lot of people that don’t know this. Also, sometimes one might not realize that the title got changed until it’s too late to edit the title of the post.
- amelius 2y agoI wish HN could just take the url and then fetch the title of the page. That would save quite a hassle, especially on mobile.
- jdminhbg 2y agoIn this case, the missing '99' isn't a typo, it's deliberate by HN to eliminate clickbaity headlines like '7 Ways To Be A Better Programmer.'
- layer8 2y agoThat would be prone to title injection by malicious pages. ;) More seriously, HN should instead display an instruction after submitting, informing that the title was changed and that the submitter should check the change and edit if necessary. The issue is that most submitters either don’t seem to notice that the title changed or don’t hit on the idea that they can edit it after the fact.
- zombot 2y ago> edit it. How???
- Jtsummers 2y agoSame as with comments, submissions have an edit link that works for an hour or so after submission. You can only edit the submission title. If you want to edit the link, email the mods.
- deleted 2y ago[deleted]
- zombot 2y ago> HN's automatic title editing strikes again. Demonstrating for the umpteenth time that automated clairvoyance is an idiotic idea.
- hansvm 2y agoHere I was assuming bottles might fit nicely into the Flask ecosystem.
- randlet 2y agoThere's already a bottle web framework [1]. It came out around the same time as Flask I think. It might have even started as a spoof of Flask even? Or vice versa? [1] https://bottlepy.org/ https://bottlepy.org/
- darrenf 2y agoIIRC, it's vice versa. Bottle predates Flask by a few years I think. Edit to add: Bottle's own FAQ says so: https://bottlepy.org/docs/dev/faq.html#what-about-flask https://bottlepy.org/docs/dev/faq.html#what-about-flask
- km144 2y agoWhy does HN automatically edit titles??
- corytheboyd 2y agoIt’s supposed to kill clickbait titles. In practice it just randomly mangles titles. I don’t get why they don’t remove the feature and instead rely on flagging.
- elashri 2y agoPrevious Discussion Bottles of OOP - https://news.ycombinator.com/item?id=12129821 https://news.ycombinator.com/item?id=12129821 - July 2016 (71 comments)
- chirau 2y agothat was not for the Python version
- janislaw 2y agoI have the book and don't speak Ruby at all. Nevertheless, is so we'll written, that you can take the lessons and apply them in any language with virtual polymorphism. A Python version of the book means bigger audience, to the benefit of the trade.
- lastofus 2y agoThis is one of my favorite software development books of all time. It's the book that finally offered straight forward guidance and wisdom on how to properly utilize OOP language features. I'm very happy to see it out for Python!
- crabmusket 2y agoSandi's earlier book, POODR, was also great. While it is focused on Ruby, most of the advice applies more broadly. Reading these two really helped me understand just how impoverished the concept of OOP has become by C++ and Java, from its Smalltalk roots.
- giraffe_lady 2y agoI was so lucky to have run into poodr when I did. Early enough in my career to still feel like I didn't know anything, but with just enough experience to have encountered the problems she was addressing "in the wild." Absolutely formative for me I have no idea where I'd be without it. The only other book to even approach its impact for me is working effectively with legacy code.
- inopinatus 2y agoAvdi Grimm preaches a similar gospel.
- jonathaneunice 2y agoConcur. I took Sandi's workshop based on the 99 Bottles book, in Ruby with a Ruby crowd, but was immediately able to apply it to Python programming. Very helpful and clear thinking about refactoring out complexity—and not just refactoring for its own sake, but under the constraint that you want to move your program forward, add new functionality, etc. Refactoring with a direction, purpose, and direct payoff.
- henning 2y ago[flagged]
- PaulRobinson 2y agoCan you actually give an example? I believe in mechanical empathy. I think developers should - win performance is a concern - think about how their code ends up on the CPU, what ends up on the heap, how caches are used, and so on. But for most Python developers, and Ruby developers, it's more important, in more use cases, to have clear and readable code that is easily maintainable. I've met Sandi, I've gone through her Ruby books, I recommend her teaching and her books to others. I don't see the problem. If you need ASM, use ASM. If you're on a team doing OOP, maybe learn about OOP.
- deleted 2y ago[deleted]
- henning 2y agoLook at the fastest linting/build tools/runtimes for JavaScript. They are mostly not written in JavaScript, because JavaScript is slow and no amount of hotspot profiling/optimization will fix that. This is also why Python's core data types for dictionaries and so on are not implemented in Python. You can also look at any microbenchmark between pure Python and a native language of your choice, even one that uses GC like OCaml or Go, and unless the Python code has been written so that it spends all its time calling C code the way you sometimes can with regex-heavy code, Python will generally lose by a varying margin. These micro inefficiencies multiply at every level hundreds of times over to create needlessly slow, inefficient applications. The truth is I can link benchmarks, case studies of app rewrites from Ruby to Go or something comparable, measurements about the results of using NIFs in Erlang/Elixir, etc. all day long but you'll ignore all of them.
- InitialBP 2y agoA lot of time (most?) writing software isn't about writing software for the pleasure of doing so, but for building something that helps generate revenue. For businesses, having a highly optimized web application that takes a long time to develop and doesn't allow for quick additions of new features is not worth the cost. Instead, they can have a poorly optimized web application with way more features and a faster feature production because Python/Ruby/Javascript are more approachable than other native languages.
- kubav1 2y agoIs the book DRM free? Sorry to be this paranoid, but you cannot be sure today.
- bityard 2y agoYou could check? The site says, "Available in digital form only (epub, kepub, mobi, pdf). Includes separate books for JavaScript, PHP, Python, and Ruby languages, and beer and milk beverages." There is no mention of needing special software to read them, so I think it's safe to guess that there is no DRM. And it's sold directly by the author. Publishers are generally the ones who insist on DRM. It would not surprise me if there was watermarking, but that is not DRM.
- kubav1 2y agoI checked it but found only the same pages as you. This is the reason I asked.
- tomstuart 2y agoYes, it is.
- dangsux 2y ago[dead]
- faizmokh 2y agoYes, I have one. It's DRM free.
- robomc 2y agoMaybe this is misguided, but it feels a bit to me (comparing the ruby and js versions for example) that this is using the same code examples in both, and neither are really typical of the sorts of code people in either language community would actually write?
- jonathaneunice 2y agoThe problem: How do you have examples that are simple enough for those learning the refactoring tricks and techniques to quickly grok and be able to work on, and not overly complicated by the kinds of "real-world complexities" that do regularly appear in "real-world code." I had the same "this isn't realistic!" complaint when studying the book, but the examples nonetheless helped me see, practice, and adopt the techniques so that I could immediately apply them to the complex production examples I needed to improve. YMMV... but as a former skeptic, "trust the process." Walk that path an work those examples for 5 days, then see how you feel. I was already pretty skilled, including in complex refactorings, and it still leveled me up.
- deleted 2y ago[deleted]
- SiempreViernes 2y ago> The 2nd Edition contains 3 new chapters and is about 50% longer than the 1st. I've never really had the problem that I've read an OOP text and felt "this was too short".
- otteromkram 2y agoThank you for using snake_case. That's all I got. Best of luck!
- otteromkram 2y agoI'm glad my comment noting the usage of best practices when it comes to writing Python was downvoted. Says a lot about the immature user base around here.
- cutler 2y agoOOP is an industry of its own which generates a ton of incidental complexity. See "Object-Oriented Programming is Bad" by Brian Wills (https://www.youtube.com/watch?v=QM1iUe6IofM https://www.youtube.com/watch?v=QM1iUe6IofM) and most of Rich Hickey's excellent videos, especially his keynote at Rails Conf 2012 where he basically told the Ruby crowd they're doing it wrong (https://www.youtube.com/watch?v=rI8tNMsozo0 https://www.youtube.com/watch?v=rI8tNMsozo0).
- ejflick 2y ago> OOP is an industry of its own which generates a ton of incidental complexity. Code in any form can generate a ton of incidental complexity. The issue isn't the tool rather than the education to properly wield those tools. Especially when you introduce the team dynamic where everyone has varying understandings of what is being built and how it should be built.
- lelanthran 2y ago> OOP is an industry of its own which generates a ton of incidental complexity. And that "ton" is still miniscule compared to front-end development which almost completely eschews OOP and has 10x more incidental complexity. I guess my point is that, while OOP's incidental complexity is large, it's still insignificant compared to other technology stacks which developers are showing a great appetite for anyway. Things like "incidental complexity" is irrelevant to developers anyway, today, at the tail end of 2024. IOW, OOP introduces significantly less $BAD_THING, when the clear majority of developers don't even care about the quantity of $BAD_THING in the first place, making the whole "should we use OOP" argument moot. Doesn't matter if you use it or not, the extra introduced incidental complexity is still going to be insignificant due to the complexity load of the entire project, more so in front-end. Hence, there's no point in having the argument in the first place.
- bnchrch 2y agoIs your argument that 1. its ok to add incidental and unnecessary complexity 2. so long as it's less complex than your most complex component? Because that's a formula we can all agree leads no where good nor productive.
- gigatexal 2y agoI’m gonna buy the book but I prefer composition over OOP. I prefer to have an init that takes some params where those params are fully baked clients of whatever services I need and then the class just uses them as needed. I don’t see a lot of value in having a Python class that might have a few or more classes that it extends where all the functions from all the classes crowd up the classes namespace. Class Foo.__init__(self, db, blob_storage, secrets_manager, …) Instead of class Foo(DB, BlobStorer, SecretsMgr) Etc
- yxhuvud 2y agoWhy on earth do you put composition and OOP as opposing techniques? Composition is just one more technique in the OOP toolbox and there is nothing in OOP that mandates an inheritance based architecture.
- crabmusket 2y agoMainstream OOP languages (looking at you Java) have failed to make composition as convenient as inheritance.
- flakes 2y agoThe common toolkits today (spring boot, google guice, etc) are much more focused on composition over inheritance, by injecting arguments and implementing pure interfaces rather than extending base classes. Older legacy Java frameworks and bad teachers are more at fault than the Java language itself IMO.
- crabmusket 2y agoI take your point, though having `extends` as a first-class language feature surely encouraged that culture and approach in older frameworks right?
- flakes 2y agoThere are some valid cases where extends really can help, and IMO the language would feel limited without it. Maybe if the language designers had their time back they could have taken an approach like Golang with nested structs and syntactic sugar for calling their attributes/methods. The main reason I see new devs opt for extends, is because that was 99% of the content in their Java 101 programming course, not because it exists in the language. Imagine how many more `friend`s we would have in cpp if that was crammed down everyone's throats? :)
- crabmusket 2y agoI'd like to mention that despite OOP being in the title, I thought this book had a lot to teach that isn't specific to OOP architecture or OOP languages. Really, I think the star of the show is TDD and refactoring. For a short intro to Sandi's style and approach, I always recommend this 35min talk: https://youtu.be/OMPfEXIlTVE?si=Ird6t8uDN86T06Y7 https://youtu.be/OMPfEXIlTVE?si=Ird6t8uDN86T06Y7 Aside from any specifically educational content, as a talk it is fantastic - funny, smart, well put together.
- dennisy 2y agoI have seen quite a few digital books at this price point now. Personally I feel it is quite high, but I assume I am in the minority?
- inanepenguin 2y agoWhile I understand the complaints against OOP, I highly recommend this book to anyone working in an environment where they're working with OOP languages/frameworks. There are plenty of Ruby/Rails shops out there still. At the very least I love the mentality that this book teaches and often recommend Tidy First by Kent Beck at the same time.