Wednesday, March 4, 2020

Tech Book Face Off: Getting Clojure Vs. Learn Functional Programming With Elixir

Ever since I read Seven Languages in Seven Weeks and Seven More Languages in Seven Weeks, I've been wanting to dig into some of the languages covered by those books a bit more, and so I've selected a couple of books on two interesting functional languages: Clojure and Elixir. For Clojure I narrowed the options down to Getting Clojure by Russ Olsen, and for Elixir I went with Learn Functional Programming with Elixir by Ulisses Almeida. You may notice that, like the Seven in Seven books, both of these books are from The Pragmatic Programmers. They seem to pretty consistently publish solid, engaging programming books, and I was hoping to have more good luck with these two books. We'll see how they turned out.

Getting Clojure front coverVS.Learn Functional Programming With Elixir front cover

Getting Clojure

I remember thoroughly enjoying Russ Olsen's Eloquent Ruby years ago, so my expectations were already set for this book. Olsen did not disappoint. While Getting Clojure is an introductory programming language book instead of a guide on the idioms and best practices of the language, like Eloquent Ruby was, he brings the same clear, concise writing, and nails the right balance between covering the minutia and sketching an overall picture of Clojure without boring the reader to tears.

Programming books that aim to teach a language from front to back can easily fall into the trap of spending too much time on all of the gory details about the language's arithmetic and logic systems or every possible control structure. Maybe it's because Clojure is a simple and straightforward language that doesn't have the complications that other languages have in these areas, but this book was a very easy read through these normally tedious parts. Olsen assumes the reader is already a programmer with a couple languages under their belt, so he lays out the mundane facts in a succinct, orderly manner and moves on to the more interesting bits.

Chapters are short and evenly spaced, each focusing on one small part of Clojure, starting off with the basics of arithmetic, variables, data types, logic, functions, and namespaces. Each chapter has sections at the end for discussing how to stay out of trouble when using those language features and what those features look like in actual Clojure programs. After the basics he covers the more intermediate topics of sequences, destructuring, records, tests, and specs before finishing things up with inter-operating with Java, working with threads, promises, futures, and state, and exploring the power of macros. It's a logical order that flows nicely, with later chapters building on earlier material through a gentle learning curve. I never felt stuck or frustrated, and I could read through a few chapters in a sitting at a rapid pace. That's testament to excellent technical writing skills that allow an experienced reader to go through the book at speed.

One fascinating thing about this book, and I imagine every Clojure book, is how little time is spent explaining syntax. Clojure is a Lisp-style language, so syntax is kept to a minimum. What do I mean by that? Well, the basic syntax of Clojure is a function call, followed by its arguments, both wrapped in parentheses like so:

(println "Hello, World!")

Vectors are denoted with [] and maps follow the form of {:key1 value1 :key2 value2}. Nearly all of the code looks like this, just with more complicated nesting of functions. After learning the standard library functions, you know and understand about 90% of the language! The more advanced language features like promises and macros add some more syntactical sugar, but really, compared to C-style languages, Clojure's syntax is incredibly lightweight. Some programmers may hate all of the parentheses, and the prefix arithmetic notation takes some getting used to, but learning a language that's so consistent in its structure is enlightening.

Not only does Clojure have the elegance of a Lisp, but it also runs on the JVM so we have access to all of the Java libraries that have been built up over the last few decades. That may not always seem like a benefit, considering how convoluted some Java libraries are, but Clojure has its own great features that should take precedence over the uglier parts of Java while still being able to leverage all of the time-saving work that's been done already.

Plus, Clojure has made significant advances in modern concurrent programming, both through its inherent nature as a functional language with immutable data structures, and because of safe concurrent programming structures like promises and futures. As Olsen says about threads, "One of the things that makes programming such a challenge is that many of our sharpest tools are also our most dangerous weapons." If concurrency is anything, it's hard, but Clojure makes this increasingly important programming paradigm easier and safer, as long as you know how to use those sharp tools.

Olsen has done a great job of teaching the set of tools available in Clojure with this book, and beyond it being clear and well written, it was a fun read all the way through. I love learning new languages and the new programming tools that they reveal, especially when I can find a great field guide like this one to help me along the way. If you don't know Clojure and would like to learn, Getting Clojure is a highly recommended read.

