iTranslated by AI
Key considerations when implementing the same web application in multiple languages
I will write about things I noticed you should be careful about when implementing the same web application in various languages, such as when creating problems for ISUCON.
HTML Template Engines
Template engines have different notations depending on the language, and there are significant differences between libraries regarding layout, escaping, function calls, and more.
It is easy to forget if you are used to flexible template engines like Ruby's ERB, but since template engines in other languages are not necessarily feature-rich, it is better to avoid using anything other than simple functions even if you do use them. In the first place, it is better to just return JSON or similar without using a template engine at all. The reason recent ISUCON problems rarely return HTML is not because it is cool, but to make porting to other languages easier.
Time
You should avoid returning or parsing strings like 2013-02-03 00:00:00 +0000 UTC. While you might think it's fine since these things are standardized by ISO, you will be troubled by subtle differences between languages, such as the handling of microseconds, time zones, and the presence or absence of 'Z'.
For example, in the ISUCON9 qualifiers, although data was stored in MySQL's datetime type, it was unified to UNIX time when passed as JSON. Let JavaScript handle the display on the browser. If you don't do this, you'll end up struggling to make it parseable for the benchmarker, like having to implement various workarounds in specific languages. By the way, since UNIX time has the Year 2038 problem, please handle it as int64 rather than int in languages with static typing.
Error Handling
In languages like Ruby or PHP, you can get away with ambiguous error handling, but in Go, you need to handle errors every time. Therefore, if you don't write with the assumption of porting to Go, you will be forced to write undefined error handling only during the Go implementation. When writing in languages other than Go, please always perform error handling carefully, assuming it will be ported to a language like Go.
Don't Freely Increase Hash Map Keys
In Ruby or PHP, hash maps are convenient, so it's tempting to add keys haphazardly. However, in Go, you basically need to define a struct every time, so if you're too free with it, porting to Go becomes difficult. While you can use Go's map, keep in mind it's not as easy to use as in Ruby or similar languages.
Finally
There are various other things depending on the language, but I have written down only those that are surprisingly easy to overlook. I feel this might only be useful in special cases like creating problems for ISUCON, but it's good to keep them in mind for such situations.
Discussion