• 0 Posts
  • 18 Comments
Joined 1 year ago
cake
Cake day: June 5th, 2023

help-circle










  • Access control and offering a sound interface.

    You don’t need getters and setters if every attribute is public, but you might want to make sure attributes are accessed in a specific way or a change to an object has to trigger something, or the change has to wait until the object is done with something. Java just has tools to enforce a user of your objects to access its attributes through the methods you designed for that. It’s a safeguard against unintended side effects, to only open up inner workings of a class as littles as necessary.

    In a language without something like private attributes you’d have to account for far more ways someone might mutate the state of objects created by your code, it opens you up to far more possible mistakes.









  • https://jsommers.github.io/cbook/cbook.pdf

    Might be a good way for someone who is familiar with a higher level language.

    Than there is of course “The C Programming Language” by Ritchie and Kernighan and “advanced programming in the unix enviroment” by stevens and rago.

    So, i’d guess just get your feet wet with small stuff. Find out how to take arguments from the command line, or read a file, maybe programm a simple guess the number game. After you are more familiar with the syntax and so on you could look into using your c code in a higher level language. For python you’d have to look into ctypes for that.