Better HN
topnewbestaskshowjobs
Log inSign up

zanethomas

469 karma · joined Sep 25, 2014 (12y ago) · 281 submissions

zane.thomas@gmail.com
Submissions

comment 2y ago · link · parent

The difference in performance is negligible for all but the most demanding applications. In which case I would still use factory functions, but just be more careful.

comment 2y ago · link · parent

Fair points. I do use classes exposed by libraries. I don't like it but it beats the alternative.

I really like the flexibility of factory functions, that is the main point of the article imo.

COM/OLE ... that takes me back to the early 90s, a place I hoped to never visit again!

:)

comment 2y ago · link · parent

closures can encapsulate state and methods classes are syntactic sugar

emulating classes is, imo, exactly the problem

using factory functions which create and return an object, with variables passed to and created in the function, handles encapsulation

and there is no `this` to deal with

comment 2y ago · link · parent

Does it compile something like this into a c++ class?

makeThing(options, usethistoo) { let foo = options.foo; let thistoo = usethistoo;

  return {
    functions...
  }
}

comment 2y ago · link · parent

:)

I started with 6800 machine language. Then c, smalltalk, scheme and etc.

Rather than spend a lot of time and botch a comparison between classes and factory functions I'll link you to an article.

He went further, introducing something he calls stamps, but I found them to be awkward the only time I tried to use them.

https://medium.com/javascript-scene/javascript-factory-funct...

comment 2y ago · link · parent

I wonder why it seems natural to you? I'm guessing JS wasn't your first language and you didn't learn the power of composition instead of classes.

comment 2y ago · link · parent

Sure, but imo unless one is creating very many objects each with their own set of functions it's not really a significant issue.

Sometimes programmers spend way too much time optimizing code which doesn't really need it.

In my experience how data is structured is almost always the most important factor when it comes to performance.

Good data structure + simple code === performance.

comment 2y ago · link · parent

I know, right?

Fortunately we can still aren't forced to use all the 'enhancements'.

comment 2y ago · link · parent

I don't understand the need for the ever-growing list of "enhancements" to JS. Take Class for example.

Class is entirely unnecessary and, essentially, tries to turn JS into a class-oriented language from its core which is object-oriented.

I never create classes. I always create factory functions which, when appropriate, can accept other objects for composition.

And I don't use prototypes, because they are unnecessary as well. Thus sparing me the inconvenience, and potential issues, of using 'this'.

In my dreams those who want to turn JS into c# or Java should just create a language they like and stop piling on to JS.

But, at least so far, the core of JS has not been ruined.

That said, there are some new features I like. Promises/async/await, Map, Set, enhancements to Array being among them. But to my way of thinking they do not change the nature of the language in any way.

comment 2y ago · link · parent

The web became trashed over a decade ago.

comment 2y ago · link · parent

The web became trashed over a decade ago.

comment 2y ago · link · parent

Because they chose it as a career and not because they love it?

comment 2y ago · link · parent

Hmmm, odd. I was under the impression they used cosine similarity based on page content. Once upon a time, based on that 'memory', I created a system to bin domain names into categories using cosine similarity. It worked surprising well.

Regardless, well done!

comment 2y ago · link · parent

Isn't that Google's original algorithm?

comment 3y ago · link · parent

Don't use it, don't care.

comment 3y ago · link · parent

I knew a woman who in 1970 was pulled over by the police in Altadena CA. They were particularly aggressive when it came to "hippies" and so she swallowed her entire cargo of LSD, which was, iirc, somewhere in the neighborhood of 20 hits.

She was out of commission for roughly 72 hours and months later still not back to normal, according to what she told me.

comment 3y ago · link · parent

is the code on github? if not i'm not going to touch it :)

comment 3y ago · link · parent

strange that a constitutional amendment was required to ban alcohol, but none was required for other drugs

comment 3y ago · link · parent

Martial artists train to 'fight' within a constraining set of rules. In a real fight there are no rules.

comment 3y ago · link · parent

Most martial arts are worthless in a real street fight.

comment 3y ago · link · parent

I would be very unhappy with a suggestion to replace javascript. I like that I can mix functional, object-oriented, and procedural type code where each seems to be the best fit.

If something else comes along, gains a lot of traction, and develops its own ecosystem then javascript could conceivably eventually just fade into the background. But that's going to take time.

comment 3y ago · link · parent

I've only briefly looked at wasm and haven't used it at all so I can't recommend anything.

comment 3y ago · link · parent

I'm quite happy with javascript as it is but I understand you might prefer other languages.

I haven't had occasion to use wasm but it seems that it provides the ability to run most (all?) languages in the browser.

Here, for example, is f# wasm.

https://fsbolero.io/

comment 3y ago · link · parent

In the early 90s I was working in downtown Seattle. The manager of the project I was on was married to a product manager at Microsoft. One morning he showed up with a beta copy of VB 3.0.

There was a young, brilliant, programmer, James Shields, who was my partner working on a project. We took one look at VB3 and both immediately saw the potential of vbxes.

At lunch we came up with a couple of initial ideas for custom controls, wrote them, and began selling them on Compuserve for $5 each.

Soon I wrote some controls for working with the just-released Sound Blaster card, which gained some interest on Compuserve's music-related forums, I actually traded messages with Jerry Garcia one night.

But our first big hit was Message Hook which I wrote to overcome some of the limitations of using the Windows API when using VB. That lead to Mitch Waite (publisher of many popular computer books in those days) contacting me to revise the Visual Basic How To. The result was the Visual Basic 3.0 How-To, which was almost all entirely new material.

My approach to writing that book was to think about the things that one would want to program in Windows apps but could not easily accomplish with Visual Basic ... and to solve those problems. Message Hook featured heavily, a copy was included with the book's diskette.

Soon enough the internet came online and I wrote a number of internet controls which allowed thousands of Visual Basic programmers to add, primarily, email and ftp to their programs, however there were controls for more obscure protocols as well.

Visual Basic 3.0 was magic! It was an entirely new idea and several companies, including Mabry Software which was founded by me and my programmer buddy, had a good business until .net blew up the entire ecosystem.

I think it's probably fair to say that VB 3.0, and our internet controls, made a significant contribution to the evolution of the internet.

comment 3y ago · link · parent

This might be a previously unknown bit of NeXT and Windows history.

While Windows 3 was in development I was in the next building working on os/2. (not bragging <g>)

I spent a lot of time in a lab that had a lot of hardware. One day a NeXT machine showed up in the lab.

The next day there was a line of Windows developers waiting for their chance too look at it. (we'll forget the fun I had grabbing a screen shot of the desktop which i then left displayed full screen)

It was a mere matter of days before a build of Windows with 3d buttons came out, and the rest is more history.

comment 3y ago · link · parent

Sounds like what you really want is c#.

comment 3y ago · link · parent

Elon seems to fail to recognize that he's well-down the slope Yoel et al were down.

comment 3y ago · link · parent

I'd like to thank everyone for the input received thus far and the future feeback to be received. It is very much appreciated and will be given very careful consideration!

29.

Ask HN: How does an old timer find contract work

81 points · by zanethomas · 3y ago · 46 comments

12345
10