Better HN
topnewbestaskshowjobs
Log inSign up

SomeCallMeTim

4,107 karma · joined Feb 17, 2010 (16y ago) · 1,490 submissions

I'm a consulting software architect and freelance CTO. I come in and rescue small businesses from code disasters, and occasionally am given the chance to prevent the disasters to begin with. I also used to develop video games, and have pivoted that skill to gamification consulting.

https://coderescue.com

Submissions

comment 9y ago · link · parent

>The dominance of digital and streaming services has stolen this experience from us, and we are fighting to get it back.

I used to collect books. It was a big part of my life.

Now I pretty much only buy books on Kindle. I almost sort-of miss buying books. But only in theory. In practice I much prefer having my current library in my pocket at all times.

Same with music. I have my entire library on my hard drive, and I can copy large portions of it onto my phone and/or the USB flash drive I keep in my pocket. I don't touch the physical CDs unless I think a rip didn't work right, and then only long enough to re-rip the music. When I buy new music I don't even get physical CDs any more.

Mix tapes? I could potentially just stick that same USB drive into a friend's computer and copy all the music he thinks I might want to try out. Many hours of music, in a few seconds of transfer. Try that on tapes.

Not that I'd do that, of course, since it would be illegal, and I certainly wouldn't post about doing illegal things on HN. :P

Playlists also do exist, and I use them. I do miss the ability to transfer a playlist to someone else -- they don't transfer very well, given their dependency on paths to the music -- but not enough to wish for tapes back into my life. Besides, when I make a playlist today, my "mix" often has many hours of music in it; I've had playlists with over 40 hours of music, and I enjoy hitting "shuffle" and listening to all the songs in a different order.

But the point is, while I believe you that "people" want do interact with physical objects, I think it is a minority of people who want that. A very small minority. Because the digital experience is just strictly better. And most people, especially people who've been stuck using tapes because they were the only option at the time, realize that tapes in fact suck.

comment 9y ago · link · parent

I have a Chevy Volt. No transmission whatsoever. That's even better. :)

comment 9y ago · link · parent

I always carry a 16Gb USB flash drive in my pocket.

I can play music from it in both of my cars (USB ports), at most places I visit (plug it into a computer), and the music doesn't degrade with playback.

Oh, and I could throw about 133 hours of high quality audio onto it and it would still be half empty.

AND...my phone has plenty of room for another 8Gb of music, and to play that I just need to hit play; plugging it in to an amp or headphones is optional, but recommended.

Why are we even having this discussion?

comment 9y ago · link · parent

The Playground SDK had over a hundred titles shipped on it. You can see some of them on my MobyGames profile. [1]

"Proper use of byte code generators" -- at that point you're not writing Lua any more, any more than Scala or Clojure targeting the JVM is "writing Java." The article is about using Lua for AI, which is what my comments are about, and my comments all stand.

Arguing about whether the VM is good enough to support a state machine is orthogonal to whether it's a good idea to use Lua coroutines as suggested by the article.

[1] http://www.mobygames.com/developer/sheet/view/developerId,13...

comment 9y ago · link · parent

I didn't throw away Lua because I couldn't persist coroutines. That's just why I didn't use Lua coroutines the way the article recommends; I had plenty of of other reasons to abandon Lua. [1]

[1] https://realmensch.org/2016/05/28/goodbye-lua/

comment 9y ago · link · parent

Very well put, thanks.

Explicit promises have very nice, composable behaviors that I'm exploiting all the time, and that have no equivalent in the Lua coroutine world.

And once you have propagated them around, I think the ergonomics are just fine; I've taken some pretty hairy callback logic that no one could fully understand without careful study and turned it into async/await code that pretty much anyone could follow.