Learn Functional Programming with Elixir

Like Clojure, I wanted to dig more deeply into Elixir after reading about it in Seven More Languages in Seven Weeks. This book showed some promise as a quick introduction to the language that would focus on the functional programming paradigm. I think the title is a bit of a misnomer, though, because it was more on the side of a quick introduction to Elixir, which just happens to be a functional language. Almeida did not go into too much detail about how to use the functional paradigm to greatest advantage, and instead stuck to the basics.

Spending time on the basics is fine, of course. It just wasn't what I was expecting. The book is split into seven chapters that cover a quick introduction of what Elixir looks like, variables and functions, pattern matching and control flow, recursion, higher-order functions (like each, map, and filter), an extended example text game, and impure functions. Notably missing from this list is anything having to do with concurrency and parallelism—Elixir's primary claim to fame, being that it runs on the Erlang VM. But this is a beginner's book, after all, and it keeps things pretty simple, although the pace is probably too fast and the explanations too short for someone who has never programmed before. This book is definitely meant for experienced programmers looking to get started with Elixir quickly.

In that respect, the book accomplishes its goal quite well. It presents all of the basic features of Elixir in a logical and succinct manner, covering all of the different syntax elements of the language without much ceremony. Elixir has its fair share of syntax, too, much more so than Clojure does. Whereas Clojure consists entirely of function calls, Elixir syntax is much more exotic:

max = fn
x1, x2 when x1 >= x2 -> x1
_, x2 -> x2
end
This is a simple function that returns the maximum of two numbers, but it shows some of the more extensive syntax of Elixir with pattern matching on the second and third lines, the when guard clause, the underscore used as a wildcard matcher, and the anonymous function declaration. When this function is called, if line 2 matches, including the guard clause such that x1 >= x2, then x1 is returned. Otherwise, line 3 will match automatically and x2 is returned. This is just a sampling of syntax, too. Things get even more involved with lists and maps and function arguments, all mixed in with pattern matching and pipes. This is a rich language, indeed.

The brief explanations of all of these language features tended to be a bit wanting. They were so clipped and simple that I was often left wondering if there wasn't much more to some of the features that I was missing. The writing style was abrupt and disjointed to the point of being robotic. Here is one example when discussing recursion:
Code must be expressive to be easier to maintain. Recursion with anonymous functions isn't straightforward, but it is possible. In Elixir, we can use the capturing feature to use named function references like anonymous functions:
Here's another example when describing the Enum module:
The Enum functions work like our homemade functions. The Enum module has many useful functions; it's easy to guess what they do from their names. Let's take a quick look:
This kind of writing just starts to grate on me because it has no natural flow to it. I would end up skimming over much of the explanations to try to pick out the relevant bits without feeling like I might be assimilated by the Borg.

Most of the code examples were forgettable as well. They did an adequate job of showing off the language features that they were meant to showcase, but they certainly didn't serve to inspire in any way. On the other hand, chapter 6 on the extended example of a text game was quite delightful. This chapter made up for most of those other faults, and made the book almost worthwhile.

In the example game, you code up a simple text-based dungeon crawler where you can pick a hero and move through a dungeon fighting monsters. It's an incredibly stripped down game, since it's developed in only about 35 pages, but it shows Elixir in a real application setting, using all of the language features that were introduced in the rest of the book. It was fun and illuminating, and I wish the rest of the book could have been done in the same way, explaining all of the Elixir syntax through one long code example.

Alas, it was not done that way, but even though the rest of the book was terse and didn't cover some of Elixir's more advanced features, it was still a decent read. It was short and to the point, making it useful for a programmer new to Elixir that needs to get going with the language right now. For anyone looking to learn Elixir more thoroughly, and maybe more enjoyably, you'll want to look somewhere else.


Of the two books, clearly Getting Clojure wins out over Learn Functional Programming With Elixir. Olsen showed once again how to write a programming book well, while the Elixir book was mechanical and insufficient. That's great if you're in the mood to learn Clojure, but what about Elixir? It's a fascinating language, but I'll have to look further to find a good book for learning the details.

