1. 3

    While we’re on the subject, does anyone have a great recommendation for a book on SQL? I don’t have to write a ton of super complex queries in my job, but once every month or two, some task calls for a good bit of SQL writing, and I’d like to get a better foundation that just “what I’ve picked up over the years plus Google”.

    1. 9

      Not a book recommendation but a couple pieces of advice which helped me shift out of the procedural mindset:

      • Think about the problem in terms of sets and transformations rather than individual instances.

      • When formulating a query start with the SELECT and write a list of what you want to see in the result set. This is the goal you’re working towards. Add in appropriate joins to build a set of the data you require. This is your starting point. Figure out the intermediate set transformations required to get from start to finish. Coincidentally this made the ordering of SELECT, FROM, and WHERE click. I was previously thinking in terms of FROM, WHERE, and SELECT.

      Hopefully that’s not too elementary. Coming from a similar background I’d never really had that spelled out to me.

      I came across the advice in Joe Celko’s SQL for Smarties, which I think is probably too basic for your needs. I haven’t read anything else by him so can’t vouch but “Joe Celko’s Thinking in Sets: Auxiliary, Temporal, and Virtual Tables in SQL” might be helpful? I’ve also heard good things about “The Essence of SQL” but it’s out of print so good luck finding a copy!

      1. 1

        I find it amazing how differently you approach this than I do, yet I would assume, we would still end up writing very similar queries.

        1. 1

          How do you approach it?

          1. 4

            I tend to think of the database like a tree or a perhaps a map (as in google not reduce). I look at the fields I know I need to return, and then mentally map them across the database. I start my query by working from the trunk, or root node if you don’t like wood, of my tree and then map out the query from there. The root node isn’t always the same table; so that can vary based upon the required fields. After selecting all the fields I need from the root, I proceed to join the next table required by my SELECT. That isn’t always direct, and many times, there are tables in between. The process repeats till I have all the tables I need.

            This line of thinking has lended itself well to pretty much every dataset I’ve encountered. Words like “set”, “transformation”, and “instance” never even crossed my mind.

            1. 1

              Now obviously words like “set” and “instance” have a great deal of meaning in database land, but as far as writing queries go, those aren’t words I tend to think of.

        2. 1

          I use CTEs a lot in Postgres, so I find that I work towards the final result in a different way, more like I would in code - by treating the query as a series of data transformations. So, for example, if I want to produce a result for a set of users on a range of days, I write a CTE to get the users, then another one to generate the range of dates, then another one to combine them to get all possible “user-days”, then another to retrieve the data for each and process it, and so on.

          This results in very readable queries - way better than having subqueries all over the place. There are performance caveats to using CTEs so sometimes I have to structure the query differently, but it works well for a lot of them.

        3. 5

          The docs for Postgres are amazing, and a good resource for this. It will call out which parts of SQL it’s explaining are Postgres-specific/not in the SQL standard.

          https://www.postgresql.org/docs/current/static/sql.html

          1. 2

            I’m a very from first principles thinker and so I hope this recommendation isn’t off the mark for your needs. I really liked “Relational Theory for Computer Professionals” by C.J. Date. The book is roughly broken up into parts, the first is an introduction to relational theory and what that’s all about. This is the best intro to relational algebra that I’ve ever seen, a close second is the Stanford Database online class (you can just study the SQL part of the course). The second part of the book takes what you now know about relational algebra and shows how it fits with SQL.

            This helped me peel away some of the syntactic confusion around SQL syntax and made the whole concept make more sense.

            1. 1

              My 2 favorite resources over the years have been: “SQL for web nerds: http://philip.greenspun.com/sql/” and the official postgres docs.

              1. 1

                You can also check this book : https://twitter.com/BonesMoses/status/832983048266330113 and his blog how is full of very good sql

                1. 6

                  We really need to come up with a better way to handle reposts.

                  1. [Comment removed by author]

                    1. 9

                      FWIW I this was my proposal.. Similar to your idea, I think.

                    2. 2

                      Holy cow Lobste.rs is over four years old

                    3. 5

                      Since the previous discussion is from 4 years ago, I don’t see the problem in having a new post/discussion here.

                      1. 3

                        I don’t think there is a problem with there being a new thread/post here but it would be nice to have a list of all the prior discussions as well.

                    1. 1

                      If the FBI had the ability to brute-force the device, what would the outcome be? I would hope (but doubt) Apple complying would make no real difference (i.e. brute-forcing would take decades) due to the security.

                      1. 19

                        The phone in question is an iPhone 5C. It doesn’t have the secure enclave that later A7 models have, so the delay for wrong guesses is only in software. See http://blog.trailofbits.com/2016/02/17/apple-can-comply-with-the-fbi-court-order/ for a good summary.

                        1. 3

                          In order to limit the risk of abuse, Apple can lock the customized version of iOS to only work on the specific recovered iPhone and perform all recovery on their own, without sharing the firmware image with the FBI.

                          Even if there were a way to tie it only to that specific device, they still have to create and sign a neutered version of iOS. I think the signing part gets into tricky 1st Amendment stuff.

                          1. 3

                            Hmmm.. and, if the FBI were to attempt any reverse engineering, could Apple file suit under the DMCA? That would be amazing.

                            1. 10

                              From 17 U.S. Code § 1201 (e):

                              This section does not prohibit any lawfully authorized investigative, protective, information security, or intelligence activity of an officer, agent, or employee of the United States[…]

                              1. 3

                                Yes, I forgot about that. Shame.

                            2. 2

                              I’m not a lawyer and this is not legal advice. :)

                              I can’t see how the 1st amendment would apply here. The only one which gives a right not to speak is the 5th, and Apple is not implicated criminally in this case.

                        1. 7
                          1. uncontroversial;
                          2. uncontroversial;
                          3. uncontroversial;
                          4. absolutely not;
                          5. uncontroversial;
                          6. uncontroversial;
                          7. uncontroversial;
                          8. uncontroversial;
                          9. uncontroversial;
                          10. no; I’d prefer CREATE DOMAIN or check constraints for simple types, but will use a table if I don’t have easy access to radical new 1980’s style features in my database. Allowing unconstrained data leads to problems not even very far down the road.

                          So that’s two that I strongly disagree with, and eight that I think are perfectly sensible.

                          ETA: I have a sort of idiosyncratic approach to designing schema, however, in that I tend to let the data speak first, and worry about join performance or query sanity second. It helps my case that I haven’t worked on a high-volume SQL database in ten years, of course.

                          1. 4

                            I’d prefer CREATE DOMAIN or check constraints for simple types, but will use a table if I don’t have easy access to radical new 1980’s style features in my database. Allowing unconstrained data leads to problems not even very far down the road.

                            My experience mirrors yours. Use types if you can. Zip/Postal code? Make a type. Enumeration? Ditto. As soon as you make it a VARCHAR and have people enter it, you will get hard to detect errors, especially if someone decides it’s a good idea to update the production database directly.

                            Types in databases actually made me appreciate strong typing in programming languages more than I did before I worked with them.

                            1. 3

                              7 I disagree with…timestamp with time zone helps fix a bunch of weird dumb errors that can creep in. Of course, the machine and database should be set to UTC time zone anyways, but it helps to do this regardless.

                              1. 2

                                I prefer UTC everywhere, but I sympathize with the sentiment. Some things are much easier with time zones. That said, if you have time zones, I’ve found you get a different set of weird, dumb errors.

                                The key is to not mix them. As soon as you do that, you’re in a world of hurt. And if you don’t store a time zone, make sure you store a UTC value! (Been there, had to recover from that.)

                                1. 1

                                  The sole exception where it should be the first choice to store a time zone is if you are storing user preferences about times in the future - but you should not be using a timestamp for that, because you don’t know how DST rules might change before it comes to pass. So it’s almost a totally unrelated problem.

                                  Edit: I wish to clarify that I agree with what you said and am expanding on it. :)

                              2. 1

                                Why not #4?? I prefer them in all my databases and I have read that using UUIDs can be worse in a lot of ways.

                                1. 2

                                  Integer keys always always always end up imposing an ordering that’s dishonest – in other words, that isn’t a property of the actual data. I don’t like surrogate keys full-stop, of course, but SQL makes using natural keys awfully hard a lot of the time.

                                  1. 2

                                    I think the integer primary key is meant to be a unique item irrespective of what data the row is meant to store, so it’s not for ordering or analysis on what the data means, but for developer convenience. What is the downside to using an integer primary key (monotonically increasing as mentioned) and uniqueness constraints vs not? It seems like it would just be the space for the extra column with a benefit being a (likely) shorter handle to each row.

                                    I am unsure what you mean by “I don’t like surrogate keys full-stop, of course, but SQL makes using natural keys awfully hard a lot of the time.” Would you mind expanding that thought?

                                    1. 7

                                      Another downside to unique integer fields is that they need very careful treatment with sharded databases. There are certainly strategies to make integer sequences work with sharding, but UUIDs are cleaner and easier in many cases.

                                      Notice that this author is advocating adding a unique integer column even when there is already another primary key, and also even in join tables. As you say, it’s for developer convenience, but that’s really not a convenience at all - it’s very dubious that there’s a debugging need to query data in such unnatural ways, and there should absolutely never be a production need. And having them there creates a temptation for someone to use them for something. Clean schemas shouldn’t have such temptations. :)

                                      1. 3

                                        I wish we lived in a world where there was a better language for interacting with relational data than SQL. Yes, yes, D sort of exists, but still.

                                        1. 1

                                          Yeah, it’s the best there is but it does get pretty verbose, and lacks portable ways to express things that would otherwise be doable and useful.

                                          1. 2

                                            The syntax is terrible, but the worst, in my opinion, is that it’s not closed under composition, which makes it a royal PITA to write complex queries in.

                                            1. 1

                                              Oh, huh. That’s a fascinating high-level point that I haven’t heard before.

                                              Do I understand that you mean you can’t combine queries and be guaranteed that the result is valid? I’m having trouble thinking of an example offhand… of course, if you mean that the result may have unacceptable performance, I completely agree. :)

                                        2. 1

                                          Thank you for clarifying! I didn’t think of sharding as a requirement. You’re right that a well-designed resource will not tempt its users into ruin. :-)

                                          Could you point me at any resources for describing the difficulty you describe, or a good resource for how it works cleanly with UUIDs?

                                        3. 2

                                          Problems with monotonically increasing integer keys:

                                          1. they require the database to generate;
                                          2. they’re always used inappropriately as shortcuts in large application development.
                                          1. 1

                                            Thanks for clarifying and pointing these out.

                                            Is number one only an availability thing? It would seem that to save a record in the first place the database would be available, so I’m not sure I understand what you mean.

                                            Number two makes sense, though PEBKAC might apply more than blaming the existence of the key. I will agree with another comment in this thread that a well-designed resource or system should not leave that sort of bad use available.

                                          2. 1

                                            A surrogate key is one which is not derivable from the data being stored; a UUID or auto-incrementing integer, for instance. A natural key is often most readily expressed as several columns, and SQL makes multi-column joins a tremendous pain in the ass. I dislike the former because it implies something about the data that isn’t necessarily true. I dislike the latter because SQL is terrible.

                                            1. 1

                                              A natural key is more brittle in the face of schema changes too. Surrogate keys are more resistant to change.

                                        4. 2

                                          If the primary key is generated on a remote system (say, an event) and pushed to a central location, then monotonically increasing integer keys are a nightmare to work with. You can put an integer on it, but now you have two primary keys.

                                          Basically, if your system is distributed, a central primary key authority becomes a terrible bottleneck or a source of hideous complexity. UUIDs save a lot of effort.

                                      1. 5

                                        This seems portable to emacs-lisp judging from the ClojureScript that is powering the Atom plugin and the .cljc running the site. An existing alternative for Emacs is mastery of paredit and use of aggressive-indent-mode.

                                        I think this is nicer for newbies than getting the three-key chords required for good paredit use ingrained in muscle memory. I think it’s wonderful that the lisp indentation conventions benefit improve developer productivity, not just code readability.

                                        EDIT: Added link to the site’s source.

                                        1. 8

                                          My experience has been that it is usually futile. If you are both equally powerful, organizationally, then you grumble to yourself and continue. It isn’t until someone who is more powerful than the NNPP takes notice—and cares—that change happens, and, generally speaking, the only “change” that I’ve seen that worked was termination.

                                          If it’s a junior developer who’s just starting out, you can sometimes mentor them into a better place; but this is reliance on a more powerful position, as well.

                                          Fundamentally, if someone is relatively experienced and hasn’t picked up good habits or the desire to improve their skills, you certainly aren’t going to revolutionize their self-image or approach. Studies in our industry are incredibly fluffy, relying on toy problems or based on case studies of situations that can never be repeated. Everything is debatable. My best conversations have been with peers who disagree with me on various subjects (I don’t like TDD, but do like testing; I like static typing; I find higher abstractions like monads useful and powerful; I use vim instead of Sublime…), but these peers, generally speaking, don’t write terrible code. Any disagreements are good-natured, and both parties come away from discussions with more knowledge.

                                          1. 5

                                            This means a CEO or founder has tremendous power regarding culture. They are the only person who can:

                                            Fire anyone

                                            Hire anyone

                                            Decide how/why people are rewarded

                                            Decide how/why people are punished

                                            And with those 4 powers, every CEO is in fact a Chief Cultural Officer. The terrifying thing is it’s the CEO’s actual behavior, not their speeches or the list of values they have put up on posters, that defines what the culture is. Without these four powers any employee at the company is along for the ride in a culture driven by someone more powerful than they are. By the time the first handful of employees are hired, the culture already exists whether anyone realizes it or not. The people with the most power to fuck up the culture are simply the ones with the most power.

                                            http://scottberkun.com/2014/critique-dont-fuck-up-culture/

                                            This is my observation: raw organizational power is how you change the organization, of which code is only one facet of. If the wielder of power understands technical skill and encourages it, the org has better technical chops. Otherwise… no. Won’t really happen.

                                            1. 7

                                              This is a good synopsis, and I’d add something else: while bad code sometimes comes from talentless programmers, it just as often comes from good programmers working to deadline, cutting corners, and building up technical debt to hit one more target that the business guys called “urgent”.

                                              Often, the person writing shitty code is giving The Business what it wants: requested features quickly, with no pushback. Of course, giving The Business what it wants is like feeding someone a diet of pure sugar: years later, that person dies a horrible death.

                                              This makes it hard to oppose, attempt to direct, or otherwise modify the behavior of, the person writing the shittiest code. That person’s often already a managerial favorite, code quality be damned. The Business can’t see technical debt. And while there are good things as well as bad ones to the current job-hopping climate, one of the major negatives is that people don’t care about their technical legacies because they’ll either be promoted away from their messes, or in other companies, long before anything could stick to them.

                                              How this tends to play out is that, at some point much later, The Business realizes that its performance is being wrecked by the shitty tech, but this is usually 3-5 years after the bad decisions were already made and the deadline culture is already established. This leads to a rewrite and an old team vs. new team dynamic, but the new team often has to suffer idiotic deadlines as well as the old, and is getting no support from the old team due to a mutual animosity, so a lot of buried business logic is lost forever and the result is that the new system is even less useful, so the rewrite fails. This is career-negative for the people on the “old team” and the “new team” when it happens, but the people responsible for the old team’s underperformance– the long-since-promoted-away programmers who let the deadline culture in– are unaffected.

                                              1. 2

                                                As a junior programmer who is constantly insecure re: the quality of my work, I really hope someone would do this rather than wait for it to bubble up, and would welcome it from another junior as well.

                                                1. 5

                                                  It is not a good idea to work on the assumption that coworkers are going to attempt to mentor you. There are a few reasons for this: there is always too much work, deadlines are too tight, and there are HR risks involved.

                                                  The best thing to do, in my opinion, is to independently seek to improve the quality of your work. Continue to learn more languages, do exercises you find online, read papers and books. Read code. Consider subscribing to some mailing lists for projects you find interesting, where pull requests and feature requests are discussed; even if you don’t participate, some of the discussion will be edifying. If you do find a coworker approachable and skilled, ask questions (in an asynchronous way, not interrupting their work). Always make sure to try things before asking; nothing is more frustrating than answering the same question a dozen times for the same person. Focus on developing your skills, not getting over the next hurdle.

                                                  1. 1

                                                    I’d suggest working on open source projects and letting that feedback help improve your code…. there’s nothing more aggravating when two seniors disagree on code direction, specially when both don’t appear to have looked outside the company in years (hasn’t happened in a few years to me, but it was horrid when it did happen).

                                                1. 9

                                                  He discusses the problems with the Bay Area government through the homelessness and the inability of the local government to capture any of the boom. It’s not restricted to Northern California: the same problem exists on much the same level in Seattle. Despite Amazon and Microsoft booming over the course of multiple decades (Microsoft has been here for almost forty years), there are more homeless people in Seattle in any but three other American cities [0]. When fulfilling their most basic requirement to the city, Amazon received lots of good press for building affordable housing, which it dramatically overstated [1].

                                                  On a more anecdotal note, the second tier of private transportation has boomed while the public transportation construction has been mired in delay and over-budget spending. Public infrastructure is not only a problem in cities with large wealthy companies, but it is more notable for that reason. If the companies were unable to create their own reality-distortion field around their workers/offices and instead relied on the same services as the rest of the city as (again this is anecdotal and/or a sample size of one) New York City financial/government/technology firms have, real improvements could be made.

                                                  Still amazed at how perfectly “trickle-down economics” covers this.

                                                  [0]: http://www.npr.org/2015/04/07/398075834/amid-seattles-affluence-homelessness-also-flourishes The three cities are New York (population 8.5 million), Los Angeles (population 4 million), and Las Vegas (population 600k). Seattle has a population of ~670k. If the only comparable city on this list is the one historically known for its corruption, it’s at the very least highly unflattering.

                                                  [1]: http://crosscut.com/2015/07/amazon-exaggerates-its-support-for-affordable-housing/

                                                  Edit: I changed formatting for the footnotes. “[0]” turned into a link without escape characters; didn’t realize that would happen.

                                                  1. 4

                                                    It is pretty sick to think what could have been done if Apple and Google and Facebook pooled their private bus money and rained it down on Caltrain. To say nothing of the absolutely pathetic bus service in Santa Clara.

                                                    1. 4

                                                      Probably nothing. I don’t know local budget issues, but I would expect that if the tech giants donate a billion to public transportation, the budgeting government would immediately shift up to a billion from the public transportation funding to any other place they’d prefer to spend money. This is the open secret of how large organizations like charities and universities spend targeted donations. Money will technically go where the donor chose, but until a donation is larger than their planned buget the organization can use money’s fungibility to spend “targeted” donations where they choose.

                                                      1. 8

                                                        Some of the change would’ve been easier to make some decades ago, when the Valley pursued car-oriented urban planning, which was at the time seen as advanced and future-looking. Silicon Valley opted out of BART, and instead poured the money that would’ve been spent on BART into more freeways. That’s why south bay is one of the few places in the U.S. that has controlled-access county expressways, in addition to the federal and state expressways (I-280, US-101, CA-85, etc. are supplemented by San Tomas Expressway, Central Expressway, etc.).

                                                        I don’t know much about the tech industry’s role in that, though. Were they lobbying again BART and for these freeways? I wouldn’t be surprised if they were, but would be interested in reading some history, if anyone’s written it up.

                                                        1. 2

                                                          Sad agree. Maybe they should instead take that money and pay employees extra to take the bus, drive ridership through the roof, and force the issue.

                                                          1. 2

                                                            Or move their campuses closer to where their employees want to live?

                                                            1. 6

                                                              The Bay Area is peculiarly anti-development. Probably the most NIMBY part of the country. “I got mine, now you go someplace else.” Old money vs new money is nothing new, but it’s strange when the “old” money is only a few years old.

                                                            2. 1

                                                              The extant public buses simply do not travel the routes the tech employees would need. Otherwise, this would certainly be worth trying.

                                                          2. 2

                                                            I’ve spent considerable time wondering whether BART would accept those donations, and whether they’d use it to add the routes the tech companies need if they did. I mean, even if implemented that would certainly still create a lot of public resentment, but it’d be the socially responsible thing.

                                                        1. 1

                                                          I was hoping more examples of applications that are poor fits for Docker. The article uses Postfix to illustrate its points about Docker’s pain points, but I cannot think of a web application that would want to fork itself and change its permissions. Maybe systems programs just aren’t Docker’s target?

                                                          1. 2

                                                            Can one not fork in Docker?

                                                            1. 2

                                                              Of course you can. You can easily get a shell running in a container with an already-running application, even. (It’s a good thing, too, or debugging would be an unbearable pain in the ass.) In fact, somebody’s done Postfix. (I can’t vouch for that image, but it’s a safe assumption it at least runs.) This article is very short on details and many of its complaints feel false to me without a lot of clarification.

                                                          1. 4

                                                            This is probably going to come off as negative, but while I like the typing Crystal feels like a 100% copy of Ruby (warts and all) without the ecosystem.

                                                            Though maybe gems will work naturally.

                                                            1. 7

                                                              Typing and native binaries seem like big gains.

                                                              1. 1

                                                                Yeah, but like that’s true of any language?

                                                                1. 3

                                                                  Not trying to dispute that, only trying to say that it could offer gains greater than a copy of Ruby could. :-)

                                                                  1. 4

                                                                    Yeah, you’re right about that.

                                                                    My complaints are really that I’m tired of seeing Ruby’s warts continued in new languages.

                                                                    1. 3

                                                                      What Ruby warts do you see being continued in Crystal?

                                                              2. 7

                                                                Your complaint is valid, but if your new “copy of Ruby” changes too much, then it’s no longer a copy and no one who likes Ruby will want to use it. That puts languages like Crystal in between a rock and a hard place. Do you want to be like Ruby or “the next Ruby”? Or do you want to forge your own path? Neither path is an easy road in my opinion. And, finally, it’s a very fine line to walk between the two.

                                                                1. 4

                                                                  Hey, yeah I’ve made the same argument about RubyMotion (which has minor differences).

                                                                  I believe that honestly if Crystal gets the ecosystem it should start ripping out the warts. It’ll be a long journey, it’ll have a lot of discomfort, but we’ve learned a lot since ‘91.

                                                                  1. 4

                                                                    Agreed, I have the exact opposite opinion: too many languages are “inspired by X” but with some meaningless change (functions are defined with func instead of def for example). It is added cognitive load for no real gain.

                                                                1. 2

                                                                  I finished Player Piano. Found I still think the last third drags. Found I still agree with the thesis: we’re not built to handle automation.

                                                                  I’m reading Mason and Dixon now for a change of pace.

                                                                  1. 3

                                                                    Rereading Player Piano after being reminded of it in recent conversations about automation and its effects.

                                                                    1. 3

                                                                      This is really cool.

                                                                      How labor intensive is it to write a “superbook?” It looks as though each page is its own frame. Obviously the CSS could be reused for each of the text pages, but is each animation its own project? Can you reuse large pieces across the book?

                                                                      1. 3

                                                                        The diff.

                                                                        Notwithstanding the foregoing, if Facebook or any of its subsidiaries or corporate affiliates files a lawsuit alleging patent infringement against you in the first instance, and you respond by filing a patent infringement counterclaim in that lawsuit against that party that is unrelated to the Software, the license granted hereunder will not terminate under section (i) of this paragraph due to such counterclaim.

                                                                        IANAL. Is this good enough for me to be able to stop thinking about the Patent Grant included with React?

                                                                        1. 1

                                                                          Did a lawyer tell you to be worried in the first place?

                                                                          1. 4

                                                                            Never said I was worried, just that I don’t want to think about it anymore. :-)

                                                                            1. 2

                                                                              Yes, DannyB, open source lawyer at Google said to be worried.

                                                                              1. 2
                                                                            2. 1

                                                                              So this makes the patent cold war even colder. Some companies might start using React now, but anyone using React will think N+1 times before filling a lawsuit against Facebook.

                                                                              I think companies like Google will still not use React because they might want to fill a lawsuit themselves, and it appears only counterclaims are exempt from termination.

                                                                              1. 1

                                                                                For $FUN, I’m deploying! Should have a fun prototype to show off of a news-aggregator shortly, but deploying Datomic is really, really hard. I went through the steps to get a transactor/storage running on ec2/ddb respectively, but getting access to the peer library when deploying my app is tying me up right now. If anyone has any tips, they’d be welcome. :-)

                                                                                1. 3

                                                                                  For $FUN, I’m writing up a test suite for my Clojure library that should help me find where it breaks from being identical to the Python version.

                                                                                  For $SCHOOL, I’m starting to hold office hours as part of being a “course producer” (TA with a cooler title) for the operating systems course. I have a ton of reading, but thankfully all of that reading is really interesting.

                                                                                  1. 3

                                                                                    I’m working on a few things.

                                                                                    $WORK is over for me. $SCHOOL is starting, so I’m figuring out my final schedule with labs and office hours and other things. No coursework besides reading yet.

                                                                                    I shipped Clojure code, though I’m sure it’s bad. I ported a Python and Scala library I’d seen before to Clojure. It’s my first shot at writing even really trivial Clojure code, so any code reviews or feedback would be really appreciated.

                                                                                    https://github.com/tropicalmug/teaser-clj

                                                                                    1. 5

                                                                                      Congratulations on shipping!

                                                                                      Since you asked for it, a few thoughts on the code:

                                                                                      • Silently suppressing all the IllegalArgumentExceptions is not a good thing. The best would be to reshuffle things so you never got them in the first place, but if nothing else you should surface something from the function.

                                                                                      • I’d break it up into several namespaces/files. You de facto did this with some of your comments (e.g. ; Stopwords)—I’d go all the way.

                                                                                      • Speaking of comments, I’d follow these guidelines on how many semicolons to use.

                                                                                      • Try to avoid declare as much as possible.

                                                                                      • Some of your function naming could be rethought (e.g. filter-stopwords-wordmap).

                                                                                      • The dbs function is scary. Think long and hard before using atoms.

                                                                                      • Make a file called config.edn that looks like this, and then use clojure.edn to load it:

                                                                                      {:stopwords #{"-"
                                                                                                    " "
                                                                                                    ...}}
                                                                                      

                                                                                      I’m always wary of code review since it makes me look like an irritable grouch…again, congratulations on shipping and on an excellent start to Clojure!

                                                                                      1. 3

                                                                                        No need to feel like a grouch, I wanted feedback! It’s all true and actionable, good traits of a good review. Thank you for helping out.

                                                                                    1. 5

                                                                                      I made progress on everything!

                                                                                      I’ve finished chapter four in Clojure Programming. I also have started to develop my usual “Hello world” app with compojure.

                                                                                      I’ve also made progress at $WORK. They decided my design work was out of scope (sadface), but in terms of practical progress, I’ve made it through a couple levels of abstraction.

                                                                                      1. 3

                                                                                        Made real progress at $WORK. Many layers of abstraction for my service, but I think I can trace something through all of them over this week.

                                                                                        On my own stuff, I’ve made zero progress over the past week. I’m at the same point in Clojure Programming and on web dev with Clojure. I’m a bit disappointed in myself, but hopefully this coming week will prove more productive.

                                                                                        1. 5

                                                                                          For fun, I’m 180 pages into Clojure Programming, halfway through the chapter on concurrency and parallelism. I’ve also started looking into porting my version of a “Hello world!” web-app to Clojure.

                                                                                          For $WORK, I’m frantically trying to get a handle on what I’m doing and make real progress. There’s a lot to learn when working with an enterprise codebase.

                                                                                          1. 4

                                                                                            I finished the Clojure Koans and I’m almost done with the third chapter of Clojure Programming.

                                                                                            For $WORK, I’m finally past design and into implementation of my project.