I think the implicitness of "this could suspend" does frequently cause serious problems; in Lua this shows up as the dreaded "Attempt to yield across a metamethod C call boundary" [1] bug. Talk about cognitive load! If you're calling C from Lua, and that C code then calls back into Lua, and the latter function yields, you get this error. So you have to be very careful about what is allowed to yield -- and since any function in Lua, at any point in the call stack, can yield, it's easy to accidentally shoot yourself in the foot.

[1] http://stackoverflow.com/questions/8459459/lua-coroutine-err...

comment 9y ago · link · parent

Lua coroutines don't have that ability out of the box.

JavaScript promises do (Promise.all).

comment 9y ago · link · parent

Sorry, but you're totally missing the key point.

Say you have an AI that's made 3 decisions and you're in the MIDDLE of a coroutine where it's waiting for the next criteria that will shift it to its next state. So the AI code looks like:

   local player = lookForAPlayer()
   if navigateToPlayerLocation() then
      local quest = givePlayerQuest();
      while (!quest:done()) do
        waitWithStandardReply("Waiting for you to finish the quest!");
      end
      if (quest:resolved()) then
        giveQuestReward();
        while (true) do
           waitWithStandardReply("Thanks for finishing that quest for me!";
        end
      else -- quest abandonded        
        while (true) do
           waitWithStandardReply("Thanks for nothing!");
        end
      end
   end
This is rough example code, and not how I'd probably handle this case specifically, but it gives you the general idea. Each of those functions (except the quest member functions) has, somewhere inside it, one or more "yield()" statements, and some logic to make its goal happen incrementally.

Yes, it's awesome to be able to code AI logic that way. But how do you save the coroutine state? The actual execution state of the coroutine itself, including what line it will resume next, the values of any bound variables, the values of any local variables, are all part of the state of the AI in that case.

In C, you've got functions that may be relocated somewhere else in RAM and potentially stacks to save (if you're using a "real" coroutine library), so just doing a memcpy won't work. What would you memcpy to save the line that the script is paused on? In Lua, it can be done with Pluto, but then you can't use LuaJIT. I see libdill has the ability to use a user-supplied stack, but it doesn't appear to have a "resume" call that takes such a stack memory block, so the best that would happen is that the coroutine would start over from the beginning. Meaning that if you saved the above coroutine in the middle of a quest, the character involved would offer you a new quest when you saw them instead of accepting the result of a successfully allocated quest.

If your object states are all being handled in traditional objects, then you're not using the coroutines in the way described by the article.

comment 9y ago · link · parent

I may need to check that out. Thanks for the link!

comment 9y ago · link · parent

Sorry, but you're pretty profoundly wrong.

I have written an entire (popular) game engine that tightly integrated Lua and used custom-generated C++ bindings. I had to dig pretty deep into the Lua VM to accomplish that.

Heck, I found and fixed a bug in the LuaJIT 1.x series -- my fix integrated by Mike Pall, with a credit on the changes page.

The thing is if you encode game state into the program state, like using coroutines for complex, long-running AI tasks, for instance, then there's no way to save or restore that state if you're using LuaJIT. And Pluto saves the state in an opaque manner.

And as another commenter pointed out, if you want to update the game with new behaviors, god knows how that will interact with save states that have huge call stacks in them. And bug fixes? Yeah, since you're saving the whole program state at this point, bug fixes won't be incorporated in the restored image.

comment 9y ago · link · parent

Awesome that this exists already. Now we just need TypeScript support... :)

comment 9y ago · link · parent

Coroutines are awesome, don't get me wrong.