Suikoden (PSX)

Suikoden playstation title screen pal europe
Developer:Konami|Release Date:1997 (1995 in Japan)|Systems:PlayStation, Saturn, Windows

This week on Super Adventures, I'm finally getting around to Suikoden, a game that's been sitting on my shelf for ages. I borrowed it from a friend a while ago and he moved away before I could give it back, so it's just been lying there ever since, unplayed. Until today!

I knew the game was an JRPG when I borrowed it (one of the earliest RPGs on the PlayStation in fact), but I had no idea what the title was about. Typically Japanese games will get an English title when they're released in the West (except for games like Final Fantasy and Dragon Quest which had an English title from the start), but for some reason this has remained Suikoden.

Turns out that it's loosely based on a novel of the same name. Well, that's the name it has in Japan anyway. It's actually a Chinese novel called Shui Hu Zhuan, one of the four great classic novels of Chinese literature (along with Romance of the Three Kingdoms, Journey to the West and Dream of the Red Chamber), and in English the title translates to... Water Margin. Probably for the best they left it as Suikoden.

Read on »

Friday, February 28, 2020

Hello. Only today Databases 700million email addresses.

To unsubscribe send us an email with the topic 'unsubscribe'
Hello. Only today. Price $190
Databases 700million email addresses. All World.
No cheating. First a database, then money.
Write now and get a holiday discount.
email.business.group@gmail.com

Monday, February 24, 2020

Hiring: 3D Artist



Title: 3D artist
Focus: Environment design
Type: Full-time, permanent
Last day to apply: 17th of June 2018

Frictional games are filled with terror, intrigue, mystery, and emotion. We want our environments to reflect that, from the shape of the landscape to the smallest rock, while subtly guiding players and helping to enhance the gameplay.

This is where you come in.

We are now looking for an experienced 3D artist, who will focus on environment design for our upcoming games. This means working closely with our gameplay programmers / designers, and using modelling, texturing, and design skills to create memorable, interesting, and functional environments for our players to experience.


What will you work on?
We are quite a small team, but we consider it our strength. As an environment artist you will get to work on everything from props to high-level design. This means your contribution will greatly influence how the final game looks, plays, and evokes emotions.

Here are some of the things you will be working on:
  • Collaborating with designers to create level layouts, combining both gameplay and an artistic perspective.
  • Taking levels from whitebox to a polished product.
  • Creating basic models that make up the levels, such as walls and floors.
  • Modelling props of various complexity, both with and without the help of concept art, and often having to take gameplay concerns into account.
  • Constructing particle systems, both by drawing textures and using parameters in our editor.
  • Combining various techniques to create special effects, such as flowing water or fire.
We also encourage working outside of your area of expertise, and always learning new things. The more areas of development you are willing and able take part in, the better!

For some examples of our environments, please check the video above!


What are we looking for?
The person we're looking for is creative, driven and self-sufficient. We have recently set up a central hub in Malmö, Sweden, and hope you can move over to our seaside city sometime in the future.

You have to be a European resident to apply.

Here are some essential skills we require:
  • Good understanding of composition and player guidance.
  • Ability to challenge yourself, make bold creative decisions, and try non-conventional things.
  • A critical approach to your work, with the ability to take a step back and reflect.
  • A strive for structure, efficiency, and clarity.
  • Strong self-drive and ability to organise your own work.
  • Interest in and ability to do research for interesting prop and environment solutions.
  • Love for working on a variety of tasks.
  • Fluency in English.
And here are some more techie skills:
  • Excellent skills in 3D software. Modo preferred.
  • Familiarity with Zbrush/Mudbox/similar.
  • Excellent skills in Substance.
  • Excellent skills in Photoshop or similar software.
  • Familiarity with issue-tracking software.
  • Experience in classic/non-PBR workflow.
  • Basic rigging and animation skills.
If you want to impress us:
  • Love for horror, sci-fi, and narrative games.
  • A major role in completing at least one game.
  • Great free-drawing skills.
  • Experience in level design.
  • Strong game design skills.
  • Experience kitbashing/working with modular sets.

