17
\$\begingroup\$

I'm just curious about whether any of you have a real-world use for your golfing skills. I'd also be interested to hear if you know of golf-related jobs even if you aren't involved in them, or if you have areas of your life where golfing has been required for practical purposes.

\$\endgroup\$
  • 14
    \$\begingroup\$ Does this mean you don't believe the story of carving some code into the limited surface area of a canoe? \$\endgroup\$ – Geobits May 28 '15 at 1:54
  • 3
    \$\begingroup\$ I don't think there is. But if there isn't, I'm very curious about how does Dyalog, Jsoftware, Kx systems, etc, earns money. (They might be not designed for golfing, but have almost every disadvantage of golfed code.) \$\endgroup\$ – jimmy23013 May 29 '15 at 11:32
  • \$\begingroup\$ @user23013: I've wondered that myself. Dyalog seems to maintain that you can use APL for all sorts of crap like web development, but why would you? \$\endgroup\$ – Alex A. May 29 '15 at 16:04
  • 1
    \$\begingroup\$ Of Course!! javascript code obfuscating is atleast to say, a code-golfing with non-esoteric languages, one of the well known effective methods to circumvent source-hacking, not just for a single language but whoever cant prevent his source from being public, golfing/jamming is a brilliant way to make the debugging process last even more than redacting a new analogue from the beginning. \$\endgroup\$ – Abr001am May 12 '16 at 7:12
  • 3
    \$\begingroup\$ Not really enough for an answer, but I for a while made programs for people's TI-83/TI-84s. Most insisted that they be small so they could still have room for whatever else they wanted on there. Nothing really was restricting, except for this one time where I had only around 50 bytes to work with. I think it was a right-triangle side-completing program. \$\endgroup\$ – Conor O'Brien Oct 30 '16 at 3:04
20
\$\begingroup\$

I don't.

Quite the opposite actually. The code I write for work has to be readable, understandable, and usable by folks with a very limited programming background. I have to err on the side of extreme verbosity in my code, otherwise I'd have to spend a lot of extra time explaining it to others. (As an aside, this is probably why I'm not so good at golfing.)

Much like the mentality of code golf challenges on PPCG, efficiency must often be sacrificed. However, in my case it's sacrificed for the sake of readability, not for saving a byte of length. Unlike PPCG code, though occasionally inefficient, my code must finish executing before the eventual heat death of the universe.

Note that this is not my preferred programming style, but it's what's expected of me in my current position.

I think you'll find that golfed code is not well received by folks in a professional environment who have to deal with it, at least in my experience.

I'd also be interested to hear if you know of any golf-related jobs...

Ever heard of Tiger Woods? He golfs for a living, and I hear he's pretty good at it. Haven't seen him around PPCG in a while though.

