34

Guess the language...

Comments
  • 20
    CallbackHell.js ?
  • 6
    Cave Painting
  • 10
    ShittyProgrammer
  • 5
    js or REALLY messed up c#
  • 10
    JS without async/await stuff
  • 20
    Is that why JS devs set the tab size to 2 spaces? So it looks less shit? 😂
  • 15
    If this is JS, it's super wrong. Do yourself a favor and learn promises, async, and await
  • 18
    @nam17887 I once did an analysis on a few thousand public GitHub repos, and 2 spaces indeed started to become popular in the early nodejs callback hell days. Repos which utilized promises, and later async libs and ES6 started switching back to 4 spaces.
  • 5
    @bittersweet hahaha nice findings, you should write a blog
  • 6
    Space Invaders?
  • 1
    @devTea Precisely my thought as well. 😁
  • 4
    Is that a good photo of a screen or a bad IDE background?
  • 2
    @devTea only if you call first
  • 1
    PoorProgrammer
  • 2
    "editor.tabSize":1inch
  • 1
    I’ve seen that language before, I think it’s R.O.T

    (Refactor or Trash)

    Fuck that code is ugly
  • 1
    @Codex404 @NotFound @TheyCallMeMJ @fristys @leanrob

    It's interacting with a database. Two calls to the database, each with it's own forEach loop to handle the results. And one call back at the end, which I will be refactoring. But yeah the DB stuff doesn't seem to offer awaiting afaik. I'll take a look for it. But there are some nested loops so it would still only half the hellish nature of it.

    @nam17887 @bittersweet @nmaggioni @mszaf

    I always think it's funny how much people swoon over vim as if it's God's perfect editor, but every time I share screenshots with the default vim tab size, they're like "ew ugly editor" so I keep it that way.

    @Fabian

    IDE has a background which is transparent, darkened, and blurred.
  • 1
    Looks like utils.promisify is the way to go for the whole database thing
  • 1
    @AlgoRythm HackerNoon has some good 101s on callbacks vs promises vs async/await:

    https://hackernoon.com/should-i-use...

    https://hackernoon.com/6-reasons-wh...

    I'd pick a solution which uses modern ES6 syntax + babel (in case your interpreter doesn't support it). On a modern node version, you might not even need babel.

    ES6 + babel "transpiling" is the method which will be easiest to maintain in the future. Custom libraries might have breaking changes or become unsupported, while ES6 features are pretty stable going forward. When interpreters change, you maybe just change a babel config flag and you're good to go again.
  • 2
    @bittersweet I know what babel is, and I know how to work async and await. I chose to use a call back in this instance for socket.io, utilizing their response callback features. And mysqljs doesn't have awaitable functions, so I'll need to convert them using utils.promisify
  • 2
  • 0
    Refactored
  • 1
    Not Python.
  • 0
    @Maer Not wrong!
Add Comment