What do we offer?
We make games, because that's what we love. But we know there are other things we love, like playing games, taking part in sports, or spending time with our families. We believe a healthy balance between work and life reflects positively on your work, which is why we don't encourage crunch.

We also offer:
  • Flexible working hours.
  • Opportunities to influence your workflow.
  • Variety in your work tasks, and ability to influence your workload.
  • Participation in our internal game Show & Tell sessions, so you'll have input into all aspects of the game.
  • Social security and holidays that are up to the Swedish standards.
  • An inclusive and respectful work environment.
  • An office in central Malmö you can use as much as you please.
  • Fun workmates, game and movie nights, and other outings!

Apply? Apply!
If all of the above piqued your interest, we would love to hear from you! Send us your application 17th of June the latest - but the sooner, the better! Please attach your:
  • Cover Letter 
    • Why should we hire YOU?
  • CV
  • Portfolio 
    • Link or PDF
  • Preliminary work test
    • See the test below
  • Examples of works that have inspired you or blown you away 
    • PDF, screenshots preferred.

Please note that we require all the attachments to consider you.

Send your application to apply@frictionalgames.com!


Preliminary work test
After 3 years of failed experiments, Professor Kim finally managed to reverse gravity. However, the professor died just as he succeeded, and the whole thing ran amok.

The player enters the research facility where the experiments took place. As they go through the level, they gradually learn about what the professor was trying to achieve. At the end they're met with a revelation, and see the disturbing results of the experiment. As they reach the end, the level must loop in a way where the player finds themselves near the entrance, where they first started.

We are looking for a simple design, done as a rough 3D sketch/white box. You are free to write notes and do paint-overs on top of the 3D.

This test is a first step in the evaluation process, showing us your basic skills, so we are not looking for you to spend a lot of time on it. Imagine this as a quick proof of concept you would present before doing a pitch or a design.

We will evaluate your artist vision, creativity as well as level design skills.

Put everything as a collection of images into one folder on Dropbox, Drive or similar, and send the link to us.


Privacy Policy
By sending us your application, you give us permission to store your personal information and attachments.

We store all applications in a secure system. The applications are stored for two years, after which they are deleted. If you want your your information removed earlier, please contact us through our Contact form. Read more in our Privacy Policy.

Sunday, February 23, 2020

Brainstorming With Factoring

In the last post I described how I sometimes describe a problem with a matrix, and then look at the matrix transpose to see if it gives me new ideas. Another technique I use is to look for a factoring.

In algebra, factoring transforms a polynomial like 5x² + 8x - 21 into (x + 3)·(5x - 7). To solve 5x² + 8x - 21 = 0, we can first factor into (x + 3)·(5x - 7) = 0. Then we say that x + 3 = 0 or 5x - 7 = 0. Factoring turns a problem into several easier problems.

x 3
5x 5x² 15x
-7 -7x -21

Let's look at an example: I have six classes, File, EncryptedFile, GzipFile, EncryptedGzipFile, BzipFile, EncryptedBzipFile. I can factor these into a matrix:

Uncompressed Gzip Bzip
Unencrypted File Gzip(File) Bzip(File)
Encrypted Encrypt(File) Encrypt(Gzip(File)) Encrypt(Bzip(File))

Using the Decorator pattern (or mixins), I've turned six different types of files into four components: plain, gzip, bzip, encrypt. This doesn't seem like much savings, but if I add more variations, the savings will add up. Factoring turns O(M*N) components into O(M+N) components.

Another example comes up when people ask me things like "how do you write linear interpolation in C#?" There are a lot of potential tutorials I could write:

C++ Python Java C# Javascript Rust Idris …
Interpolation
Neighbors
Pathfinding
Distances
River maps
Isometric
Voronoi
Transforms
…

If there are M topics and N languages, I could write M*N tutorials. However, that's a lot of work. Instead, I write a tutorial about interpolation, someone else writes a tutorial about C#, and then the reader combines knowledge of C# with knowledge about interpolation to write the C# version of interpolation.

Like transpose, factoring only helps sometimes, but when it applies, it can be quite useful.

