In pointer arithmetic, if you do arithmetic (addition, substraction, etc.) on the pointer, the compiler auto scales that aritmetic by the size of the data type the pointer points to: int *p = (int*) 100; p++; printf("%d", p); // p becomes 104, because sizeof(*p) = 4 Auto scaling is why you don’t give any mind to the size of data types when traversing arrays, and so on. If you did have to mind the size of data types, traversing an integer array (without autoscaling) would look like so: ...
Data Transfer Objects
Data Transfer Objects Models define how data looks at storage (rest) DTO (Data Transfer Object) defines how data looks in transit. It is a contract of how data is shared between different layers (frontend and backend, controller and service, etc.) of an application. Between client and server, DTO contracts can be shared as OpenAPI specfication. components: schemas: UserDTO: type: object required: - id - displayName - email properties: id: type: string format: uuid displayName: type: string email: type: string format: email then, the frontend and backend use this contract to make sure their data structures match perfectly. ...
GraphQL
GraphQL GraphQL works as such: server defines a schema (shared contract) in a SDL (Schema Definition Language) including the DTO (types) and queries that use these DTO (types) as parameter and return types. server implements the queries using resolvers. GraphQL throws error if resolver doesn’t return data with type defined in the query. the client writes a query requesting specific fields it needs. if it’s query signature doesn’t match exactly to type defined in the server, GraphQL engine throws an error. It’s easier to enforce this type safety if you use code generation tools for producing interfaces from the server type definitions. One of the biggest advantages of GraphQL is client-specified queries. The client can request for only the data it needs from the data it can return from the query. It breaks down to 3 simple rules: ...
Hello
First Blog Hello, this is my (srj’s) blog. I’ll be posting whatever I’ll be learning here. If I’m wrong somewhere, you can kindly inform me of what I’ve got wrong via my mail. I’m excited to be sharing my blogs with the world. See you soon.