xthrowawayxx
I agree there will have been lots of progress. However, 30 years from now people will probably say that the same thing to excuse todays predictions if they were wrong.
Genuine question. How many climate predictions from 30 years ago came true today?
Just use the language people!
Writing 3 LOC instead of 1 call to an external package is OKAY.
How did their ruling infringe on the separation between church and state?
Can you give an example of this?
My guess is probably more statements 2 and 3 for the usual suspects eg Stanford
sorry about that
Have a trusted third party transfer it back to you? Or give up your house to the hacker?
Is there something I'm missing? Even the above examples look awful to me
Eg throw out eslint and prettier.
Edit: I've found this consistently building multiple data processing applications over multiple years and multiple companies
I still use many static functions
Sounds like it's inferior to manually using a DataLoader within every resolver that fetches an object.
eg project has a client. In the resolver for a projects client, you fetch the client from DB. With DataLoader you manually cache the request for the client. With in-built caching you must resolve the client for the server to know the ID, and then on next resolve of the client, after fetching, it matches the ID and doesn't have to resolve it's fields again, but it still had to fetch both times?
How do GraphQL servers automatically cache objects? I was not aware servers do this. I generally avoid them because of their inflexibility (eg. Unable to support the two websocket subscription sub protocols simultaneously).
> type GetProject = (...) => ... > type ProjectCRUD = { get: GetProject, set: ... }
> constructor(private projectCrud: ProjectCrud)
Yep that is a more concise way of doing the same thing. I've considered that approach and it seems perfectly reasonable, even cleaner. The only reason I haven't is because constructors offer a more standardised approach to object creation for service type objects that other developers are familiar with, rather than higher order functions or function constructors. Although my method is kind of bespoke anyway so I could go either way. Another advantage of your approach is composing finer grained functions or objects with methods into more expansive services becomes delightfully easy.
>[1]: https://news.ycombinator.com/item?id=31547975 - I'd love to hear opinions on that.
I've tried to use TypeScriot DI containers... Oh I've tried.. But eventually they all just feel gross.
These days I'm perfectly happy having a bootstrap / createServices method for the application, or with multiple entry points each requiring a subset of services with different configurations, different create<command>Services functions. Works well for CLI apps. Downside is when there are too many entry points with different depenencies, like an HTTP API, you don't want to create a bootstrap method for each entrypoint. In this case I create all services once on bootup. I pass the request context as method argument. Don't have a perfect way yet of doing request-level services like GraphQL caching. Currently I lazy load request level services on request context.
An ISaveable interface would need to be generic but "save" functions might take different numbers of arguments, and of different types.
I've found the advantage of interfaces to be dependency injection, where i can inject a different implementation of an interface without breakijg anything (eg save to s3, to google cloud storage, to filesystem, to memory), or a test version of the function/class.
Abstractions like ISaveable on the service interface just make the code more fragile in my experience in an attempt to save some extra but simple lines of code. Granted it may make sense on active record model classes though.
interface IHasSaveProject {
saveProject(...): ...
}class HasSaveProject implements IHasSaveProject {
saveProject(...): {...}
}class Controller {
constructor(private readonly IHasSaveProject) {}
post(...) {
this
.hasSaveProject
.saveProject(...)
}
}And basically have a different class for every function
In cases where it really makes sense to have multiple methods on a single class, I do this
interface IProjectService extends IProjectService.IHasGetProject ,IProjectService.IHasGetProject {}
namespace IProjectService {
export interface IHasGetProject {
getProject(...): ...
}
export interface IHasSaveProject {
saveProject(...): ...
}
}class ProjectService implements IProjectService {
getProject(...): {...}
saveProject(...): {...}
}class Controller {
constructor(private readonly projectService: IProjectService) {}
// or
// constructor(private readonly projectService:
// IProjectService.IHasGetProject
// & IProjectService.IHasaveProject) {}
// or
// constructor(
// private readonly hasSaveProject: IProjectSercice.IHasSaveProject
// private readonly hasGetProject: IProjectSercice.IHasGetProject
// ) {}
...
}Seems to be working well for me. Lots of flexibility. Not sure how others like it though.
Please forgive my formatting
Nobody told i3en's have "ephemeral storage" that gets wiped on shutdown.