\$\endgroup\$
  • 1
    \$\begingroup\$ Don't really understand the downvote, but it's meta so whatevs. \$\endgroup\$ – Alex A. May 28 '15 at 15:21
  • 5
    \$\begingroup\$ Oh, that's mine. I assumed that negative ("I don't") answers could be posted by way too many people to be useful. Kinda like answering "None of my posts have contributed" on this question. \$\endgroup\$ – Geobits May 28 '15 at 15:35
  • 1
    \$\begingroup\$ @Geobits: Oh you. ;) Yeah, I see what you mean and I agree, but I figured at least one would be useful here so that people who generally agree with my sentiments could upvote or comment. \$\endgroup\$ – Alex A. May 28 '15 at 15:58
  • \$\begingroup\$ My language of choice is PowerShell, which is pretty far from golfing. With code here, I can do stuff like |%{?_ which, while perfectly valid PowerShell, is not the sort of thing that's easily readable for code-reuse elsewhere in my organization. It's refreshing to twist the same language in a different direction. \$\endgroup\$ – AdmBorkBork Oct 2 '15 at 15:31
  • \$\begingroup\$ It is sacrificed too error check, and without that the golfing programs can not be ok out of here \$\endgroup\$ – RosLuP Apr 17 '17 at 17:57
20
\$\begingroup\$

Yes, I do!

I work for Dyalog. Part of my work is "spreading the word", and that officially includes code-golfs.

In fact, our APL team is looking to hire, and we are more interested in golfers than regular programmers, as the former are more likely to have the right mindset. At least one active PPCG user will be an intern this summer... [edit: was true of summer 2017, and is true of summer 2018 too]

\$\endgroup\$
  • \$\begingroup\$ Why would anybody use APL in practice though? What's the real advantage of using it over all the other stuff like R or python+numpy? \$\endgroup\$ – mroman Nov 23 '18 at 12:49
  • \$\begingroup\$ @mroman APL can be very fast — sometimes faster than carefully hand-written C/C++.. It can also cut down development time and number of programmers needed, and lessens the risk of bugs by simply doing more with less code. Try it and see that it can be fun rather than tedious! \$\endgroup\$ – Adám Nov 23 '18 at 13:02
  • \$\begingroup\$ Since I'm the lunatic behind The Burlesque Programming Language I found that short-code doesn't really translate to performance as high-level concepts are usually also very costly. You can express problems for example in terms of set operations on subsets, rotations, permutations and you can do this with very few instructions but computing all subsets/permutations/rotations etc. is just much, much slower than a more direct approach using low-level/more verbose concepts. \$\endgroup\$ – mroman Nov 23 '18 at 13:07
  • \$\begingroup\$ For example the challenge "Most Common Multiple". The high-level way is to actually create a multiplication table and then pick the most common element but there's some significant overhead in this compared to just nesting two for-loops for example. \$\endgroup\$ – mroman Nov 23 '18 at 13:08
  • \$\begingroup\$ @mroman Lets continue this conversation in chat… \$\endgroup\$ – Adám Nov 23 '18 at 13:09
18
\$\begingroup\$

Sort of

Some low cost micros have very resource constrained. eg

PIC10F200
Program Memory (KB) 0.375
RAM Bytes 16

While I'm not actually using any quite that small - even larger chips can run out of space quickly when you don't have space for libraries to lean on.

There's also a bit of golfing used for protocols over the mobile networks (M2M)

\$\endgroup\$
  • 14
    \$\begingroup\$ Wait, sixteen bytes of RAM? \$\endgroup\$ – lirtosiast Jun 8 '15 at 16:40
  • 2
    \$\begingroup\$ what do you do on such micrichip? \$\endgroup\$ – Optimizer May 5 '16 at 20:03
  • 1
    \$\begingroup\$ @lirtosiast Yes. PICs are that bad. \$\endgroup\$ – lol Mar 13 '17 at 17:13
  • \$\begingroup\$ @lirtosiast: I've done microcontroller programming before too. The smaller the RAM, the cheaper the microcontroller. I tended to use microcontrollers with ~100 bytes of RAM, but it's certainly believable that someone would use a smaller one if that's all they needed. \$\endgroup\$ – user62131 Mar 15 '17 at 15:50
3
\$\begingroup\$

Today I tasked my (physics) students with something along the lines of:

  1. Write a function that does X.
  2. Use your function from Task 1 to do X.

Now, I wanted to provide students with some solution to Task 1, so that if they failed to do it, they could do Task 2 nonetheless. Obviously, I also did not just want to give them any plain hints on how to do Task 1. Giving them anything compiled would risk portability issues or my students not knowing how to use it.

Fortunately, the vast majority of golfing tricks also obfuscate your code, so I found it easy to give my students something which would take longer to reverse-engineer into some human-readable solution than solving the exercise as intended.

\$\endgroup\$
  • \$\begingroup\$ Interesting approach. I'd be interested to hear whether this encourages any of your students to golf their own solutions... \$\endgroup\$ – trichoplax Oct 29 '18 at 20:34

You must log in to answer this question.

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