Friday, February 21, 2020

Movie Reviews: Ready Player One, Game Night, Three Billboards Outside Ebbing Missouri, The Phantom Thread, Loving Vincent

See all of my movie reviews.

Sorry guys; five disappointing movies ...

Ready Player One: From Steven Spielberg, this is a shallow, uninteresting movie is about a guy who plays in a virtual world looking for three Easter eggs, or "keys", so that he can gain ownership of the company that owns the virtual world. While he is at it, others are also looking for the keys, one of whom is a woman who joins him as love interest (along with some other guild members), as well as certain high-financed players backed by people who are willing to kill you in the real world if they discover who you are and that you are a competitor.

Within five minutes of the start of the movie I found myself not caring about the boy or anyone else, since there is zero character development. Astonishingly, the amount I cared continued to drop as the movie went along. I didn't think that was possible, since I already didn't care at all, but I managed to continue to care less and less. I eventually figured out that this was because the score was very good. It cued me into thinking, every once in a while, that something that I might care about was about to occur. Each time, however, this never happened.

The amusement of the movie is supposed to come from a) watching other people play video games, which is a colossal bore (unless the player knows how to fill the time with snarky commentary, as people often do on YouTube), and b) seeing hundreds of throwbacks to 1980s video games and fiction. Unlike recent media in which this worked, such as Stranger Things and even Super 8 to an extent, it did not work here. I didn't get 90% of the references, and, anyway, simply seeing references on screen is not what made those other media good; the other media had good stories. And, I guess, we are supposed to be amused by c) the suspense as to whether the main character will solve the rather obvious and uninteresting puzzles and ultimately find the keys and triumph. Duh.

There is not a scrap of emotion in the entire movie. Someone gets killed at one point, but it's someone who we were barely introduced to and who is not shown as having any emotional connection to the main character. I am really in shock at this. This is the emotionally manipulative director who brought us Jaws? E.T.? Shindler's List? Bridge of Spies?

Whatever. I guess, while it is a useless and dull movie, it is not particularly offensive, at least. Oh wait, it is: at the end of the movie the narrator tells us that we shouldn't be spending all of our time playing video games / in virtual reality, but should instead interact with each other more in the real world. Thanks for that very important message; never would have known that.

One more thing that irritated me: T.J. Miller played the exact same character in this movie that he played in Silicon Valley. I liked it in Silicon Valley, but it was pretty out of place here.

Game Night: This is ninety minutes of one joke, the kind of joke that is funny only if it comes once, unexpectedly, in the middle of an otherwise serious situation, but is not funny when it comes repeatedly for ninety minutes. This is a farcical remake of The Game (1997, Michael Douglas). Instead of a strange combination of gaslighting, pursuit, and trying to figure out what is going on as the terror mounts, in this movie the terror happens, but everyone keeps making stupid jokes. It's supposed to be funny, because they keep making light of things while bad things happen; that's the one and only joke, really. The acting, directing, and cinematography were fine. Jason Bateman and Rachel McAdams are always cute.

