1/188
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai | Chat |
|---|
No analytics yet
Send a link to your students to track their progress
True or False: Messy code is okay to meet a deadline. You can clean it up later.
False
True or False: Keeping code clean at all times is not a cost effective solution.
False
True or False: Adding more staff can maintain productivity with messy code.
False
True or False: Productivity decreases asymptotically to zero over time with messy code.
True
True or False: Longer names are generally better than shorter names since they can give more context.
False
True or False: Class names should only be nouns.
True
True or False: Solution domain names are preferable to problem domain names to make it easier for the programmer.
False
True or False: Names should reveal intention.
True
True or False: Most names provide meaningful context
in and of themselves.
True or False: Use encodings like member prefixes "m_" to distinguish names.
False
True or False: Different classes can use different words for the same concept.
False
True or False: Choosing good names requires a shared cultural background.
True
True or False: Names should vary in small ways.
False
True or False: Do not use single character variable names except for loop counters.
True
True or False: Clever names can help aid understandingand memory.
False
True or False: Names should be pronounceable.
True
True or False: The same name can be used for different purposesin different classes.
False
True or False: Once a variable
method
True or False: Including the data type along with the word "variable" provides a meaningful naming distinction
especially since modern IDEs obscure the distinction between variable namesand other words in programs.
Which is the best name for a List
flaggedLocations
One benefit of pronounceable names is their support for clarityandease in conversations.
True
Clean code suggests using searchable namesbut there is also support for very short names within a very local context.
True
Since the English language contains many words with overlapping meaning
names that incorporate different words for the same concept can be helpful throughout the code.
Which of the following help avoid disinformation when referring to List
Pick a preferred approach to naming collections of objects; Avoid "accountList" since the implementation detail may change
True or False: Method names should only be verbs or verb phrases.
True
True or False: Functions should do something or answer something
not both.
True or False: Functions should do 1 thing.
True
True or False: The bodies of try-catch blocks should be extracted into their own functions.
True
True or False: Throwing exceptions is preferred to returning error codes.
True
True or False: Duplicate code can often be eliminated with a function.
True
True or False: Switch statements are preferable to polymorphism.
False
True or False: Functions should change state of object rather than use output arguments.
True
True or False: Functions with 2 or more arguments can be confusing because of order.
True
True or False: Output arguments are preferable to input arguments.
False
True or False: Multiple arguments are preferable to argument objects.
False
True or False: Functions should have a single level of abstraction.
True
True or False: Functions should be small.
True
True or False: Three or more function arguments should be avoided.
True
True or False: Flag arguments are useful.
False
How many things should one function do?
1
The ideal number of arguments for a function is 0.
True
Command Query Separation indicates that a function could:(select all that apply)
Do something; Answer something
True or False: Dummy scopes/bodies do not need to be visible.
True
Java class implementations of objectsin clean code: a.) always have private properties b.) can provide public access to propertiesand utility functions for a clean code purpose c.) restrict other programmers from seeingthe internal implementation of classes d.) provide public access to all functions since these representthe clean code public behaviors of the object
b.) can provide public access to propertiesand utility functions for a clean code purpose
How can we create a single level of abstraction within a Java class? a.) write a single function to representthe level of abstractionand use flag parameters to execute various behaviors b.) write the Java class correctly the first time c.) have propertiesand functions that representthe ideas at a single level of abstraction d.) actually
the propertiesand functions within a Java class should not represent a single level of abstraction
True or False: A Java class should have a single responsibilityand its contents should be at a single level of abstraction.
True
A Java class(in the course):(select all that apply
Is a data type; Can include both multiple pieces of dataand multiple functions; Is used to implement a data structure; Is used to implement an object
The Single Responsibility Principle:(select all that apply
Suggests creating functions that have a single responsibility; Suggests creating Java classes that have a single responsibility
True or False: I should consider breaking a Java class into two or more Java classes whenthe propertiesand functions can easily be separated.
True
True or False: Classes with high cohesion are candidates to split.
False
True or False: Classes should have low cohesion.
False
True or False: Classes should be small.
True
True or False: Classes that have large numbers of instance variables are more cohesive.
False
True or False: Maximum cohesion occurs when every method uses every instance variable.
False
True or False: Low coupling means a more flexible system.
True
True or False: The isolation of low coupling makes it harder to understandthe elements of the system.
False
True or False: Classes should be organized to reduce the risk of change.
False
True or False: Objects hide their data behind abstractionsand expose functions that operate on that data.
True
True or False: Variables should be kept private so others cannot depend on them.
True
True or False: Protected or package scoped variablesand methods can simplify testing.
True
True or False: Objectsand data structures are fundamentally the same thing.
False
True or False: Active records are quintessential data structures often augmented with navigational methods like saveand find.
True
True or False: Data Transfer Objects(DTOs)that have public variablesand no functions are useful.
True
True or False: Data Transfer Objects are quintessential objects.
False
Following command query separation guidanceand eliminating output arguments guidance along with guidance to be consistent — error handling guidance(preference)is to: a.) return error codes for queries(accessors)b.) prefer exceptions to returning error codes c.) return error codes for commands(mutators)d.) only code the happy pathand ignore potential errors
b.) prefer exceptions to returning error codes
True or False: Exceptions do not require informative messages since the stack trace is available.
False
True or False: Returning Null is preferred to throwing an exception.
False
True or False: Returning a special case object is preferred to returning Null.
True
True or False: Returning Null leads to programming errors.
True
True or False: Passing Null parameters to methods should be avoided.
True
True or False: It is better to throw an exception than return an error code.
True
True or False: The calling code is cleaner when you return an error code.
True
True or False: A function that handles errors should do nothing else.
True
True or False: Many code bases are completely dominatedby error handling
making it unnecessarily difficult to see what they do.
True or False: Tests can depend on each other.
False
True or False: In TDD
you should only write the code necessary to make the currently failing test pass.
True or False: Testsand production code should be written together.
True
True or False: A JUnit test function should only test a single concept.
True
True or False: Readability is the key to clean tests.
True
True or False: Tests should run quickly.
True
True or False: Tests can be written after you designand implement the code.
False
True or False: Domain-specific languages help you write clean tests.
True
True or False: Production code should be written before any tests.
False
True or False: The number of assert statementsin a single JUnit test function should be minimized.
True
True or False: A JUnit test function is only allowed to have one assert statement.
False
True or False: The testing code needs to be as efficientas the production code.
False
True or False: Some tests can require manual evaluation.
False
True or False: In TDD
you write all of your code before any tests.
True or False: In TDD
you write all of your tests before you write any code.
True or False: In TDD
you must write a failing unit test before you write the code for it.
True or False: Tests lessen the fear of making changes to the code.
True
True or False: Test code does not need to be clean code.
False
True or False: Unit tests keep code flexible
maintainable
True or False: Comments can be misleading
imprecise.
True or False: Comments that explain intent behind a decision can be useful.
True
True or False: Comments that amplify the importance of something that seems inconsequential can be useful.
True
True or False: Comments that warn of consequences can be useful.
True
True or False: Comments on closing braces can be useful.
True
True or False: Comments to clarify use of code you cannot change can be useful.
True
True or False: Many informative comments can be replaced by better variableand function names.
True