Die Suche ergab 61 Treffer

von imaier
12. Feb 2014 09:08
Forum: Archiv
Thema: Ex10: HTML Document without h1?
Antworten: 6
Zugriffe: 1091

Re: Ex10: HTML Document without h1?

Here is a hint: whenever you want to avoid using a boolean flag, try to find some other state from which you can infer the true/false state that you want to express with your boolean value (the size of a collection/isEmpty is a common candidate).

Cheers,
Ingo
von imaier
11. Feb 2014 12:27
Forum: Archiv
Thema: Ex10: HTML Document without h1?
Antworten: 6
Zugriffe: 1091

Re: Ex10: HTML Document without h1?

No, you can't assume that it starts with an h1. It is really easy to solve this without complicating the code much (a single if then else) if you structure it well.

What is a plain HTML document?

Cheers,
Ingo
von imaier
11. Feb 2014 12:13
Forum: Archiv
Thema: Ex10 - Canvas fillEllipse()
Antworten: 1
Zugriffe: 414

Re: Ex10 - Canvas fillEllipse()

In retrospect, I think it might be too difficult if you don't have the math at hand and this exercise is really more about design patterns. So no, you can delete it.

Cheers,
Ingo
von imaier
11. Feb 2014 12:00
Forum: Archiv
Thema: Ex10 - why should "indent" call "newline"?
Antworten: 1
Zugriffe: 423

Re: Ex10 - why should "indent" call "newline"?

In the code template, the indent method will also automatically add a newline, yes. This makes sense for the given use case. Moreover, your SourceCodeBuilder doesn't have to be bullet proof, and you are of course open to change the implementation slightly. It is meant to be an internal support class...
von imaier
11. Feb 2014 11:52
Forum: Archiv
Thema: Ex10 - Problem with Header, Footer and DocType declaration
Antworten: 1
Zugriffe: 534

Re: Ex10 - Problem with Header, Footer and DocType declarati

I agree that the names for addHeader and addFooter might not be the most fortunate ones, but I see that you figured it out already. Concerning adding elements to the header, you do not need this in this exercise. For the result methods, they should return the results and are allowed to "close" the b...
von imaier
7. Feb 2014 20:05
Forum: Archiv
Thema: REScala - Strange behaviour
Antworten: 2
Zugriffe: 535

Re: REScala - Strange behaviour

There really is a difference between floating point division and integer division (e.g., since they follow/approximate different mathematical laws). Most languages unfortunately do not distinguish between the two and overload the same / operator. In Java, from which Scala inherits its arithmetic exp...
von imaier
6. Feb 2014 16:55
Forum: Archiv
Thema: Practice Exam
Antworten: 1
Zugriffe: 463

Re: Practice Exam

One more thing, due to a few people who missed the previous session: we will quickly discuss potential solutions of the practice exam in the next exercise session.

Cheers,
Ingo
von imaier
6. Feb 2014 16:48
Forum: Archiv
Thema: Practice Exam
Antworten: 1
Zugriffe: 463

Practice Exam

Hello everyone,

if you wrote the practice exam, you can collect it at my office S202 A216 on Monday between 14-16h or in the next and last exercise session.

Cheers,
Ingo
von imaier
5. Feb 2014 17:32
Forum: Archiv
Thema: Ex09: Decorator vs. Visitor
Antworten: 8
Zugriffe: 1943

Re: Ex09: Decorator vs. Visitor

Please think about what you asked again. I am sure that you can answer it on your own. If not, read on... You can answer this question from multiple angles: 1.) The sheet says use immutable objects. Storing total prices in decorated objects is hence not possible, since at least at the point of their...
von imaier
5. Feb 2014 15:50
Forum: Archiv
Thema: Ex09: Decorator vs. Visitor
Antworten: 8
Zugriffe: 1943

Re: Ex09: Decorator vs. Visitor

No, the first one is not a good format for obvious reasons. In order to avoid printing all subtotals you have to find a way to get the price and calories from the fully decorated pizza plus visit all its toppings. In order to do so, you have to distinguish between visiting a (topped) pizza and visit...
von imaier
5. Feb 2014 09:23
Forum: Archiv
Thema: Ex09: Decorator vs. Visitor
Antworten: 8
Zugriffe: 1943

Re: Ex09: Decorator vs. Visitor

I wasn't aware that mixins are called static Decorators on the slides. Thanks for the pointer. So no, please use the traditional Gamma/GoF style decorator, i.e., the one you can also implement in Java using explicit forwarding (or delegation). That being said, mixins are of course a viable alternati...
von imaier
4. Feb 2014 22:10
Forum: Archiv
Thema: Ex09 Curious: Hawaiian Pizza less calories than Margherita?
Antworten: 4
Zugriffe: 652

Re: Ex09 Curious: Hawaiian Pizza less calories than Margheri

Yes, indeed. There is a hint in the exercise description that you don't have to "reverse engineer" pizza names. Because you can't. In other words, Hawaiian Pizza is not the same as Margherita plus ham'n pineapple. Most likely explanation is that the amount of toppings differ.

Cheers,
Ingo
von imaier
4. Feb 2014 15:53
Forum: Archiv
Thema: Ex09: Decorator vs. Visitor
Antworten: 8
Zugriffe: 1943

Re: Ex09: Decorator vs. Visitor

It's not really an either-or question, of course they can coexist. While there is only one way to calculate calories and prices (if you really want to, we can argue about the latter but not about the former), there is no one single true receipt format. For example, there are many ways how to print t...
von imaier
4. Feb 2014 09:25
Forum: Archiv
Thema: Ex09: Splitting the visitor?
Antworten: 4
Zugriffe: 851

Re: Ex09: Splitting the visitor?

No, that implementation is not *needed*. As I said earlier, you have to decide where to put your traversal code, either in the accept methods, i.e., the tree structure, or in the visit methods, i.e., the visitor. Generally you should decide for one and not mix both. And yes, both of these forms coun...
von imaier
4. Feb 2014 09:06
Forum: Archiv
Thema: Ex09 - Library workflow
Antworten: 2
Zugriffe: 483

Re: Ex09 - Library workflow

@Asfaloth: you don't have to implement anything that is not mentioned on the sheet. You can assemble an order simply by using the constructor of the order. @L4_: You can also rename invoke to accept if you want, I should have done that in the first place. Why would you not want to pass other visitor...

Zur erweiterten Suche