BUT, contrary to what I believed when I was still working with Lua, making the coroutine explicit (like async/await in C# and JavaScript ES2017) is actually even better.

In particular, when your coroutines are explicit, you can say "queue up this task, this task, and this task, and continue here when they're ALL done." So when you're dealing with several tasks that might take different amounts of time to complete, they can do the work in parallel.

I went from being a major Lua fanboy and posting frequently to the mailing list to drifting away from involvement to abandoning the language, in a relatively short period of time. I even wrote a blog entry about it. [1]

I still think Lua has better "bones" than JavaScript, but with TypeScript, async/await, and JavaScript JIT engines everywhere, TypeScript just wins for me.

[1] https://realmensch.org/2016/05/28/goodbye-lua/

comment 9y ago · link · parent

I actually hacked together my own "coroutine" scripting library in C once upon a time. Lots of macros. Same problem though.

When I said slow, I meant slow to save the entire state of the Lua VM. You can't even do that in C, so it doesn't really apply to the problem I was pointing out.

comment 9y ago · link · parent

I've done this kind of thing in Lua before, but what troubles me about it is the fact that a lot of the state of your game ends up encoded in the Lua stack.

What happens when the user wants to save? There's Pluto [1], which is somewhat slow for complex state. And it doesn't work on LuaJIT code -- and I tend to like to run games on LuaJIT.

And it's opaque: If you're debugging some kind of interaction in the game, you can't just look at the save state to see what's where.

I used to be a big fan of Lua, and this kind of AI and behavior coding was a component of that. But ... I think that, on balance, actually creating a data format that represents the state and "coding" using that plus state machines is actually a more robust and useful way to accomplish the same thing.

[1] http://lua-users.org/wiki/PlutoLibrary

comment 9y ago · link · parent

Flow is cool, but TypeScript has way more traction. Would jump on this in an instant if it had TypeScript support and a VS Code plugin.

comment 9y ago · link · parent

> My oven, microwave, and dishwasher all run on code.

The quantity of code being written for devices like that is not high, and the quality is almost universally crap. Bad enough that I'm pretty certain 99% is written by a hardware engineer who needed to get the product to work but who had no clue about software engineering.

I've worked with people who write code for cars, and I've done embedded work. One developer can support dozens if not hundreds of products over a career. I still stand by the fact that most software engineers fall into the categories I'm talking about, if only because one software product might require 100-10,000 developers work on it for years, while your microwave probably took one person a month (and an actual software engineer should have been able to write the code in a couple of hours).

I'm not counting by number of devices. I'm counting by number of software engineers. And even if you count the hardware engineers who don't know the first thing about software engineering, I don't think you'd come close.

comment 9y ago · link · parent

I do wonder if there was a confounding factor that they didn't successfully isolate. "General health" seems like an obvious one, but some other factor might be more subtle.

comment 9y ago · link · parent

> hooked on something unwholesome (drugs for example) with their newfound free time

Based on what the "Rat Park" studies show about the natures of addiction, that seems very unlikely: People get addicted when their lives suck, not when they have free time.

Having money enough to eat is going to go a long way to making peoples' lives suck less.

Not to say that helping people direct their energies wouldn't be useful. It may take a few months of vacation or longer before people can recover enough drive to do anything with their time that they can make themselves do anything other than relax. When you've spent your life being told what to do and driving yourself with fear of losing your job, it may take months or even years of recovery before you can be self-motivated effectively. Telling them that too might be useful.

I think the government should offer "jobs" that don't add a huge amount of money over the basic income, but that provide some public good, to help people who are just terminally uncreative direct their time, but should also offer free education in how to start their own businesses for those who do want to create something, build something, or provide a service. Or alternately they could learn new professions in their now-free time and get higher paying jobs.

So yes, I agree with your conclusion (education and guidance is important). Just not the reasoning that got you there. :)

comment 9y ago · link · parent

I never claimed that JavaScript was or should be used in any of the above. Just that it's "important in software engineering", by which I mean it's used or usable by people in 80% of the actual jobs in "software engineering."

I'd probably prefer to see a language like Go or Rust in critical systems. Self driving cars come to mind as well, but probably anything IoT or otherwise infrastructure related. But I think those jobs, all together, are a minority of programming positions.

I hope so, anyway, because I don't actually believe there are enough smart developers to work on critical systems if it's anything like half or more of the software engineering population. Most developers pretty well suck.

comment 9y ago · link · parent

> I'm not an anti-javascript snob either (I'm not sure what that actually means),

