Problem-specifications: Make up a new exercise equivalent to old hello-world

Created on 12 Feb 2017  路  13Comments  路  Source: exercism/problem-specifications

For those languages where the old hello world wasn't too complex, it would be nice to have an additional exercise that can fill the space between the new hello-world and other simple exercises.

There are a couple things that this exercise can help people discover if they get feedback on it, though one of them depends on the language.

falsiness (maybe JavaScript specific)

We see a lot of if (input == "") which means that we can suggest that people look into the concept of falsiness to find simplifications.

overly complex conditionals

There are at least six or seven ways that people make their conditionals more complicated than necessary, or make them contain a lot of duplication.

The second point leads nicely up to the Leap problem.

bonus: guard clauses

Sometimes they'll also do if (x) { return y } else { return z }, which means that we can talk about minimizing indentation and leaving off the else if the if is returning.

Anyway: I think that it would be useful to have a new exercise that implements a similar thing as the old hello world:

  • optional and default input value
  • combine that value with some extra string template-y stuff, conditionally
new exercise idea

Most helpful comment

@rpottsoh pointed out that we have an open issue #290 that is no longer relevant to the old hello world. It may be relevant here.

The proposal for business-buzzwords sounds like a "Mad Libs" type engine.

I think that it _could_ be a Mad Libs type engine, but I'd like to have it be a very straight-forward replacement to Hello World.

If we want to use buzzwords as a mad libs exercise, then we should come up with something else for this one.

How about:

Title: Two Fer
Slug: two-fer

Template: "One for X, one for me."
Where X is either a name, or it defaults to "you".

All 13 comments

To rename the former hello-world into greeter and keep everything as before was already discussed in the original proposal. I'd vote for keeping that old hello-world as well but don't care for naming though ;)


Re falsiness:

Falsiness is not specific to JS, it's a concept known to ruby and elixir as well, maybe the interpretation of some values might differ between languages. For ruby and elixir "" is a truthy value though. Also even in JS one might to consider returning "Hello, World!" while raising on anything thats not "real" string, so I like the explicit equality check here, but I'm not an JS expert (or would even us it voluntarily), so I don't know (or care for) idioms of the language.


re overly complex conditionals

Wait? Six ways? which ones?


re guard clauses/statements

I'm not sure if this is necessary. For go it seems to be idiomatic to omit that else branch in these cases, while in ruby one does keep it to avoid an explicit return while in haskell you can't even omit that else branch!


Besides of these 3 items, I'd go for another one that could be valuable for this exercise, the default value for a missing argument of a function if it is an available feature of a language.

It should be a track driven idiom through the tracks though, as I've heard idioms are different across languages.

e.g.:

  • For elixir it is idiomatic to use the exact value that you want to use as a default value anyway
  • For python I was told it were idiomatic to set the default to Nil (or whatever they call it again), and have an extra if that adjusts the real to use value to the wanted default value.

It should be a track driven idiom through the tracks though

Yes, absolutely. My main point is that I think that this exercise fills a useful niche. The lessons it makes possible will be different in the various tracks, I was mainly pointing out that there _are_ lessons.

Agreed. Dealing with optional/null values is an important skill and perfectly suited to its own exercise I think.

Ok, so how about the following?

slug: business-buzzwords
name: Business Buzzwords

Template: _People, in the next year we need to X. It is what it is._

Some examples of X:

  • enhance dynamic web-readiness
  • cultivate leading-edge systems
  • repurpose e-business markets

We can have any default that we care to, of course.

For inspiration, google "catch phrase generator" or "buzzword generator".

I like it! Tongue-in cheek and all.

Wait, is this entire issue about "reintermediate bleeding-edge Programs"? (From the buzzword generator, already handy).

The proposal for business-buzzwords sounds like a "Mad Libs" type engine.

@rpottsoh pointed out that we have an open issue #290 that is no longer relevant to the old hello world. It may be relevant here.

The proposal for business-buzzwords sounds like a "Mad Libs" type engine.

I think that it _could_ be a Mad Libs type engine, but I'd like to have it be a very straight-forward replacement to Hello World.

If we want to use buzzwords as a mad libs exercise, then we should come up with something else for this one.

How about:

Title: Two Fer
Slug: two-fer

Template: "One for X, one for me."
Where X is either a name, or it defaults to "you".

Sorry I have to ask, but what's a "mad libs" exercise?

I like the two-fer idea, straight forward, and flexible simplicity.

@NobbZ.

Pick a noun, another noun, a color, a verb, a living thing.

But pick those without looking at the story that follows...

One day there was a ___ that was ___. It was a ___ and ___ ___.

The result can be pretty hilarious/silly/fun. Often a party game with quite a few people... but can be played with kids on long road trips.

@NobbZ here is a quick wikipedia write up on mad labs, a follow on to what @kotp stated.

The discussion seems to have wound down on this one. It sounds like two-fer is the better suggestion as a replacement for hello-world.

I've extracted the TODOs from this into new issues.

Was this page helpful?
0 / 5 - 0 ratings