Live data from Hacker News

A non-programmer’s solution to “Fizz Buzz”

nixonmcinnes.co.uk

51–58 of 58 posts

Re: A non-programmer’s solution to “Fizz Buzz”

#53
post #18

Earlier quoted context omitted.

This stuff is getting solved, for the particular example you can use n-th child in modern browsers[0]. [0] http://www.quirksmode.org/css/nthchild.html

Well, that sort of solves some of the problem, but in other ways it makes it worse. The fundamental problem is that mentally applying CSS rules is difficult, particularly when the DOM structure being styled is complex and is determined by an imperative program. Imperatively generating and dealing with a DOM structure using simple selector queries is relatively easy to do, as is modeling what is happening in your head…

the problem here is that CSS is _not_ a good abstraction for laying out application. Its good for styling (and i would argue, styling static content too). But css isn't very modular, and has very very high coupling with the structure of the DOM - something that isn't easily discernable at the time of modifying the css.

Like you, i can't think of a good solution - a lot of UI frameworks either just has really heavy restrictions, or it doesn't actually provide enough abstraction to actually help with the problem. Sigh...

Re: A non-programmer’s solution to “Fizz Buzz”

#54

Earlier quoted context omitted.

And this is the problem I have with CSS selectors. What you just described is ridiculously fragile and will send shudders down the spine of any developer experienced with wrangling projects that have tangles of inappropriate coupling, but in many cases, there simply isn't a more elegant solution. Your options are: 1. Implement a sane (albeit less powerful) view hierarchy system, foregoing basically all of the CSS sel…

3. Write your site in the form of a program that generates the site itself (or include javascript that generates the relevent pieces.)

That's the same as 1.

Re: A non-programmer’s solution to “Fizz Buzz”

#56
Hi All.

I'm Clive, Wintron's non-programmer colleague and the guy who tried FizzBuzz on the piece of paper.

I feel fascinated by the fact people are examining the approach I took, and a little flattered by the nice remarks people have made about the fact I should maybe move on to learn a programming language. Maybe I will.

If I'm honest, I don't understand all the observations people have made, but there's one I do understand, and wanted to shed some light on: the point about iteration.

The exercise reminded me of some kind of in-the-round drinking game, where everyone is determining the responses one by one, as an iteration of the last number. Consequently, this shaped the way I approached the problem.

In retrospect, I completely see that I would have been better off simply counting from 1 to 100, then translating each of the 100 numbers into how it should be displayed (Fizz, Buzz, FizzBuzz or as a number). But recreating the drinking game in my head, it made perfect sense to me that each number is determined by being an iteration of the last one. That feels to me like I count in real life.

Thanks again for taking an interest, and yes, maybe I will ask Wintron/Steve to teach me some programming!

Clive

Post reply on HN