Better HN
topnewbestaskshowjobs
Log inSign up

shortrounddev2

2,427 karma · joined Jun 15, 2023 (3y ago) · 1,641 submissions

Submissions

comment 3y ago · link · parent

A lot of SDKs are just boilerplate HTTP calls with associated Model files. You write an openapi spec and then use tools to generate the SDKs, cleaning them up as necessary

comment 3y ago · link · parent

Yeah we use nestjs decoratos as well, but there's limitations, since the decorators run at runtime.

For example, we wanted to create a Query DTO for our API. It would be a generic class that allowed you to specify the fields you wanted to return in a query, like:

  {
    include: ["Field", "Foo", "Bar"]
  }
You can construct this in typescript like:

  class Foo {
    bar: number | undefined;
    foo: string | undefined;
  };

  class Query<T> {
    includes: Array<keyof T> | undefined;
  };
And use the query like:

  let q = new Query<Foo>;
  q.includes = ["foo", "baz"]; // fail: "baz" isn't in `keyof Foo`;
But since types are erased at runtime, and typescript classes don't work like ES6 classes (which would actually make a hack to support this kind of runtime validation available), you can't validate through an enum on the field, like:

  class Query<T> {
    @ApiProperty({
      enum: keyof T // meaningless at runtime, won't compile
    });
    includes: Array<keyof T> | undefined;
  }
And since Object.keys doesn't work, you can't validate the keys for the object at runtime unless you ditch the generic and just write out the same boilerplate code over and over again with different values for every type you want to be able to query.

Typescript was obviously designed to run in a browser, where it originates data, and not on the backend where it receives data, since input validation is such a chore on the backend.

I don't even want a runtime call for `keyof T` like `typeof`; I just want typescript to compile `keyof T` into an expanded array of strings. I would even settle for a C/C++ style preprocessor macro support. There have been times when I wish I could just log the filename of a function in an error using a preprocessor like in C/C++:

  cout << "Error in file: " << __FILE__ << endl;

comment 3y ago · link · parent

Doesn't work on types, only instantiated objects with values for those keys:

  class Foo {
    foo: number | undefined;
    bar: string | undefined;
  };

  console.log(Object.keys(Foo));      // prints []
  console.log(Object.keys(new Foo));  // prints []

comment 3y ago · link · parent

I use windows as a file server to share media files with my streaming devices

comment 3y ago · link · parent

I don't think we should

comment 3y ago · link · parent

My company doesn't use LLMs for anything, but I like to use it to generate random data for some tools. I have a budget of $20 and have yet to exceed it

comment 3y ago · link · parent

I work full time remote. I don't have to fill out a timesheet

comment 3y ago · link · parent

Discord is more popular because it gives more instant feedback. This makes it far more addictive than forums

comment 3y ago · link · parent

Why did you go back and get a bachelor's if you already had a job?

comment 3y ago · link · parent

I'd suggest getting a job. You'll learn more working than you will in a CS program or working in a silo on your own projects. Personally I never went back to school after getting hired because I hated school so much

comment 3y ago · link · parent

> How many operating systems / IDEs do your developers use?

My company issues everyone a macbook, but we're not required to use them. I don't like Apple or its products, so I choose to use a Windows laptop. I have a coworker who uses Ubuntu. IDEs are up to the user, but we have a jetbrains subscription to use all of their IDEs. Only a few of us do Java on the team, but I use VSCode instead of IntelliJ because I don't like Jetbrains UI design. Other people on the team do javascript/node in VSCode, and SQL stuff in datagrip, while I use dbeaver for database stuff.

> How does your tech stack influence how you manage your dev environments

I try to make everything we do runnable locally. We also host almost everything ourselves rather than paying for managed services. Our data collection pipeline can be run in docker so I created a docker compose file which runs all of our microservices together on a network for testing. Since we do Java and Node, the only real consideration about how to make things cross-platform on our different machines is path separators, which I sometimes run into and always patch when I see non-portable paths (/ characters) being used.

