Computer Science
Algorithm
Data Processing
Digital Life
Distributed System
Distributed System Infrastructure
Machine Learning
Operating System
Android
Linux
Tizen
Windows
iOS
Programming Language
C++
Erlang
Go
Javascript
HTML + CSS + JS is Good (2014)
Scala
Scheme
Type System
Software Engineering
Storage
Virtualization
Life
Life in Guangzhou (2013)
Recent Works (2013)
东京之旅 (2014)
My 2017 Year in Review (2018)
My 2020 in Review (2021)
十三年前被隔离的经历 (2022)
A Travel to Montreal (2022)
My 2022 in Review (2023)
Travel Back to China (2024)
Projects
Bard
Blog
RSS Brain
Scala2grpc
Comment Everywhere (2013)
Fetch Popular Erlang Modules by Coffee Script (2013)
Psychology
耶鲁大学心理学导论 (2012)
Thoughts
Chinese
English

HTML + CSS + JS is Good

Posted on 28 Jan 2014, tagged webUIfrontend

These days I’m using Libgdx to write a mobile game. While I’m writing it, I find that the modern web tech is very good: HTML + CSS + JS. Let me talk about the details.

The drawing part of the game is split into two parts:

  • Init all the objects.
  • Update these objects in every frame.

Why not do all the things in every frame? Because init objects need more time than change the states of an object in most cases. Init object need to allocate memory, read configuration, load assets, and so on.

Init part also need to specify the position of every objects, or the layout of the stage. I write lots of code to init the position of every object. It is annoying. For example, when the width is changed, I have to change its position to make it in the center or something like that. And the position specification is messed with the code. So it is better to make the position and layout data split from the code.

In web tech, here it is:

  • HTML is what it has in the first place (init objects).
  • CSS is the position and layout of the objects (data split from code).
  • JS update the objects when some events occurs (update objects).

Everybody say and say that again. But I didn’t understand that until I really wrote an application that render graphics to the screen.

So code is better than talk.