3 ms·
After reading it twice, there are many points that are good, but there also some points that are not so clear cut, or plain bad. Maybe I am a bad programmer, b
by ardit33 17y ago
After reading it twice, there are many points that are good, but there also some points that are not so clear cut, or plain bad. Maybe I am a bad programmer, but I disagree with some points:
# (OOP) Writing lots of "xxxxxManager" classes that contain all of the methods for manipulating the fields of objects that have little or no methods of their own
I guess they keyword 'lots' make this ok, but having plain objects (scruct like), passed around in the application, and having some managers is fine. eg. if you have an application that passes around contacts, you can have a ContactsManager, taking care of all the messy bussines (local peristence, remote persitence, deleting, etc., while contacts remain simple objects. ActiveRecord pattern goes the other way, where this logic is placed in the objects. Both are fine.
# (Relational) Treating a relational database as an object store and performing all joins and relation enforcement in client code
--I guess all those programmers in the "NOSql" movements are idiots. (they are not, some of these people are really smart). Don't take this statement too seriously.
# Re-inventing or laboring without basic mechanisms that are built-into the language, such as events-and-handlers or regular expressions
--I think regular expressions are evil, obscure, and performance is highly depended on the implementation. Practical example, checking if an email address is valid. While some people go all the way crazy with regular expression, All I do is check that there is an '@', or a '+', at least one '.', and minimum/maximum lengths. You don't regular expressions for that, as no matter how smart you think your expression is, there is a great chance somebody that edits it will fuck it up just by changing a character on it.
# Re-inventing classes and functions that are built-into the framework (eg: timers, collections, sorting and searching algorithms) *
Done many times. If you are doing mobile, most of platform implementation (at least in J2ME) just suck ass. You can't rely on them. Heck, in my previous company we did even font rendering, thread worker queues, etc. as the scheduler was unreliable, etc.
#Recursive subroutines that concatenate/sum to a global variable or a carry-along output variable
--For some problems carry-along variable are needed.
eg, in a binary search tree, trying to print only the nodes in a certain level.
printTreeLevel(tree, 2) -- will print only the nodes at level two
print(node, level)
if level == 0
print node.data
else
printTreeLevel(node.left, level - 1)
printTreeLevel(node.right, level - 1)
# Writing business-logic functions with tragically compromising side-effects, such as updating a user interface or performing file I/O
--I guess it depends on the definition of what "business-logic" is. This guy thinks it more as the transactional/model part and not a controller.
For some apps, the business logic is the main controller. Plus, "bussines logic" is more of a managerial speak anyways.
#Homebrew "Business Rule Engines"
-- Maybe I am not old enough, but I had to look it up what a "Business Rule Engine" is. Seems stuff from the Dot Com era/enterprise world.
#Code that tries to prevent an exploit from working by searching for the exploit's signature
--Haha. That's the whole Antivirus industry. I agree with him, and I don't have antivirus software, but it seems that those companies made millions by breaking this rule.
- mgreenbe 17y agoRecursive subroutines that concatenate/sum to a global variable or a carry-along output variable Wow...I didn't see this in the article. That is downright boneheaded. Is accumulator-passing style forbidden for a reason? It's a cheap way to make functions tail-recursive---much cheaper than CPS!
- clawrencewenham 17y agoI'm still looking for a good way to express what was meant by that symptom description. You know about tail recursion, but I'm trying to get at the uses of accumulators that have nothing to do with tail recursion. That and I got fed up with listing all of the exceptions to every rule.