None of what we do relies on shell scripts, so we're free to write whatever we want. I use powershell for some helper stuff and other devs use bash, but not much.

> Do you run all production services or a subset?

The only thing we don't run locally is our logging services, since we just print those to the console. Other than that, any service we need to debug can be run locally (though not always all at once)

> Do you have different dev environments for different kinds of work in the same team? E.g., frontend devs don't need breakpoints in the backend but backend devs do.

Frontend devs need breakpoints as much as backend devs do. But again, we keep our dev environments agnostic of everything except for the build tools. Many of my junior engineer coworkers don't even know how to use breakpoints without me holding their hand. I've written launch.json files for my coworkers so they can attach vscode to chrome to debug react, but I've yet to see any of them use them

> Do you use cloud dev environments are have you stuck with local?

Our local machines are far more powerful than the instances we pay for in the cloud, so we prefer to do development locally. It's also easier to test changes real time with hot reloading than it is to re-deploy over and over again, though my boss tends to do just that.

> What is the size of your team / company

50 employees, 8 engineers

comment 3y ago · link · parent

The problem of fake news and malicious media is not a technological one, but a social one.

comment 3y ago · link · parent

I just want TS to have some kind of RTTI. It would be really cool if you could generate a list of keys on a type or object using `keyof`. It would make typescript significantly better for backend development so that you could automate input validation rather than having to write some kind of swagger annotation on every single field. Would make generics a lot more useful, too.

I know the reasons that they don't do this, but I think without that kind of metaprogramming, typescript and node remain poor choices for backend development

comment 3y ago · link · parent

I was joking dog chill

comment 3y ago · link · parent

I think HN is a madhouse. Any article I click on, there's things I've never heard of that sound like made up techno-jargon, like programming languages which I've never seen used in a real job, let alone met anyone who uses them

But I go to the comments and there's 150 people who all know every intimate detail of this technology already. Experts in the subject.

I think most of you all are faking it

comment 3y ago · link · parent

I have no sympathy for a wealthy couple which decides to derive passive income without providing any value to the world getting booted and having to live with the consequences of their own actions. If they couldn't handle to possibility of losing money on their "investment", they shouldn't have bought the house in the first place

comment 3y ago · link · parent

I found that the larger a company is (Megacorps like amazon and facebook), the worse the hiring process was. More drawn out, more stupid questions, less relevance to the job you're applying for, super duper slow and inefficient.

Smaller companies and startups tend to have much faster hiring processes

comment 3y ago · link · parent

I get tunnel vision when I've been coding for several hours. I'll be stuck on a problem and I'll keep switching back to the same two areas of focus that I've already exhausted. I'll get frustrated because the problem seems totally inexplicable. The other day I was stuck on such a problem at 8pm. My sister in law suggested I just go to sleep, and look at the problem with fresh eyes tomorrow. Doing what she said, I solved the (stupidly simple) problem within 5 minutes of turning my laptop on the next day.

There are SO MANY environmental and physiological factors which go into your state of mind. Some variables that I try to control for:

1. What (if anything) did you eat today

2. How much water did you drink

3. Did you shower today

4. How much sleep did you get, or how long have you been awake (probably the most important one right here)

5. What is the warmth of the light where you are working (is it cloudy and rainy outside?)

6. What is the temperature of the room

7. Is anything else going on in your life occupying your mind right now? If you take medication: did you take your medications?

8. Did you exercise today? Do you exercise at all? Are you healthy?

9. How is your posture?

10. Is your work environment clean? Is it noisy?

11. Do you work better with music on, or in silence?

12. Did you drink so much caffeine that you are now manic and can't focus?

13. Are you happy?

The brain is a part of the body

comment 3y ago · link · parent

7 straight hours of anything will fry me. But most people in the technology field (hell, any field) don't work for 7 straight hours. They work for a couple hours at a time and take breaks in between. I'd be surprised if most office workers do more than 4 hours of actual work a day

comment 3y ago · link · parent

Carmack is definitely atypical
1
5152535455