• Announcements

    • khawk

      Download the Game Design and Indie Game Marketing Freebook   07/19/17

      GameDev.net and CRC Press have teamed up to bring a free ebook of content curated from top titles published by CRC Press. The freebook, Practices of Game Design & Indie Game Marketing, includes chapters from The Art of Game Design: A Book of Lenses, A Practical Guide to Indie Game Marketing, and An Architectural Approach to Level Design. The GameDev.net FreeBook is relevant to game designers, developers, and those interested in learning more about the challenges in game development. We know game development can be a tough discipline and business, so we picked several chapters from CRC Press titles that we thought would be of interest to you, the GameDev.net audience, in your journey to design, develop, and market your next game. The free ebook is available through CRC Press by clicking here. The Curated Books The Art of Game Design: A Book of Lenses, Second Edition, by Jesse Schell Presents 100+ sets of questions, or different lenses, for viewing a game’s design, encompassing diverse fields such as psychology, architecture, music, film, software engineering, theme park design, mathematics, anthropology, and more. Written by one of the world's top game designers, this book describes the deepest and most fundamental principles of game design, demonstrating how tactics used in board, card, and athletic games also work in video games. It provides practical instruction on creating world-class games that will be played again and again. View it here. A Practical Guide to Indie Game Marketing, by Joel Dreskin Marketing is an essential but too frequently overlooked or minimized component of the release plan for indie games. A Practical Guide to Indie Game Marketing provides you with the tools needed to build visibility and sell your indie games. With special focus on those developers with small budgets and limited staff and resources, this book is packed with tangible recommendations and techniques that you can put to use immediately. As a seasoned professional of the indie game arena, author Joel Dreskin gives you insight into practical, real-world experiences of marketing numerous successful games and also provides stories of the failures. View it here. An Architectural Approach to Level Design This is one of the first books to integrate architectural and spatial design theory with the field of level design. The book presents architectural techniques and theories for level designers to use in their own work. It connects architecture and level design in different ways that address the practical elements of how designers construct space and the experiential elements of how and why humans interact with this space. Throughout the text, readers learn skills for spatial layout, evoking emotion through gamespaces, and creating better levels through architectural theory. View it here. Learn more and download the ebook by clicking here. Did you know? GameDev.net and CRC Press also recently teamed up to bring GDNet+ Members up to a 20% discount on all CRC Press books. Learn more about this and other benefits here.
Sign in to follow this  
Followers 0
Structural

Separating logic/features from data/domain

4 posts in this topic

Hi all,

 

my colleagues and I are having a recurring discussion about separation of functionality/logic.

Personally my view (and perhaps I am stuck in this way of thinking) is to separate data/domain and algorithm/functionality. And I notice I'm quite a purist in that.

My colleagues on the other hand tend to put the functionality over multiple classes that I would consider "data"-classes, or domain classes.

 

More concretely, we are now implementing a user story that aligns images, grouped by date and image series. 

My natural tendency, first reflex, is to start making an ImageAligner class in which I'd implement that feature, using the domain/data. This would have all the "algorithmic" stuff needed for the feature, like grouping by date etc etc, including the alignment logic.

The application would then instantiate that ImageAligner and it would listen to the data/context and do its stuff.

My colleagues argue on the other hand that the ImageAligner class is not needed. They claim it would be fine to put parts of the feature into the domain objects. The feature would be implemented through the collaboration of these domain classes.

One of their other arguments is that, because my solution looks like a strategy pattern, it adds just more complexity. They would even say it's over-engineered. Whereas I find it simpler because it isolates the feature in one place, making it easier to find and modify. 

 

I'm having a hard time convincing them (and they me). Mainly because what I see as domain/data objects, they consider to be functionality/feature classes. Also I have had some very good experiences in the past separating logic and domain in this way, making it hard for me to let go of this pattern of thinking.

Do you strictly separate algorithms/features/logic from domain/data in separate classes?

What would be arguments for choosing the one or the other design? 

Or am I just stuck in an odd way of thinking?

Penny for your thoughts.

1

Share this post


Link to post
Share on other sites

I would agree with you.  In my experience, something that manipulates the data in only a way that the user will see, should not be part of the data code.  becuase you could create your code as a library of business logic, and then have the UI managed separately.  I.e.  There should be nothing about business logic that can't be tested with an application only calling on commands presented.  The UI, which I assume ImageAligner class is for, is best in the UI project, or more of a UI based layer.  MVC & MVVM both go that direction, and are fairly popular.  not an end all be all though. 

 

However, if your application is a stand alone app with no intention of ever upgrading to new UI technologies, then sure, throwing your UI code in with your data management is fine.  But try convincing the business side that choosing this development model is better, because it prevents us from improving our technology later.  (at least makes it more difficult.

 

I'm presuming I understand what you are expressing, but my apologies if not.

0

Share this post


Link to post
Share on other sites

Not exactly sure if I follow you on this one but I think I would agree at least to a point.  It's normally my practice to take a more "entity object" related approach with static manager systems.  That is to say that things like the "Story" would be it's own object wherein it would contain the image sets, descriptions and all other pertinent data related to the "story".  The Manager object I would use would handle the logic of listing and grouping and what not (and it would be static which might help your side of the debate).  To me, it seems that your partners are concerned about the instantiation of objects that have minimal code effect on the page (which I to struggle with sometimes).  That is to say that basically they don't want to instantiate a new instance of a class just to call one function on it.  To them maybe this adds an additional layer of complexity in that you need to know when and how to instantiate this object.  This tends to come from coders more used to procedural coding wherein a function is a function and when you need to pass large argument sets you would do so as a reference or instance of some structured object (such as a struct or class).

 

Anyway, I don't mean to try and psycho-analyze the team or the positions.  My point here is that maybe you can meet somewhere in the middle through well designed use of data objects and static manager like systems for the logic end.  This allows you to get your way and separate the logic into it's own class object and the data into their own objects while only requiring a slight difference in the way your team members may be thinking.  From what I gather, they seem to want to just plug some more logic into existing systems to limit the lines of code needed to create a new object and call a single function on it.  You both get your way when it's static, the logic is separate and it's still only one line of code to call negating the need for instantiation.

 

P.S.

  Not sure if this is appropriate or helpful in any way but I tried.  Hope it at least gives some ideas of compromising talks to get you all back to work.

0

Share this post


Link to post
Share on other sites

I would actually agree with your colleagues given the context. Making an additional class to handle very specific functionality seems a waste of space and indeed increased complexity with no real return other than easier to 'mind map'. If, however, you were to make a generic data class, which is expanded upon to become the derived class image, then having a class which handles alignment from the generic data makes sense.

For your example though this wouldn't make a whole lot of sense because each piece will likely be very different.

An example would be in a rendering engine, sure the renderer takes care of the all the generic stuff but then your model class typically is derived from a base class that has a mandatory override function of 'render' which contains the specific logic to render itself. What you're suggesting may well need a class that handles the alignment/drawing/placement whatever of very many things which makes calling renderObjectType41(thisIsAnObject) not as pretty as you may have hoped.

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0