Category: Humor
This is old news to iOS/macOS/iPadOS/watchOS developers, but it’s worth repeating. That’s all right; I’d rather code in Swift than Objective-C.
Given the fight between Google and Oracle, I’m certain that if Google was the mother in the comic, Java would be Objective-C and Kotlin would be Swift.
Fake ad, but true statement
I had the same reaction
As its own creator says: “In C++ it’s harder to shoot yourself in the foot, but when you do, you blow off your whole leg.”
Thanks to Jennifer Newsome for the find!
It wasn’t the answer the professor was looking for, but I’d have given it at least 6 out of the 10 points the question was worth.
If you search for “5 phases of software development”, you’ll find that there isn’t a complete consensus on what those phases are, or even if it’s just five.
Do you like programming? Do you like Arnold Schwarzenegger movies? If so, ArnoldC is the programming language for you!
ArnoldC will never make the TIOBE list, but then again, no other programming language is based on Arnold Schwarzenegger’s movie one-liners! Better still, there’s an ArnoldC syntax highlighting package for Sublime.
Here’s “Hello, World!” in ArnoldC:
IT'S SHOWTIME TALK TO THE HAND "hello world" YOU HAVE BEEN TERMINATED
It compiles down to Java bytecode. Running the program above is as simple as saving it as hello.arnoldc and entering the following on the command line:
java -jar ArnoldC.jar hello.arnoldc java hello
Find out more about ArnoldC on its GitHub page, and once you’ve been impressed, download it, start coding, and GET TO DA CHOPPA!
Since we’re on the topic of Arnie, enjoy this video:
In my last article, I posted this graphic, which uses emoji to make it easier to understand what the map
, filter
, and reduce
functions do:
Since then, I’ve been asked by a couple of friends if what’s in the graphic is just pseudocode or if it could actually be implemented. I told them it was the latter, and here’s my implementation in Swift:
// Map func cook(_ item: String) -> String { let cookupTable = [ "🐮": "🍔", // Cow face -> burger "🐄": "🍔", // Cow -> burger "🐂": "🍖", // Ox -> meat on bone "🐷": "🍖", // Pig face -> meat on bone "🐽": "🍖", // Pig nose -> meat on bone "🐖": "🍖", // Pig -> meat on bone "🐑": "🍖", // Sheep -> meat on bone "🐐": "🍖", // Goat -> meat on bone "🐔": "🍗", // Chicken -> poultry leg "🦃": "🍗", // Turkey -> poultry leg "🐸": "🍗", // Frog -> poultry leg (no frog leg emoji...yet) "🐟": "🍣", // Fish -> sushi "🐠": "🍣", // Tropical fish -> sushi "🐡": "🍣", // Blowfish -> sushi "🐙": "🍣", // Octopus -> sushi "🍠": "🍟", // (Sweet) potato -> French fries "🌽": "🍿", // Corn -> popcorn "🌾": "🍚", // Rice -> cooked rice "🍓": "🍰", // Strawberry -> shortcake "🍂": "🍵", // Dried leaves -> tea ] if let cookedFood = cookupTable[item] { return cookedFood } else { return "🍽" // Empty plate } } let cookedFood = ( ["🐮", "🍠", "⚽️", "🐔", "🌽"].map { cook($0) } ) // cookedFood == ["🍔", "🍟", "🍽", "🍗", "🍿"] // Filter func isVegetarian(_ item: String) -> Bool { let vegetarianDishes = Set([ "🍟", // French fries "🍿", // Popcorn "🍚", // Cooked rice "🍰", // Shortcake "🍵", // Tea ]) return vegetarianDishes.contains(item) } let meatFree = ["🍔", "🍖", "🍟", "🍽", "🍗", "🍿", "🍰"].filter { isVegetarian($0) } // meatFree == ["🍟", "🍿", "🍰"] // Reduce func eat(_ previous: String, _ current: String) -> String { let qualifyingFood = Set([ "🍔", // Burger "🍖", // Meat on bone "🍗", // Poultry leg "🍣", // Sushi "🍟", // French fries "🍿", // Popcorn "🍚", // Cooked rice "🍰", // Shortcake ]) if (previous == "" || previous == "💩") && qualifyingFood.contains(current) { return "💩" // Poop } else { return "" } } let aftermath = ["🍔", "🍟", "🍗", "🍿"].reduce("", combine: eat) // aftermath == "💩"
I put this into a Swift playground, which you can copy from this Gist or download here.