tag:blogger.com,1999:blog-9620948.post4349639539681746715..comments2023-10-20T12:24:17.734-07:00Comments on Binstock on Software: Beautiful Code vs. Readable CodeAndrew Binstockhttp://www.blogger.com/profile/16321156191558412680noreply@blogger.comBlogger13125tag:blogger.com,1999:blog-9620948.post-37376776613536327472009-08-07T18:11:00.357-07:002009-08-07T18:11:00.357-07:00Pablo, *x++ = *y++ means copy the memory content w...Pablo, *x++ = *y++ means copy the memory content where y points to into memory where x points to. Then increments x so it points to the next memory location, and do the same with y.yudhiwidyatamahttps://www.blogger.com/profile/09175713355753162410noreply@blogger.comtag:blogger.com,1999:blog-9620948.post-62980677064094360432008-06-04T08:14:00.000-07:002008-06-04T08:14:00.000-07:00Sorry, it's been some time i did some programs in ...Sorry, it's been some time i did some programs in C but you make me wonder what exactly this line does: *x++ = *y++Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-87641564455893546442007-12-16T14:36:00.000-08:002007-12-16T14:36:00.000-08:00Anyone interested in this topic needs to read Kern...Anyone interested in this topic needs to read Kernighan & Plauger, <A HREF="http://www.abebooks.com/servlet/SearchResults?an=kernighan&sts=t&tn=elements" REL="nofollow"><I>The Elements of Programming Style.</I></A>qu1j0t3https://www.blogger.com/profile/16041515498065869604noreply@blogger.comtag:blogger.com,1999:blog-9620948.post-76160113006887023412007-12-13T20:43:00.000-08:002007-12-13T20:43:00.000-08:00I just want to give another +1 to Haskell when it ...I just want to give another +1 to Haskell when it comes to clean code. There's a caveat: Haskell doesn't shy away from extremely high levels of abstraction which can be difficult while you're learning, but the end result is a language which makes it almost impossible to write slushy, spaghetti code.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-26828328256171407712007-12-13T15:54:00.000-08:002007-12-13T15:54:00.000-08:00More readable == easier to read. It's clearly eas...More readable == easier to read. It's clearly easier to determine what count++ does than what tally() does. "similar levels of abstraction" is useful only when it makes for "easier to read".Late Chris Thiessen, now Sonia Thiessenhttps://www.blogger.com/profile/00744055249956973895noreply@blogger.comtag:blogger.com,1999:blog-9620948.post-8546793433296285462007-12-13T15:36:00.000-08:002007-12-13T15:36:00.000-08:00Proper credit should be give to IBM, who came up w...Proper credit should be give to IBM, who came up with: Input(); Process();Output();...if you don't believe this, google for IBM and HIPOAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-72854076813733759122007-12-13T15:32:00.000-08:002007-12-13T15:32:00.000-08:00beauty is only skin deep. Error handling is ugly t...beauty is only skin deep. Error handling is ugly to the bone!Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-85735495871257729102007-12-13T13:09:00.000-08:002007-12-13T13:09:00.000-08:00@anonymous re commenting:The name "tally" is a com...@anonymous re commenting:<BR/><BR/>The name "tally" <B><I>is</I></B> a comment. The best form of commenting is the code itself. If the reader can't tell what tally() does, then it needs a better name, like "update_counter", "next_event", or whatever makes sense in that context.<BR/><BR/>Also, Mike Vanier uses the phrase "snap together" to describe Haskell in <BR/><A HREF="http://www.cs.caltech.edu/~mvanier/hacking/rants/scalable_computer_programming_languages.html" REL="nofollow"><BR/><I>Scalable computer programming languages</I></A>.<BR/><BR/>But you don't need Haskell to write clean code. The secret is to<BR/>design each function to do one and only one thing, and avoid side effects like I/O and globals. Then you can put functions together like legos and each function always works the same.danbhttps://www.blogger.com/profile/00888160127591318240noreply@blogger.comtag:blogger.com,1999:blog-9620948.post-50201045697267166382007-12-13T11:58:00.000-08:002007-12-13T11:58:00.000-08:00I disagree with using tally() instead of count++. ...I disagree with using tally() instead of count++. tally() will require readers to locate the tally() code to determine what tally() actually does. The extra time spent searching for the relevant code certainly isn't worth retaining some level of abstraction.<BR/><BR/>Of course, this wouldn't apply to significantly more complex code segments than count++.<BR/><BR/>A simpler answer: decent commenting.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-26463826853157463682007-12-13T10:16:00.000-08:002007-12-13T10:16:00.000-08:00I also admire Kernighan, et al.'s powerful and bea...I also admire Kernighan, et al.'s powerful and beautiful coding style, and am always glad to hear of more books in a similar vein. However, I thought the comment: <BR/>(Consider the use of the word 'patterns,' which is highly misleading. It's not at all about patterns.)<BR/>was comically ironic. While I was reading the post, I was asking myself, "When's he going to talk about, O'Reilly's 2007 book 'Beautiful Code'? That's what the title's about, right?" (Reads more.) "Uh, right?" (Finishes article.) "Gee, that title's kinda misleading." :-)Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-24503257716599783682007-12-13T09:49:00.000-08:002007-12-13T09:49:00.000-08:00I think i would rather use count_up(); than tally(...I think i would rather use count_up(); than tally(); but I agree about the concept. <BR/><BR/>One should never forget that ruby and python are easier than Java / C / C++ (which is not necessarily a bad thing, more people means more ideas) and this will directly impact the thinking pattern (if you have to make the parser happy, or if you can think of a problem at hand)<BR/><BR/><BR/>PS: I find it hilarious that there are so many C coders that use perl a lot. I think they are lazy to never try python or ruby, but instead keep on bitching against them. I know a few of these guys. For them, ruby/python is EVIL and they stick to their perl mindset. :>Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-9620948.post-5385757869526952202007-12-13T08:49:00.000-08:002007-12-13T08:49:00.000-08:00This comment has been removed by a blog administrator.Vasudev Ramhttps://www.blogger.com/profile/13568740634188042591noreply@blogger.comtag:blogger.com,1999:blog-9620948.post-64917074939580617712007-12-13T07:39:00.000-08:002007-12-13T07:39:00.000-08:00If you like *x++ = *y++ you should check out Haske...If you like *x++ = *y++ you should check out Haskell, the unchallenged lord and master of the one-liners. I forget the link, but if you google hard enough, there's a source-character-count-optimized version of the four queens problem written in just four lines of code. And one of those lines is actually just the IO code to print out the solution. It's quite amazing. <BR/><BR/>But clever code is never as productive or useful as readable code. It's analogous to in mathematics where authors will name their variables with greek letters (or sometimes even more obscure letters) just to sound more fancy and intelligent. Fancy is fancy, but readable is better for the world.Tac-Ticshttps://www.blogger.com/profile/14070765709653635739noreply@blogger.com