Having been one, and having argued with several, it generally means:

* Looking at how JavaScript started vs. where it is now.

* Complaining about the ways that the backward compatibility requirements of the language can lead to obscure bugs, e.g., auto-coercion on "==" comparisons can end up with surprising and sometimes bug-causing results

and, importantly

* Ignoring all of the best-practice advice to use linters (eslint, tslint) that, in a deterministic manner, prevent you from writing code that contains any of the above bugs.

TypeScript also solves 95% of the major JavaScript complaints.

>There's a lot more in the world than websites and phone apps that need code to run.

and

>I just think it's a bit hyperbolic to call javascript the most important thing happening in software engineering right now when we're solving much bigger global problems than that right now with technology.

If you count all of the code to run apps, servers, and web clients, I think you do hit the majority of code out there, at least if you're counting the number of developers working on it. I think you would hit a majority just with web client side. It seems like everyone and their sister does web development. With all three domains it seems trivial to hit 50%, and I think 80% is still a reasonable estimate. A quick search finds no statistics on this, though. :|

Whether there are "bigger global problems" that are being solved elsewhere isn't really relevant. It's entirely reasonable to say that something is highly important to "software engineering" if it has relevance to more than 50% of software engineers.

comment 9y ago · link · parent

JavaScript is important in:

* Web Development is obvious, sure

* Cross platform app development: React Native, NativeScript, Electron, nw.js, and others are extremely powerful, arguably among the best cross platform solutions, and all are gaining in popularity

* Server development. NodeJS is hard to ignore because it's fast, easy to develop in, and has the amazing (if sometimes frustrating) NPM ecosystem.

Software engineering is bigger than that trifecta, but you probably hit the 80% mark if you count all application, web, and server code development. JavaScript is making some inroads into embedded, but it's not as ideal for embedded work, except as a control language from the outside, so I'm not as bullish on JavaScript there.

Throw in TypeScript and a good linter and you have a really strong, flexible, dynamic-yet-statically-typed environment that you can use to hit the (estimated) 80% mark. It really does live at a sweet spot in productivity and software engineering, if you ignore the anti-JavaScript snobs. [1]

[1] Disclaimer: I was an anti-JavaScript snob as recently as about 5 years ago. My background is in games, drivers, C++, assembly language, several other scripting languages, and writing native apps. Things that changed include: 1) Me, in that I gave JavaScript, and later TypeScript a try, 2) I learned to love linters and transpilation, 3) The ecosystem exploded and the tools we have now, including VS Code and build tools like gulp, not to mention the built-in debuggers in every major browser, are now amazing, and 4) JavaScript and TypeScript themselves evolved and upgraded until they were actually both very good languages.

comment 9y ago · link · parent

Makes me wonder what service or other sub-section of Yahoo actually got hacked, then. Doesn't seem to say in the article.

comment 9y ago · link · parent

>You can make the argument that it's too financially expensive for most companies to make their devices more modifiable, but that same argument cannot explain why people are banned, by risk of government punishment, from decrypting their programs, which would be the first step to investigation.

Because they're shortsighted and afraid, in short. Legacy companies feel that control is crucial.

But GPL and other Copyleft software requires you to make the code modifiable. That's an expense most companies don't want to take on. Hence, companies avoid GPL.

comment 9y ago · link · parent

I had a Yahoo account entirely to use a Yahoo email list; I used to have it for Yahoo chat, but I haven't used that in years.

So I ignored the hack a few months ago. I also never got notified that I was vulnerable.

Just now I tried to log in to see if my password had been invalidated. Nope. It was my old insecure "pattern-based" password (myprefixYAHOO) that I use nowhere any more. Probably short enough to have brute forced with MD5 in a few minutes at most.

