0

So I created an class diagram according to the assignment, is this the right way to do it ? I am especially not sure about the Column class because it seems to me that it can be just variable.

You are building application that will load data from several different advertising systems and then store the data into database, so it will be possible to analyze them.

You need to take in mind that every advertising system has different structure of report: Different named columns, different order of columns, different date formats Also data from ad systems are in different data formats(JSON,CSV,XML),

Reports from each system contains different amount of columns, our application is interested only in some of them: date, ad_campaing, ad_group, keyword, impressions, price (in every system they have different name)

Logic of advertising accounts is that one ad campaing contains multiple ad groups and one ad group contains multiple keywords.

enter image description here

rtom
  • 585
  • 1
  • 12
  • 26
  • 1
    What kind of class diagram are you supposed to make? A domain model (describing the entities in the problem domain), a conceptual model of the solution (in terms of the concepts the users must know), a model of the software (the classes that are defined in the source code), a model of the target database .... ? – www.admiraalit.nl Oct 24 '16 at 19:21
  • Well, i shoud make object oriented design, this is just easier to read , and every time i posted my question with code and questions about it, it got ignored/downvoted. So I guess it is enough if i know at least if structure of application is good in this diagram. Making an object oriented design from it should just consist of rewriting it into code if I am not mistaken. – rtom Oct 24 '16 at 19:29
  • OK, I will assume you need to make a design model of the software to be made. I will assume the target language is an OO language like Java or C#. I think you will need to design a generic interface for a report and an adapter class for each specific type of report. Each adapter class implements the generic interface in order to load its particular report type. – www.admiraalit.nl Oct 24 '16 at 20:04
  • The language will be PHP. By type of report you mean like format? (CSV,XML,JSON) ? – rtom Oct 24 '16 at 20:27
  • You should read the last paragraph of your work. This seems to be ignored completely. Further, calling a class `*System` is bad design. Everything is 'system'ish. – qwerty_so Oct 24 '16 at 20:56
  • Yea, I kind of ignored it so far, because i am not sure what to do with it. There will be probably another class for `Advertising_account` and ˙ad_campaing, ad_group´ will be arrays. – rtom Oct 24 '16 at 21:03
  • PHP ?? I thought PHP was used to create dynamic web sites, not to create batch applications for loading report files into a database. By report type I mean file format plus column name mapping (in other words: each advertising system has its own report type). – www.admiraalit.nl Oct 25 '16 at 07:31

1 Answers1

1

I assume you need to make a class diagram to model the source code to be written using an object oriented language. I think the best approach is to create an adapter class for each specific type of report (i.e. for each distinct advertising system). Each adapter class implements a generic interface (or abstract base class) in order to load its particular report type. Here is my diagram. I have drawn three adapters, but there could be more or less.

enter image description here

If you expect that multiple ad systems deliver data in a common format, e.g. CSV, while only the column names differ, then you could create a generic CSV_ReportLoader which reads the column name mapping from a configuration file (or configuration object).

www.admiraalit.nl
  • 5,768
  • 1
  • 17
  • 32
  • I tried to transform It into code and I came up with few questions. This is my first OOP project, so I am not really sure what should be my goal when building OOP project, because if we account only for functionality then it doesn't look that hard... Okay but, with your approach you must create a new class for every new Ad_system(in my solution you needed only to instantiate a new object), also `loadAdData`will have probably same implementation in every class, so wouldn't it make sense to implement it in `ReportLoader' and inherit it from there. – rtom Oct 25 '16 at 15:29
  • I don't know if I am looking at OOP wrong, but for example, with my solution you have a class that can find you format of your data(if its JSON,XML,CSV), isn'ť it better that way ? you know so that class can be reused later ? Because I think that it should be broken into smallest pieces so individual part are reusable, shouldn't it be like that ? – rtom Oct 25 '16 at 15:31
  • Data from ad systems are in different data formats (JSON, CSV, XML). – www.admiraalit.nl Oct 26 '16 at 06:54
  • Data from ad systems are in different data formats (JSON, CSV, XML) and have different names for same things. This implies that the function to load data from one ad system cannot be reused to load data from another system. With my approach, if you need to support a new ad system in the future, you only need to make a new class derived from ReportLoader that implements the specifics of that particular ad system. Since it implements ReportLoader, it can be plugged in easily into LoadAdsApplication. – www.admiraalit.nl Oct 26 '16 at 07:01
  • If there are multiple ad systems delivering data in a common format, e.g. CSV, you could apply reuse by creating a generic CSV_ReportLoader, reading the mapping of adsystem-specific column names to standard column names from a configuration file. If that is what you mean, then you are right. – www.admiraalit.nl Oct 26 '16 at 07:04
  • A generic class that automatically detects the format of the input data and acts accordingly, would be a complex class, which implements all possible formats. If a new ad system would have to be supported, which delivers data in yet another format, then this complex class would have to be extended, with possibly unintended side effects. In my approach however, you could just plug in one extra simple class. – www.admiraalit.nl Oct 26 '16 at 07:10