Live data from Hacker News

Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

news.ycombinator.com

161–170 of 309 posts

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#161

It's certainly not required. I work with a guy whose degree isn't in CS, and he's a fine coder. He doesn't know the theory, but he's paid enough attention over the years that he knows what works, what the pro/cons of the various data structures are — he understands the code that well enough to understand why . (And practically, that's probably more beneficial.) The CS backing can definitely help, though. We've had pl…

As another example I've found of where the theory is helpful: I have often seen two dimensional data put into a relational database, where the person wants to query over a range of values on both dimensions. (I.e., they want to find everything inside of a rectangle, were you to graph the points.) Broadly, I've found these fall into two categories:

1. Lat/lng positions (find all rows where lat between [lat1, lat2] and lng between [lng1, lng2]

2. start time/end time pairs (find all rows where the event is in or overlaps this range)

Then those two dimensions/attributes are put into what is often a B+ Tree or similar index. B+ Tree indexes can really only efficiently query on one range, and only if every preceding attribute in the tuple that the index is built from is specified exactly. The first example w/ lat lngs is particularly bad.

But a lot of developers working w/ databases have no idea what a B+ Tree, or even any tree really means. They get that it's a tree, and that it's ordered. But there's a gap between that and somehow being able to think it through and arrive at the fact that the database must either:

1. walk a lot of rows that aren't going to match (they typically do this)

2. or do a hell of a lot of range scans (they typically do not do this, and it's not really always possible)

Often I find that they think it is /= with each attribute individually, when it is really more like the tuple being indexed as a whole has a first names start with "Th" in a index ordered first by last name usually clears it up somewhat fast, but it took me a while to find that analogy.

(My CS degree included a course on relational databases. We covered everything from theory, such as relational algebra — operations on sets of tuples — to concrete implementations such as PostgreSQL and how to efficiently store indexes/data on disk. The professor I had was absolutely amazing, though I did not really realize this at the time.)

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#162
post #58

Earlier quoted context omitted.

Can you solve these problems in your language of choice then? How can you write business logic at work without loops?

I tried looking up various solutions in languages which I knew a lot better, so, and example of one of these would be Go. The logic was there, but I still couldn't understand most of what was going on, unfortunately. Through trial and error, I eventually managed to get something working. >How can you write business logic at work without loops? It's not that I don't use them, it's that I have a hard time figuring out…

Have you tried writing it out on paper as a flowchart? Sounds old school, but can help with visualising what's happening.

Loops become super simple when you see them as series of steps with a yes/no question of whether to stop or go through your steps again.

Draw up some boxes for every variable you think you're going to need, give them labels and add the labels to the flowchart.

This then allows you to run through the flowchart step by step changing the values in each box as you go.

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#164

Earlier quoted context omitted.

Since we're sharing anecdata, I'm a professional developer and still use recursion, building/traversing various types of tree data structures, and a few other CS degree requirements. That said, for algorithms (e.g. sorts, etc), understanding what the options are and trade-offs is certainly more useful than knowing how to implement them, since there's a good chance someone has implemented it already in your language o…

What percentage of developers do you think are solving “hard problems” compared to ones that are just doing CRUD apps or yet another SAAS app?

Sometimes boring CRUD apps turn into interesting CS problems due to the data model and ways that the customers expect to visualize the data, while keeping the application responsive.

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#166
You may find this thread from 5 years ago[1] meaningful.

As the article emphasizes: The labels themselves aren’t as important as the degree of awareness and understanding that each new “level” brings.

[1] https://news.ycombinator.com/item?id=5936652

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#167

Think of it this way: application development, software engineering, and computer science (and data science and ... etc) sometimes use the same tools but are all different disciplines. Universities traditionally focused on Computer Science and their graduates would often need a lot of grooming before they could really be independently and reliably productive in the commercial words of application development or softw…

I agree with you to some extent, but I do think sometimes this point of view is taken too far. Some basis in theory is useful, not so much because you'll directly apply something you learned in a CS class, but because it helps you learn how to think about difficult problems. Most real world work is indeed just putting pieces together to get the result you need, but there are occasionally things that really are difficult, especially to do efficiently. I think it could legitimately be a concern if an experienced programmer couldn't pass an introductory CS course.

To the OP, presumably your fiancé has study materials as well as just questions—why not audit the course, and learn how to solve the problems you're having difficulty with? (Then write a Tell HN and update us on whether you feel you learned anything useful!)

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#168
post #31

Thank you to everyone who has replied to my rant. I felt of low value for not being able to provide immediate help for most of the problems that she's being taught to work on. Some of the examples (since some of you were asking for them): https://github.com/cs50/docs/blob/master/_pages/2018/x/psets... https://github.com/cs50/docs/blob/master/_pages/2018/x/psets... I realise that I may have written my original post a…

These problems remind me of the ones on checkio.org. The difference being over there you get the benefit of using python--not that I already knew python but it's rather intuitive, plus you can run a million things through an interpreter to quickly understand how it works. These CS50 problems require C, which most mortals would have a much harder time working with. In either case you constantly consult the language re…

The solution is C is essentially same as the one you outlined in Python.

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#169

Earlier quoted context omitted.

seconding this, creating value is orthogonal to knowing CS. see the creator of homebrew, Max Howell infamously failing to invert a binary tree in an interview: https://mobile.twitter.com/mxcl/status/608682016205344768?la...

I have yet to see a definition of what “invert a binary tree” even means.

It's when you swap the left and right branches of every node, e.g.:

    def invert(node):
        if node is not None:
            left = invert(node.left)
            right = invert(node.right)
            node.left = right
            node.right = left
        return node

Re: Ask HN: I've been a programmer for 6 years, and I can't solve basic CS problems

#170
post #31

Thank you to everyone who has replied to my rant. I felt of low value for not being able to provide immediate help for most of the problems that she's being taught to work on. Some of the examples (since some of you were asking for them): https://github.com/cs50/docs/blob/master/_pages/2018/x/psets... https://github.com/cs50/docs/blob/master/_pages/2018/x/psets... I realise that I may have written my original post a…

I would recommend not getting scared looking for the whole bunch of specifications at once, Try to say or write the solution's steps in plain English letting only the most fundamental, as you were explaining the steps to a kid or so, Try to imagine yourself explaining/teaching in simple words is a good way to reason better about the problem. I started learning programming as a hobby/long-term-dream at almost 40 y.o. and it felt so hard to understand the most basic thing in Ruby, like what an Array is, for example, that it gave me literally a big headache and devastating disappointment, even almost cried...now I laugh remembering that :D There is an interesting book I saw then that I recommend, it's name is "the nature of code" , talks about examples of algorithms that appear in Nature and natural phenomena.
Post reply on HN