Interfaces on an abstract class
My coworker and I have different opinions on the relationship between base classes and interfaces. I’m of the belief that a class should not implement an interface unless that class can be used when an implementation of the interface is required. In other words, I like to see code like this:
What’s the next level of abstraction? [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for […]
How to avoid general names for abstract classes?
In general it’s good to avoid words like “handle” or “process” as part of routine names and class names, unless you are dealing with (e.g.) file handles or (e.g.) unix processes. However abstract classes often don’t really know what they’re going to do with something besides, say, process it. In my current situation I have an “EmailProcessor” that logs into a user’s inbox and processes messages from it. It’s not really clear to me how to give this a more precise name, although I’ve noticed the following style matter arises:
Are CK Metrics still considered useful? Is there an open source tool to help?
Chidamber & Kemerer proposed several metrics for object oriented code. Among them, depth of inheritance tree, weighted number of methods, number of member functions, number of children, and coupling between objects. Using a base of code, they tried to correlated these metrics to the defect density and maintenance effort using covariant analysis.
Breaking up a large PHP object used to abstract the database. Best practices?
Two years ago it was thought a single object with functions such as $database->get_user_from_id($ID)
would be a good idea. The functions return objects (not arrays), and the front-end code never worries about the database.
Can I assume interface oriented programming as a good object oriented programming?
I have been programming for decades but I have not been used to object oriented programming. But for recenet years, I had a great opportunity to learn OOP, its principles, and a lot of patterns that are great.
Data classes: getters and setters or different method design
I’ve been trying to design an interface for a data class I’m writing. This class stores styles for characters, for example whether the character is bold, italic or underlined. But also the font-size and the font-family. So it has different types of member variables. The easiest way to implement this would be to add getters and setters for every member variable, but this just feels wrong to me. It feels way more logical (and more OOP) to call style.format(BOLD, true)
instead of style.setBold(true)
. So to use logical methods instead of getters/setters.
Learning OO for a C Programmer [closed]
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for […]
What’s the equivalent name of “procedure” in OOP?
In several of my programming courses in the University, my teachers always told me the following:
What’s the difference between overloading a method and overriding it in Java?
What’s the difference between overloading a method and overriding it in Java?