Programming

Yeah as far as I’m aware it is not possible to declare a Queue constrained to that particular type, because of the half assed way generics were nailed onto Java

Here’s what this looks like in my world:

function doThing(req) {
    bot.execute(req)
       .then(req, res) => console.log('success!')
       .catch(req, res) => console.log('boo, error!')
}

Or now with async await:

async function doThing(req) {
    const res = await bot.execute(req)
    console.log('success!', res)
    // I can use try catch here if I want
    // but I'd usually rather just throw it 
    // and deal with it all in one place 
    // vs. redundant failure code everywhere
}

Or with express:

middlewareChain = [startThing, doThing, doOtherThing, finishThing];

function startThing(req, res, next) { req.addSomeInfo = 'this will be needed to make the API call'; next(); }
function doThing(req, res, next) { (I make the API call); next(); }
function doOtherThing(req, res, next) { res.addSomeInfo = 'I am adding stuff to the response'; next(); }
function finishThing(req, res, next) { (I make things pretty); next(); }

And I’m sure there’s an even slicker node framework out there that uses async/await. I just haven’t needed to try it because all my node is in AWS lambdas now.

Does it hurt your soul to see me just tacking things onto objects willy-nilly? I agree it might be a bad idea for Facebook or Netflix. But we ran it in production on a pretty serious app with over 100 different pages - all making different request/response chains - and it was fine. It’s still running afaik.

Now if all you want to do is make a quick and dirty bot? I just don’t see how types make things easier. Remember I have a lot of experience in both worlds.

I’ve now written my bot in 5 minutes while the C# and Java guys are still debating what toppings to get on the pizza for the all-night meeting to hash out the best inheritance/factory structure.

1 Like

How can the same type be parameterized on itself? I must be at the nexus of the universe!

image

Lol my boomer boss is being forced into scrum. He uses google docs to manage our projects currently.

All new upper mgmt and new project managers

Gonna be miserable/hilarious.

1 Like

Look at the definition of the Enum class in java.

public abstract class Enum<E extends Enum<E>> implements Constable, Comparable<E>, Serializable {

1 Like

image

3 Likes

Agree 100% and I say this as someone who’s written jave code for 15 years.
Where you want to use java is when you need something that’s 50-100% as fast as C/C++ but want a language that easier to work with and more forgiving and something with nicer build tooling by default. (Think maven/gradle vs make et al.) And no platform lock in (C#).

Also there’s scala if you really want to not have manifest typing. Many of our projects at work are a mix of java and scala code.

.NET Core (or I think they’re just calling it .NET now) runs on Windows, Linux and macOS.

No, I’m fine with dynamic typing, just depends on your use case.

it is going to be absolutely hilarious, unless I get laid off, but I’d probably still find a way to laugh.

It sucks but the reality for most/all large corporations that business plans (the stuff where people with $$$ allocate budgets and stuff) are made on yearly basis with quarterly increments. So you end up with something that is waterfall in essence but using agile terminology and ritual.

Personally, I’ve realized that it’s all performance theater for the most part and thus doesn’t really bother me anymore.

1 Like

The trick is to not care so much. Seriously lol. Some things are just beyond your control. You can get frustrated by it or try to go with it.

I’m probably gonna be screeching about it in a few months though

1 Like

Any suggestions for cool ish I can do with a Raspberry Pi CM4? I have an external NVMe drive housing with a 256gb drive ready to go. Its a 8gb ram with like a 128gb internal drive.

Yea it’s really easy to set up in gcp. You basically just put in your code and go.

As with most things gcp vs aws, aws will be much harder to set up (you need to configure gateways and stuff) but ultimately provides you more choice and flexibility. For instance I believe aws lambda offers more programming languages.

If it’s a very simple service (sounds like it is) you want a cloud function, app engine is for more complicated services/applications and might be overkill.

Tbh though I’ve not played much with any of these services.

1 Like

We use GCP at work. My ML Plats team is nice and set it up for us, fairly impressed so far

1 Like

Cloud Functions is what you think. Also look at cloud run. It will scale containers from 0-infinity. You pay when your RPC is running. Avoid app engine.

1 Like

This might get buried in the LC thread. But I thought programmers specifically might be interested in this, specifically how he claims maximizing flow state is one of the primary forms of happiness.

Here’s my LC post about how being a computer programer apparently makes me happy because of the flow state.

I’ve been thinking about this video a lot since I watched it.

Counterpoint: I find it very easy to slip into flow when writing code, but coding makes me absolutely miserable. For example, I want to murder puppies right now because MouseEvent.movementX/Y is behaving very differently in Chrome vs Firefox and I have no idea why. But the past couple hours sure did fly by while I failed to figure it out.

1 Like

I feel that way with CSS. But everything else I get to flow state pretty easily.

mouseMove (e) {
  moveThing(e.movementX)
}

Firefox: :+1:
Chrome: :crazy_face:


mouseMove (e) {
  const newX = e.offsetX - this.currentX
  moveThing(newX)
}

Firefox: :+1:
Chrome: :+1:

Flow!

Most of the time i spend “programming” is reading hundreds and thousands of lines of configurations which honestly is as boring as it sounds. I get a little giddy when a task requires some scripting or other work that requires a bit of programming.