1
\$\begingroup\$

It's a common mantra among web developers that "Avoid JS wherever possible" and "don't use tables for layout". Yet every now and then I come across a layout that I want to implement, but cannot do so without violating one or the other rule. Now, mind you, there are legitimate cases for using Javascript and/or tables. I'm talking about the ones that really feel "wrong", like using a giant table for the basic page layout or Javascript for positioning of static elements.

Would it be appropriate to post such situations that I've come across as questions here? (After I've banged my head against a wall for at least 12 hours)

Here's an example:

I have two pictures that I do not know the size of beforehand. I need to display them side-by-side in the middle of the page (horizontally). Vertically they have to be both top-aligned to the page. If the browser window is reduced so much that the two pictures cannot be displayed entirely, scrollbars should appear. The pictures should still stay side-by-side. This should work on IE7+ as well as the latest versions of FF/Chrome/Opera/Safari.

| |
\$\endgroup\$
  • 3
    \$\begingroup\$ Sounds like a better fit for stackoverflow.com \$\endgroup\$ – gnibbler Jun 4 '12 at 10:22
  • \$\begingroup\$ @gnibbler - Sort of, but it's not like I can't solve the problem on my own by lifting one of the constraints (which is always an option in real life). The question is more of the nature: "OK, I know how to solve this, but is there a better solution?" And the better solution would almost always require some ingenious trickery. I see SO as a site for more mundane questions, with less challenge. This is the place where people come when they want to exercise their gray cells. \$\endgroup\$ – Vilx- Jun 4 '12 at 10:44
4
\$\begingroup\$

The things that makes a problem suitable for CodeGolf.SE are

  1. An objective winning criteria
  2. The possibility of solving it more than one way which can then be distinguished by the winning criteria (this is why language agnosticism are the default on the site: different languages sometimes offer differ ways attacking problems)
  3. It should be sufficiently non-trivial to be interesting
  4. It should be simply enough the people will be willing to work it in their space time for no more reward than some rep on the site and the satisfaction of a job well done (or ill-done very well in the case of most solutions)

In the case you propose I would really worry about the first requirement.

| |
\$\endgroup\$
  • 1
    \$\begingroup\$ Possibly you could have some metric based on the number of unnecessary DOM elements included in the solution, the number of classes/ids used and/or total lines of CSS. Smallest score by that metric wins. \$\endgroup\$ – Gareth Jun 4 '12 at 17:32
  • \$\begingroup\$ @Gareth That may be the basis of a whole class of "smallest number of <elements>" challenges. Now you just need a name for it...[DOM-golf]? [element-golf]? \$\endgroup\$ – dmckee --- ex-moderator kitten Jun 4 '12 at 17:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .