• Content count

  • Joined

  • Last visited

Community Reputation

130 Neutral

About CazHouse

  • Rank
  1. Recommended approaches to Data Handling?

    Awesome feedback man. I really appreciate it. This is exactly the kind of thing I was looking for. I can see though how it is a little overkill for the simplicity of the projects I am working on now, but I will start using it where I can as my projects grow larger. The hardest part for me so far in understanding it is what "services" are worth providing with this method. The article explains that to some degree but I want to make sure I don't go crazy with it and over use it either.
  2. My Question: HOW do I efficiently collect data and keep it updated for later reference?   My Programming Background: I am very new to programming and have chosen C# as my first language. I have been reading about it, watching tutorials, getting time behind the keyboard, and have been moving along pretty well. This has been over the last 6 months or so and I have (for the last month) been working on my first project. I am almost done with creating Pacman as my first attempt at something and it turned out better than expected.    My Problem: Looking back on my first (almost) completed project I was able to see a lot of places where my code was messy, and where data was either poorly passed or poorly maintained. I found that there are a lot of variables and values that I want to keep track of throughout my project because they are referenced deep in my code or referenced often throughout a class. Some examples are Screen Dimensions, Mouse Bounds, Player Position, etc. These values, so far, are pushed deep into the code through parameters and method calls and stored where they are needed. This seems cumbersome and poorly designed. I know that Delegates can be helpful in keeping values updated in other classes, but I am still confused as to how you get a delegate deep into a class hierarchy without having to reach all the way down and place it there just like placing the value itself to begin with.    I feel like maybe having a static class that doesn't need to be passed or instantiated can help hold the data. If I keep that up to date I can just pull out those values wherever I want. I am not sure that this is practical, or ever possible the way I want to use it. I am really looking for better options or some guidance here. I have done a lot of research and have not found anything that helps me so far.   To make this even simpler, lets just discuss the first step; getting data from all over my project into 1 class without coupling, heavy parameter passing, and so on.   Say i want to make a class that displays all of my values that I am testing out on the screen. It shows mouse bounds (updated in an input class), player position (updated in an actor class), map position (updated in the level system), etc. These values that I want are scattered throughout my code. Some classes I want info from are deeply nested in other classes.