And yet...no spam sent from my account. No spam in my account (except some kind of announcement from "Aabaco, the new name of Yahoo Small Business" from a year ago. Just some of the mail from the email list that petered out over two years ago as the list transitioned into a Meetup group.

So I guess Yahoo either has considerably more than 1B users, or there were simply so many compromised accounts that they didn't bother trying to use all of them to send spam.

Changed the password just now to something secure "just because", but it's hard to care.

comment 9y ago · link · parent

You're arguing for features that would be genuinely challenging for companies to implement and support.

I'd love to have the freedom to modify the software in every gadget I own. But the $40 digital toaster oven with absolute crap firmware coded by idiots doesn't even have a USB port or any way to attach it to a computer; it's probably got its code permanently burned into ROM and isn't even software upgradable even with the right hardware.

If it were programmable, it probably would have cost 5x as much.

Say it's a device that already supports updates, like your smartband likely does. By locking down, say, a smartband, you've made it much easier for your support personnel to be able to answer questions -- and they won't have to say, "Sorry, you've modified the device, so I can't help you." And they won't have to field questions from hackers who are trying to follow the poor instructions that engineers pieced together on how to rebuild the firmware.

And that's if they even have the right to distribute the firmware to begin with. Just because your smartband manufacturer wants to do the right thing (in this theoretical universe) and make it hackable, doesn't mean that the chip manufacturers are happy with that. So they might need to switch to another, possibly more expensive chip.

And that means the goal of "hackable" needs to be a design goal from the start. Shortcuts they might have been able to make with a closed system are now off the table. You've added another constraint to the design, and every constraint takes time. And money.

Advocate that companies produce modifiable devices, sure. But don't pretend that it won't increase their cost at some level. It's not ethics; it's simply good business to lock down products that 99.9% of users won't try to hack.

And I'm a fan of hacking devices. I just can see the other side of the argument.

comment 9y ago · link · parent

I beg to differ. ZeroMQ is fast and has bindings for most major languages [0]. So if you want to make native apps that speak over a very reliable channel, ZeroMQ is a great tool for interop. And its elliptic curve auth/encryption are super trivial to set up as well as being very fast, as opposed to getting https certificates pinned correctly on both the server and client.

Only if you only plan to ever speak to other Erlang/Elixir hosts would it make sense to use an Erlang/Elixir-only solution. And I will not even consider the option that writing a game (which is what I'm doing) in Erlang or Elixir is reasonable. Yes, it's possible, in a "Turing Machine" kind of way. But no, it's a terrible idea. Complex games don't break down into isolated functional chunks without actually making them much harder to design, maintain, and extend. I use plenty of functional concepts when I write games, where appropriate, but using a functional language would be a nightmare.

Phoenix is a web framework. "More powerful" functionality that I can't use for a particular project is a pretty profound waste.

Since I did actually abandon ZeroMQ for my game (when I decided that I needed to do most of the game as a web client anyway, and so I should just make the host app be built on TypeScript as well), I'm now using Socket.io, which surprise has an outdated port to Erlang [3] that doesn't support 1.0, and there's no native Elixir port. See a pattern emerging?

And since I mentioned speed was important: Kami, a Go-based web framework, benchmarks up to 4x faster than Phoenix. [1] Raw Go speed for the kind of thing I'd actually be doing is closer to 5x-10x that of Phoenix. [2]

By the way, it turns out there's an actively maintained Socket.io port on Go. And being able to spin up 1/8 the number of servers could realistically take my project from break-even to profitable.

[0] http://zeromq.org/bindings:_start

[1] https://www.techempower.com/benchmarks/#section=data-r13&hw=...

[2] Look at the fasthttp Go results on https://www.techempower.com/benchmarks/#section=data-r13&hw=... and https://www.techempower.com/benchmarks/#section=data-r13&hw=... -- my usage pattern would be somewhere between raw text and "single db" access, since my DB is Redis on localhost, so it's more like a cache than a Postgres/MYSQL lookup.

[3] https://github.com/yrashk/socket.io-erlang

comment 9y ago · link · parent

A key advantage that Node has? NPM with 350,000 packages.

Granted they aren't all top quality packages, but thousands are.

I was working on one project that used ZeroMQ, as a random example. There are excellent packages for Node, including a well maintained version for the newest 4.0 branch.

For Elixir, when a team wanted to interface using ZeroMQ, the best they could find was a "work in progress, not ready for production use" build that was a partial re-implementation of ZeroMQ 3.1, and that specifically lacked the elliptic encryption feature that we were using. The more mature ports to Erlang similarly doesn't support the encryption we were using. [1] There's one native binding that seems to only support 3.1 (at most) as well [2], but it's something you need to build and configure, as opposed to "npm install zeromq --save", or better yet, "yarn add zeromq", and then your project will work on any system without any complex build rules to get it working.

That's just one package that I tried to use, and it's a popular network message queue package (two full ports to native Erlang!). If I had tried to do something more obscure I'm sure I would have had even more problems.

Another key advantage is that there are probably 10x the number of developers ready to hit the ground running on a Node project than there are Go developers, or 50x as many as Elixir or Erlang developers. I don't know if you've tried to do much hiring, but it's hard enough finding developers for a language that's popular. (And no, I'm not counting "front end" JavaScript developers; if I were, I would have said 100x or more.) If you're hiring in an area that isn't highly tech focused, you might not be able to hire a single developer with experience.

[1] https://github.com/zeromq/ezmq/issues/31 and https://github.com/chovencorp/chumak (supports only the "NULL" security framework -- there's a note lower down on the page that Curve isn't supported)

[2] https://github.com/zeromq/erlzmq2

comment 9y ago · link · parent

It's also a rather convoluted set of examples.

If you're doing something in Node that takes nontrivial processing time (that doesn't just involve waiting for I/O), you're Doing It Wrong (tm).

Since the premise of "callback hell" is outdated, the only remaining point is that if you perform complex/time consuming calculations in NodeJS, it slows down.

If you want the most speed, or if you're going to be doing something like a Fibonacci calculation, you should write that (microservice) in Go instead. It's faster from the start (by 2x at least, probably a lot more if you're CPU bound), and GoRoutines can be spread across multiple threads, so a multi-CPU host can take advantage of all of its CPUs.

Oh, and the per-GoRoutine overhead is only about 4K on a Linux host, last I checked. True that Haskell has a smaller overhead per thread, but considering the speed advantage, I think the Go server would still win big on latency for the number of threads that did actually fit in memory.

comment 9y ago · link · parent

I actually can't imaging not using FBA, at least for any product that I want people to buy and that has any competitors.

Amazon Prime free shipping and free returns is a super power. If I'm buying something I'd rather pay a couple dollars more knowing that if something is wrong with it, I can just print a label and throw it back in the mail to return it.

A lot of items are just at that awkward price point where, if they are DOA, they aren't quite worth paying return shipping. And when I buy from Amazon, half the time if something is wrong they'll just send me a new item without even requiring a return. Ended up with an extra 64-ounce "beer growler" because of a faulty lid once. The review system helps enforce good customer service.

I've ordered a lot from Amazon -- and yes, they screw up sometimes. But they're very good about fixing issues.

That said, I'm considering a Kickstarter where I might need to ship out a few hundred posters. Found a local fulfillment house that would charge me $1 for pack-and-ship per item, on top of postage and actual packaging costs. Much cheaper than FBA and, as you point out, less likely to end up with co-mingled items.

comment 9y ago · link · parent

> Why employees in the games industry put up with this sort of thing is frankly beyond me.

They typically don't, forever.

But there's an unending stream of fresh meat entering the game industry who will put up with anything to achieve their dreams of working on video games.

I've been lucky, in that I've done a lot of games, but haven't worked anywhere that routinely required overtime of me. The occasional project here or there would go south, or there would be a bad manager, but other than the last week or two of crunch to get a project finished, I've not done too badly.

1
121314
50