Mostly Java & Java methodologies Flashcards
How would you describe the Waterfall methodology
as a linear, sequential approach, where each phase depends on the completion of the last
What are the steps?
Reqiuirements, Design, Implementation and Verification
What are the steps for Agile?
Requirements, Design, Implementation and Verificatipon then ITERATION (important) over next section of the app
Three stages of iterative and Incremental Agile
Initialization(base version), project control(kind of like product backlog, contains record of all tasks) then iterate (Inception, Elaboration, Construction, Transition)
Extreme Programming basic activities:
Coding, Testing, Listening, and Designing
XP: Little testing can eliminate but….
A lot of testing can eliminate more.
XP: does all code need unit tests?
In XP all code must have unit testing. a bug is not an error in logic, rather, a test that was not written
XP: What does designing phase involve?
Avoiding dependencies you code may have, changing one part of the code shouldn’t affect other parts.
How does composition achieve similar goals to inheritance?
Composition requires classes to contain instances of the class that implement the desired funcionality rather than inheriting the functionality from the parent class.
what is one problem with inheritance over composition
it can be difficult to create changes in the parent class, additions to the parent class are also not encapsulated (child classes can see changes)
How would you implement polymorphism with composition?
wiht this code, it is now possible to implement a list of CanPick, but still use composition interface CanPick { public bool pick(); } class Apple implements CanPick { private Fruit fruit = new Fruit(); public float getWt { // FORWARDING return fruit.getWt(); } public bool pick() { return true; } } class Orange implements CanPick {
Which language is multiple inheritance possible in?
C++
mulitple inheritance presents the opportunity for a lot of duplicate information, if a class is inheriting from two other classes, which might contain the same mathods/variables. Which idea can might solve this, but then create worse problems.
The deadly diamond. A top class contains information that might be similar, then you get your two slighlty different classes, then finally a class at the bottom which inherits the two slightly different classes. if the two slightly different classes both override the top classes method, the bottom class won’t know which method to use.
which is a common solution to the deadly diamond?
Duplicate instance, where the top class is duplicated.
What is multiple dispatch?
A lot like overloading (where we create multiple methods, with different parameters) but multiple dispacth allows polymorphic class. in runtime, the correct method is called based on the object type