The movie that did this well is The Man Who knew Too Little (1997, Bill Murray), which was a cute and silly movie. I was appalled enough at this movie to happily walk outside the movie theater twice to answer phone calls (I had it on vibrate, guys). If my friends hadn't been with me in the theater, I would have gone home and not gone back in to the theater to finish the movie. In the movie's defense, my friends liked it. They said that they like to see a mindless, silly movie once in a while (I think that's a slight directed at me and my movie choices).

Three Billboards Outside Ebbing Missouri: This is a well-acted, grim piece of midwest Americana. Mildred's (Fances McDermott) daughter was raped and murdered several months ago, but she hasn't heard anything from the police who are busy (according to her) chasing and shooting blacks who aren't really doing anything. So she puts up some billboards that pointedly call out the chief of police (Woody Harrelson) in a low-trafficked area. What makes it interesting is that a) she is actually friends with the chief of police, b) the chief is dying of cancer and should really not be at work, and c) the rest of the police dept doesn't take kindly to this, especially one lunatic racist violent hotheaded police creep. Things come to a boil, especially after the police chief shoots himself.

This movie is relentlessly depressing, representing a lot of the worst aspects of American prejudice, violence, despair, and hatred. Just about nobody supports Midred, not even her son. Interestingly, the lunatic police guy actually makes a kind of (unbelievable) change around two thirds into the movie. This should have given us a bit of hope. However, the movie ends just as bleakly and miserably as it started.

Other than being relentlessly depressing, what actually ruins the movie for me are the multiple acts of outrageous criminal behavior performed by multiple people on multiple occasions, some of it incredibly brutal and most of it performed in sight of multiple witnesses. These acts are done and never have repercussions. And I'm not saying that the bad guys weasel their way out of repercussions, I'm saying that the movie doesn't seem to believe that any reactions by the witnesses or police is expected. What the hell? Is this a video game? While I expect to sometimes find injustice in the system, the system still exists; treating violence like it's just a video game broke the reality of the movie for me.

The movie has compelling performances and some good ideas, but it's ultimately not realistic enough to recommend.

The Phantom Thread: Daniel Day Lewis gives another astounding performance as Reynolds, a dressmaker / bachelor / bully and all around a**hole in 1950s London. He is joined by other great performances by Vicky Krieps, Lesley Manville, and everyone else in this beautifully shot and artfully scripted period piece about a dressmaker who obsessively creates beautiful dresses, but only if his cadre of assistants take care of his other needs and none of them interrupts his "solitary genius" thinking. This genius is, apparently, sufficient excuse for everyone to give him his way, and for him to throw toxic vitriol at anyone who expresses any kind of opinion, presence, or personality. Like a spoiled baby, as one of the other main characters eventually says.

Krieps plays a waitress, Anna, who is drawn to this bully and who follows him to London to be a dress model and eventually a lover. She falls deeply in love with him - because he is such a genius - and even goes and does some of his bullying for him, both - because he is such a genius - and because she hopes he will one day fall in love with her and allow her to butter her toast in his presence without cursing her out. Even taking into account that this is the 1950s, she is really pathetic; in the first two thirds of the movie, not a moment is shown where she has a relationship with anyone else but him. No family? No friends or neighbors at all?

SPOILERS follow, because really you shouldn't watch this movie, and if you do you should be prepared for what happens.

Anna has a little strength in her, just enough to keep wanting him to love her. And so, one day after she suffers great abuse from him, she poisons him, and he falls sick and can't work for the next few days he is too sick to abuse her, so she is happy. And then, he comes back from his illness and proposes to her.

Okay ... but maybe he doesn't know that she poisoned him?

After the marriage, things go back to as they were, obviously, and he begins to heap abuse at her again until one day she overhears him complaining about how he doesn't want her around as she is disrupting his work. So she poisons him again, and this time he knows it and goes along with it. And he loves her.

And that's the movie. Okay...

So this is a sick, toxic (literally) relationship that works for both of them. She is only happy when he is poisoned and helpless, and he, despite his passion and perfection for work is apparently only able to love her when his work is taken from him and he is poisoned and helpless. Apparently he makes the choice to let her poison him. Perhaps he really doesn't want the endless pressure of being a genius after all? It's hard to say, as the screenwriter leaves it a mystery.

Like Whiplash, I recognize great performances and interesting screenplay, but I can't watch it. Who really wants to watch two hours of repulsive people, where the main character is an abusive, horrible person? A little bit of it in a movie adds color. You know that the scriptwriter threw it in for you to not like the abusive character. But, if the whole movie is about an abusive character who doesn't learn the error of his ways, you get the impression that the scriptwriter thinks that we should be entertained by it, or even sympathetic to this toxic white privileged male jerk.

But I wasn't. And I wasn't. I was simply repulsed. And the perfect "solitary genius" who is too important to be bothered with having to be nice to people is a myth.

Loving Vincent: Like a number of other animations I have reviewed, this work is one of astounding, gorgeous animation but also utterly boring. The plot, such as it is, is ... um ... well, there isn't one. A police officer wanders around trying to deliver a letter and asks a few questions about how Van Gogh died. It is all shots, and scenes, and music, and flaccid unimportant dialog. And nothing happens and there are no characters.