The Photobooth on Montrose
2710 Montrose Blvd, Houston, TX.
The Photobooth on Montrose
2710 Montrose Blvd, Houston, TX.
Is a new mother happy with the pain of childbirth? No. And yet is she not fulfilled with the creation of life?
Or an artist who struggles for 20 years to create a piece that meets their own expectations. You have the eye before the skill, which is what is so frustrating. This is why we tear up our work. And delete entire photo shoots from our CF cards. Or rip the roll of film out of the Mamiya to expose it to light, killing it like a vampire thrown into daylight.
It is that our creation lacks fails to meet our vision. This is not happiness.
But do you want to live in a world where people, where you, don’t strive outside of your bounds? I don’t. I don’t need the happiness project. If I wanted that, there is some drug I can take surely. No, the brutal truth of reality, and frequently failed “creation,” is the reality I wish to live in. It gives meaning.
The Don had not seemed surprised when Hagen returned from California late tuesday evening and told him the results of the negotiations with Woltz. He had made Hagen go over every detail and grimaced with distaste when Hagen told about the beautiful little girl and her mother. Had had murmured “infamita,“ his strongest disapproval. He had asked Hagen one final question, “does this man have real balls?“
Hagen considered exactly when the Don meant by this question. Over the years he had learned that the Don’s values were so different from those of most people that his words also could have a different meaning. Did Woltz have character? Did he have a strong will? He most certainly didn’t, but that was not what the Don was asking. Did the movie producer have the courage not to be bluffed? Did he have the willingness to suffer heavy financial loss delay on his movies would mean, the scandal of his big star exposed as a user of heroin? Again the answer was yes. But again this was not what the Don meant. Finally Hagen translated the question properly in his mind. Did Jack woltz have the balls to risk everything, to run the chance of losing all on a matter of principle, on a matter of honor; for revenge?
Hagen smiled. He did it rarely but now but he could not resist jesting with the Don. “You’re asking if he is a Sicilian.“ The Don nodded his head pleasantly, acknowledging the flattering witticism and its truth. “No,“ Hagen said.
That had been all. The Don had pondered the question until the next day. on Wednesday afternoon he had called Hagen to his home and given him his instructions. The instructions had consumed the rest of Hagen’s working day and left him dazed with admiration. There was no question in his mind that the Don had solved the problem, that Woltz would call him this morning with the news that Johnny Fontane had the starring part in his new war movie.
At that moment the phone did ring but it was Amerigo Bonasera. The undertaker’s voice was trembling with gratitude. He wanted Hagen to convey to the Don his undying friendship. the Don had only to call on him. He, amerigo Bonasera, would lay down his life for the blessed Godfather. Hagen assured him that the Don would be told.
The Daily News had carried a middle-page spread of Jerry Wagner and Kevin Moonan lying in the street. The photos were expertly gruesome, they seemed to be pulps of human beings. Miraculously, said the News, they were both still alive though they would both be in the hospital for months and would require plastic surgery. Hagen made a note to tell Clemenza that something should be done for Paulie Gatto. He seemed to know his job.
Hagen worked quickly and efficiently for the next three hours consolidating earning reports from the Don’s real estate company, his olive oil importing business and his construction firm. None of them were doing well but with the war over they should all become rich producers. He had almost forgotten the Johnny Fontaine problem when his secretary told him California was calling. He felt a little thrill of anticipation as he picked up the phone and said, “Hagen here.“
The voice that came over the phone was unrecognizable with hate and passion. “You fucking bastard,“ Woltz screamed. “I’ll have you all in jail for a hundred years. I’ll spend every penny I have to get you. I’ll get that Johnny Fontane’s balls cut off, do you hear me, you guinea fuck?“
Hagan said kindly, “I’m German-Irish.“ There was a long pause and then a click of the phone being hung up. Hagen smiled. Not once had Woltz uttered a threat against Don Corleone himself. Genius had its rewards.
Jack Woltz always slept alone. He had a bed big enough for ten people and a bedroom large enough for a movie ballroom scene, but he had slept alone since the death of his first wife ten years before. This did not mean he no longer used women. He was physically a vigorous man despite his age, but he could be aroused not by only very young girls and had learned that a few hours in the evening were all the youth his body and his patience could tolerate.
On this Thursday morning, for some reason, he awoke early. The light of dawn made his huge bedroom as misty as a foggy meadowland. Far down at the foot of his bed was a familiar shape and Woltz struggled up on his elbows to get a clearer look. It had the shape of a horse’s head. Still groggy. Woltz reached and flicked on the night table lamp.
The shock of what he saw made him physically ill. It seemed as if a great sledgehammer had struck him on the chest, his heartbeat jumped erratically and he became nauseous. His vomit splattered on the thick bear rug.
Severed from its body, the black silky head of the great horse Khartoum was stuck fast in a thick cake of blood. White, reedy tendons showed. Froth covered the muzzle and those apple-sized eyes that had glinted like gold, were mottled the color of rotting fruit with dead, hemorrhaged blood. Woltz was struck by a purely animal terror and out of the terror he screamed for his servants and out of the terror he called Hagen to make his uncontrolled threats. His maniacal raving alarmed the butler, who called Woltz’s personal physician and his second in command at the studio. But Woltz regained his senses before they arrived.
He had been profoundly shocked. What kind of man could destroy an animal worth six hundred thousand dollars? Without a word of warning. Without any negotiation to have the act, its order, countermanded. The ruthlessness, the sheer disregard for any values, implied a man who considered himself completely his own law, even his own God. And a man who backed up this kind of will with the power and cunning that held his own stable security force of no account. For by this time Woltz had learned that the horse’s body had obviously been heavily drugged before someone leisurely hacked the huge triangular head off with an ax. The men on night duty claimed that they had heard nothing. To Woltz this seemed impossible. The could be made to talk. They had been bought off and they could be made to tell who had done the buying.
Woltz was not a stupid man, he was merely a supremely egotistical one. He had mistaken the power he wielded in his world to be more potent than the power of Don Corleone. He had merely needed some proof that this was not true. He understood this message. That despite all his wealth, despite all his contacts with the President of the United States, despite all his claims of friendship with director of the FBI, an obscure importer of Italian olive oil would have him killed. would actually have him killed! Because he wouldn’t give Johnny Fontane a movie part he wanted. It was incredible. People didn’t have any right to act that way. There couldn’t be any kind of world if people acted that way. It was insane. It meant you couldn’t do what you wanted with your own money, with the companies you owned , the power you had to give orders. It was ten times worse than communism. It had to be smashed. It must never be allowed.
Woltz let the doctor give him a very mild sedation. It helped him calm down again and to think sensibly. What really shocked him was the casualness with which this man Corleone had ordered the destruction of a world-famous horse worth six hundred thousand dollars. Six hundred thousand dollars! And that was just for openers. Woltz shuddered. He thought of this life he had built up. He was rich. He could have the most beautiful women in the world by crooking his finger and promising a contract. He was received by kings and queens. He lived a life as perfect as money and power could make it. It was crazy to risk all this because of a whim. Maybe he could get to Corleone. What was the legal penalty for killing a racehorse? He laughed wildly and his doctor and servants watched him with nervous anxiety. Another thought occurred to him. He would be the laughingstock of California merely because someone had contemptuously defied his power in such arrogant fashion. That decided him. That and the thought that maybe, maybe they wouldn’t kill him. That they had something much more clever and painful in reserve.
Woltz gave the necessary orders. His personal confidential staff swung into action. The servants and the doctor were sworn to secrecy on pain of incurring the studio’s and Woltz’ undying enmity. Word was given to the press that the racehorse Khartoum had died of an illness contracted during his shipment from England. Orders were given to bury the remains in a secret place on the estate.
Six hours later Johnny Fontane received a phone call from the executive producer of the film telling him to report for work the following Monday.
– from “The Godfather“
I have been using Tower as my Git client lately, as trained by my programming team. I’m the old dog this time learning syntax and style guides from them (and hopefully they are listening and learning design patterns from me). While reviewing the Tendenci code recently one question that I asked was “Where are the comments? And when someone does comment, why do they not put their initials at the end?”
To this the response was:
“We don’t need to put our initials on things. Version control takes care of that and we can use the “blame” function to find out who did what on any given line.”
I said OK at the time. But it has been bugging me. I couldn’t quite put my finger on why it bothered me, but it did. Who can argue against accountability? I see the business value in assigning blame and using that to create a teachable moment.
Having programmed a large number of products over the years (MS Access anyone? VB 4? Ahhhh, good times.) I was taught that software should be “self healing.” The end user should NEVER see an error message. If the user sees an error, the programmer didn’t do their job or they were just sloppy. There is a reason Select Case statements end in Else. There is a reason If statements have both an Else and an ElseIf option. There is a reason you trap errors.
Error trapping is not a science it is an art. And again, programming just isn’t for everyone like any other trade. But if you are gonna do it, then do it right. Less really is more in programming. I love the DRY principle in Python. Our process was one of complete accountability. You, the programmer, tested it first and when you took it live, there was no third party tester to fall back on. There was no tester to blame. No Linus security blanket. For years when developing Tendenci we didn’t even have a staging environment. When you play with live ammo you learn to pay attention. High stress? Sure. But much more profitable than cascading code through four different environments before it goes live.
Back to the blame game. I was taught starting in my first programming class in 1983 that putting your name in the comments, or initials as the case may be, was a way of saying
“I wrote this. I am proud of this code. There are no bugs in it. And I DEFY you to find a bug.”
This goes back to Basic, Fortran, Pascal and my mainframe days. The only time I didn’t use comments with my initials was when programming in Assembler and I think I should get a pass on that one, as hellish as it is an all.
Initials and comments were so serious that my professor my Freshman year of college would mock us saying that if we didn’t put our name in the comments he knew it was going to be C or B code at best, but definitely not A+ code. A+ coders are proud of simple clean code and they want credit for it. They comment it and put their name on it. Now to be fair, this particular prof did mark you down a letter grade if you didn’t comment your code so his statement was somewhat of a self fulfilling prophecy.
Pride. Ownership. Creators. These are very positive things. And that is why we put our initials in the comments on functions and classes we wrote. It was a way of saying “I am proud of this code.”
And that is a very different attitude than the source control “BLAME” function which is used mostly to say “you f’d this up.”
Blame and pride-of-craftsmanship are two very different things. That is why it bothers me so much I think. Maybe the world has changed and programming is taught like dodgeball – the less you do and the more you hide the less you might get blamed for something? I really don’t know.
I do know that I do not like the negative connotations of “blame.” Where is the joy if you can be blamed for stuff but never credited? Yes I like having the “blame” functionality. It is just a bummer to see a craft go from a positive to a negative feedback loop. I’m still thinking about that. I do know craftsmen and artists should be proud of their work. And I believe my programming team is proud of their work. I just don’t understand how we got from pride to blamesmanship-only when we could have both.
I know the pride aspect isn’t totally gone because GitHub prominently shows how many commits you have made and which projects you work on. Yet quantity is not quality, and clean programming can be subtly claimed with initials to indicate pride of ownership without relying solely on “blame.” It doesn’t all have to be negative. Programming is about creating. And creating things gives us meaning. Which is beautiful.
Like I said, I’m still thinking about this one. I’m probably missing something. Feel free to blame me if I got it wrong.
But if I don’t hit publish it will just sit there forever. so you get a half baked version. Sorry.
On buying a car, a few notes from a guy who used to teach dealerships how to use their computer system to maximize profit. There are some honest dealers out there. When you are buying used this number goes down significantly. So this is mostly about buying a used car and focused on the younger reader who might not have experience buying cars.
First note that dealerships make money and move money between four boxes to maximize profit.
If the goal is to make $3k on the sale, they really don’t care if they sell it to you below invoice price as long as they make it up in one of the other three areas. Hence cutting deals like “OK, I’ll get you to 5.5% interest, which is below myst cost (white lie here) if you will promise to purchase one of the warranties which are a great deal regardless.” etc….
In defense of the car guys, people are trying to rob them constantly. From stealing cars. Car jackings on a test drive. Porters swapping out RIMS on a new Tahoe with similar but cheaper rims. Used car guys paying their wholesaler too much for used cars and taking a kick back because they know they are leaving in a month. The guy who paints the emblems gold with “14 carat gold” is really using gold pain that will fleck off in six months and the dealer has to pay for it again. The finance companies changing how they loan money for the dealer to have cars on their lot (called floor-plans). Manufacturers playing favorites and giving the “hot car of the year” to one dealer more than another out of favoritism. People kiting checks. Etc… In other words, it is a rough and street smart type of business and they have to be a little rough just to survive.
So yes, I’m asking that you have a little bit of sympathy for the plight of the car dealers of the world.
That said, let’s have some sympathy for you too and talk about the best way to navigate through the used car buying process, shall we?
Have your insurance already. If you qualify, I really like USAA if at ALL possible for insurance. Switching away would be penny wise and pound foolish (just gonna have to trust the old man on this one.) If you must, raise your deductible, but stay with USAA. USAA is the ONLY customer owned insurance company I know of. They don’t try to be the cheapest, but they are usually competitive. And even if you are paying more it is worth it to not get hosed.
In the world of insurance, I ask you “how can that duck advertise so much?” and “Where does the lizard get all that money to advertise?” The caveman? The hands people? All of them. They can advertise that much because they make it difficult to get your claims paid. Or by just not paying claims.
Back to your trip to the dealership. You will need a copy of your insurance and your driver’s license to test drive a car. They will either photocopy or take your driver’s license during the test drive. Don’t get mad. The problem is people would go in for test drives and steal the cars. Or worse, the sales person might be car jacked and injured. They have a right to protect themselves and their employees so don’t give the dealer a hard time about photocopying your license. It’s for their safety.
Oh, and they also add you to their system for follow up calls while you are out on your test drive. Such is life. But they are loaning you a big expensive machine so some collateral seems fair to me.
Call or go online and apply to be pre-approved for a car loan. This is step 1. Allow a couple days for this to go through. State your income correctly as they will ask for your last two or three paycheck stubs (see last email to get the intuit link). If your compensation varies due to commission or bonuses bring last year’s W-2. If last year’s W-2 is higher use that. If you just got a raise, bring your recent paycheck stubs as those will calculate to your new pay rate.
Your next goal is to pick a car and get a fair drive out cash price without showing any other cards yet (cards being trade-ins, warranties, add-on rims, etc…)
Credit checks are bad for your credit (oh the irony). The the dealer will eventually run your credit to determine if you actually work at said company because they want to beat your preapproved rate. But don’t allow this until you have a final “cash” price for the vehicle. Think of a credit check like an X-ray. One isn’t such a bad deal. But if you had to get 50 xrays in one day you’d turn into the green hulk dude.
The risk to your credit is if three dealerships all pull your credit then it hurts your credit rating because it looks like you are trying to buy three cars and over extend yourself. Then nobody is going to give you a good deal or take you seriously. When preapproved for your car note you can tell the dealer specifically to NOT run your credit until you have picked out a car and negotiated the final sale price. Your goal is to negotiate a cash drive out price without letting the dealer look at your trade in or pull your credit rating.
Note: this is probably where you will get your first “Turn Over.” This simply means the sales person brings in a new face who tells you the exact same thing because psychology tells us that we are likely to do it if a new voice says the same thing. Expect this. And it will be a very very like-able Finance and Insurance professional who makes Brangelina look like they work community theater. Or the opposite – the folks type who gosh shucks just wants to take care of you. They’ll ask about your dog while they are printing forms and they will always have a picture of their family facing the customer. Think about it. Most of us have pictures of our family on our desk that face US. Hmmmmm.
As for credit checks, I should mention one possible exception here for luxury car buyers or industrial buyers (like F350s or Fleet Vans). If you are looking at a used BMW it doesn’t hurt for the dealer to see that the Mercedes dealership pulled your credit yesterday. But stop there.
The dealer will not want to negotiate a final sale price before running your credit as that tells them how much he might be able to make on the back end (finance and insurance). Stick to your guns. THEN and only then can they run your credit to see if they can do a better deal than USAA. And some credit unions can. But you have the upper hand by being preapproved.
You will probably have had a second turn over at this point. Three very likeable folks “on your side just trying to help you.” And they actually are trying to help you. They just want to make the most possible money doing it because that is how they eat and provide for their families. But the really good ones? They aren’t worried about feeding their families, they are trying to maximize profit because it is how they keep score. Competition drives them.
On credit ratings – few people actually lie about their credit ratings so a seasoned car guy will respond to “my credit it perfect” and leave it alone because usually when folks say that, they are telling the truth. On the other hand, don’t lie. If you have some bumps run your own credit report BEFORE going to the dealership and give them a copy with an explanation. Sure they’ll have to run their own, but they will match and you have established trust. And avoided an extra credit pull until you are ready.
At this point you have your insurance and you are preapproved. Yea! Next:
When you arrive on the lot one of the first things they will ask is if you have a trade in “so we can have the guys in the back appraise it.” You can risk it, or just say “no, I’m giving that to my friend.” Then after you negotiate a cash price for the car you can say “you know, just for grins, what would you give me for my car?” Be sure to spend $100 having it detailed (not washed, I said DETAILED) before going to the dealer. It should be spotless if you want the best price. It might not work, but having a filthy car definitely won’t work.
And don’t be dishonest to them either. If you know it has a bad oil leak, don’t just fill it up and wipe off the excess right before having it appraised. That makes you, well, let’s call it what it is. You would be at a minimum a liar and an attempted thief. This happens to dealers a LOT and then whoever buys the car beats them up for selling them a lemon when their mechanic had no way of knowing it leaked oil after long road trips. How could they? Only the person trading the car in knows that. Don’t fix it, but tell them because their cost to repair it is significantly less than yours and they will appreciate your honesty. And that just might get you a better deal (yes really.)
Despite my advice above I usually just detail my trade-in and let them appraise it right away. I tell them I have no more than one hour to be on the dealers lot and I stick to it and leave no matter what. I might come back, but I leave in one hour no matter what. And I also make sure that I know the trade in price and private sale price from Edmunds. If you aren’t sure what options your car has sometimes you can look that up by VIN number.
The dealer will come back with a offer for your trade in which you can cross check with the trade in value on http://www.edmunds.com/ If they are close to the trade in value I usually trade it in because selling a car is a pain. And it involves inviting strangers to your house from Craig’s list which sucks. But hey, if they low-ball you on the trade in push back. And if that doesn’t work then just say “nah, I’ll sell it myself on a consignment lot.” You won’t get quite as much as trade in, but more than the low ball offer they throw at you. And they will probably throw low because they are not used to anyone negotiating the cash price before anything else.
Buy a reliable make of car that is popular. Popular cars means more of them wind up in the junk yards over time which means you can usually find used parts. Hence a Toyota Camry, Ford F-150 or Honda Civic are all good options. A Delorean on the other hand would be a terrible idea as used flux capacitors are rare. Very rare.
I am partial to Hondas and Mercedes personally. Although Mercedes is expensive to repair, they last forever. I haven’t had a car payment in three years.
Now to find the car. You need to buy a car with four seats as two seater cars have higher insurance. Red and Yellow cars have higher insurance. Tan cars are invisible and unsafe in my opinion as people pull out in front of you. So that leaves the other colors like Maroon, Silver, Black, White, etc…. Sorry kid – it’s a used car. It takes you from point A to point B. Period. You can’t pick a color so much as avoid those three “bad” colors – Red, Yellow, (expensive) and Tan (invisible – lots of accidents.) if you are trying to get the best deal.
This morning we looked up a 2005 Toyota Camry and the dealer has it listed at $9,991 + Tax Title and License (figure another 1k)
Then we flipped it around and I said “hey, if I were trading this car in what is this 2005 Toyota Camry worth?” This generates three prices.
In this case those numbers are: http://www.edmunds.com/toyota/camry/2005/tmv-appraise-results.html
Have the numbers before you get to the dealership and have the iphone ready to look up prices. Or a regular phone to text your friend the VIN number so they can be at their computer and do the lookup for you. In this case Edmunds tells us the the dealer probably paid about 5k for the car. And they should probably be selling it at $6,500 but will likely list at $7,500 to give themselves a bigger buffer.
|Trade-In||Private Party||Dealer Retail|
|National Base Price||$6,455||$7,429||$8,528|
|Color Adjustment – Red||$10||$11||$13|
|Regional Adjustment – for Zip Code 77002||$3||$4||$4|
|Mileage Adjustment – 100,000 miles||$-177||$-177||$-177|
|Condition Adjustment – Average||$-1,458||$-1,646||$-1,834|
OK, so now we know the dealer is asking 10k for a car he paid $4833 for. Even if you negotiate them down 3k, they are still going to make 2K and talk you into some protection policy ($900), ask you to pay for extras they “already installed on the car” like VIN etching on the windows or gold paint on the front hood ornament ($450) and underbody protection ($300). Refuse all of these. All. Tell them your brother is a mechanic (one of mine is) and leave off the part about him living in Florida.
These prices are dated, but the cost to the dealer for the “warranty insurance” is probably $150, the VIN etching is just a scam, but cost is maybe $100 to the dealer and gold paint on the hood ornament probably cost them $50 to $100. Same for pin-stripes.
1) USAA – If you are preapproved for a loan you have the upper hand. And it is probably better to just say you don’t have a trade in car. That just gives them another variable to mess with you. Being preapproved by USAA is key.
2) Have print outs in your hand for at minimum of three (3) of the type of car you want to purchase. Also have print outs of the trade in value. It is OK to pay dealer retail, that is about a 1k profit and that is fair for what they go through. But getting hit up for 5k extra puts you “upside down” on the car and you can never sell it. Then it dies and you are making car payments on a car that doesn’t exist.
3) They will not want to talk “interest rate” but rather “payment.” Then they will say you are saving $50 a month on your payments when in fact USAA approved you for a 4 year loan and they just moved you to a six year loan and didn’t tell you.
4) Extended warranties. Don’t buy it. If you really want one you can buy them on the Internet for a fraction of what the dealer will want to sell it to you for.
5) Don’t worry about location. A dealer in Dallas has zero chance of selling you a car, right? So if a Dallas car dealer has an old car on his lot and it costs $250 to have it shipped, that dealer would settle for a lower margin Internet deal gladly. Thus frequently the best priced cars are from alternate cities. If you are in Houston call down to Rosenberg and check their prices.
6) Dealers hate old cars on their lot because they are paying interest (it’s called “Floorplanning”. When I traded in a Tahoe and bought a Honda Civic I literally walked up to the first salesperson I saw and said “show me the three oldest four door Honda civics on your lot regardless of color. And I have exactly one hour before I need to leave.” I bought the second oldest and it was a pretty quick car deal.
7) On a used car it is common practice for you to take it to your own mechanic and pay them $50 to look over the car and tell you if they see anything wrong with it. You yourself can look for stuff like “orange peel” paint jobs which means body work. Bolts under the hood that are not painted (the fender was replaced – new cars paint it all at once.)
8) CarFax is cheesy as hell, http://www.carfax.com/entry.cfx but it does give you the history of the car. When we bought used we usually did pay to get the history of the car (although back then you had to mail off for it). We bought a lemon that the salesman said was “the dealer’s wife’s car” when in fact it was a lease car out of Florida that never worked right and leaked on you when it rained. We made such a stink they took it back.
9) Used cars in the South are worth more than used cars from the Northeast. This is because of salt to remove snow and ice from the roads in the North which causes cars in the northeast to rust faster. Not as much of an issue these days, but still. On the flip side buying a pickup truck from North of the Mason Dixon line will be cheaper than buying one in Texas. Thus a lot of dealers will buy wholesale pickup trucks at auction in the North and have them shipped to the south. That $500 shipping cost is small compared to the 2k bump in price the vehicle will get, and you won’t know the history (see Carfax above).
7) New cars have something called “Hold Back.” which is basically a kick back of 1k to the dealer. So if you ask to see the invoice, which you are free to ask, they will show you that they paid 26k. They say “But you gotta give us a little!?” so you agree to $500 over invoice. So they are up 1.5k and send you to F&I (Finance and Insurance) and work you for the “pre-added accessorie, the interest rate spread, the extended warranty that doesn’t cover anything, etc.
Back to the beginning. Four buckets. Sale price. Trade in. Financing. And add-ons. If you can negotiate those individually you will do better. If you try to negotiate them all at once, it’s like trying to win against a carny. The game is rigged in their favor.
Your goal is to get a fair deal. Be civilized. Give them some margin because the dealership is a business too, but don’t let them charge you 10k for a car they paid 5k for because you will be upside down on your car note forever. Negotiate for a fair deal.
Keeping your career in permanent beta forces you to acknowledge that you have bugs, that there’s new development to do on yourself, that you will need to adapt and evolve. It is a lifelong commitment to continuous personal and professional growth.
Entrepreneurs penetrate the fog of the unknown by testing their products, and their hypotheses, through trial and error. Any entrepreneur (and any expert on cognition/learning) will tell you that practical knowledge is best developed by doing, not just thinking or planning.
Googling best practices for classes in Python for a Django project I kept coming across the phrase “favor composition over inheritance” and the Strategy Design Pattern. First let me quote wikipedia on composition over inheritance:
Composition over inheritance in object-oriented programming is a technique by which classes may achieve polymorphic behavior and code reuse by containing other classes which implement the desired functionality instead of through inheritance.
class AUsefulThing( object ): def __init__( self, aStrategicAlternative ): self.howToDoX = aStrategicAlternative def doX( self, someArg ): self. howToDoX.theAPImethod( someArg, self ) class StrategicAlternative( object ): pass class AlternativeOne( StrategicAlternative ): def theAPIMethod( self, someArg, theUsefulThing ): pass # an implementation class AlternativeTwo( StrategicAlternative ): def theAPImethod( self, someArg, theUsefulThing ): pass # another implementation
Now you can do things like this.
t = AUsefulThing( AlternativeOne() ) t.doX( arg )
S-Lott then provides another Python example pattern that replicates the above with a bit less code.
This had me scratching my head. Not at the example and the helpful response, but at the question itself. Why are we creating functions, then assigning a variable to a class and passing the function in as a parameter? Barooo?
This pattern is practically non-existent in languages that support first class functions. You may want to consider taking advantage of this feature in Python:
def strategy_add(a, b): return a + b def strategy_minus(a, b): return a - b solver = strategy_add print solver(1, 2) solver = strategy_minus print solver(2, 1)
“This approach is very clean and simple.”
I agree with him. I have made the mistake, granted it was out of desperation, of putting a literal in a public property in a class called “objecttype”. This let me pass the object to a function and make decisions on what to do next. Pseudo vbscript-ish code example:
function generate_invoice(object, d) select case(object.objecttype) case "jobs" #do job invoice stuff case "resumes" #do resume stuff here case else
Ok, so it’s not quite as bad as concatenating a string of vbscript and calling the exec(str) method. But it ain’t pretty either. But both got the job done. And in the case of my fake function above, that sure looks like the composition pattern to me. Maybe not exactly, but it’s close. Functions taking classes as parameters and then calling methods within the class in the name of portability. And to reduce code in the classes themselves of course.
I like Christian’s example above a LOT better. Which makes sense because Python has, as noted by bitwise, both First Class Functions and allows for Meta-programming. “Python is not java without the compile” indeed. First Class Functions and Meta Programming used in combination obviate the need for the Strategy design pattern in Python IMHO (see caveats below). And for further support I found this:
“Yes, design patterns are good, but they’re also a sign of weakness in a language.“
The patterns are built in [to Python]. “No one talks about the “˜structured programming’ pattern, or the “˜object-oriented’ pattern, or the “˜function’ pattern anymore.“
I’m still a Python newb, but definitely not a programming newb. And So far it looks like you can inherit meta classes with properties to your hearts content to DRY. Yet still, make a thoughtful decision when it comes to how you should implement methods/functions in base classes. Sometimes perhaps a function is better than inheriting a method. Just stop and think. Odds are our fear of inheritance is a learned behavior from being burned by java or another similar lower-level language. I think I need to get over that.
And be thankful that most design patterns are already built into Python. Less code is better.
In closing, and I forget the post I read it on, but just because programming can do ORM (object relational mapping) does NOT mean that a database can. In fact it can’t. And a database deals with the multi-stand-alone class issue by creating a bunch of tables in Django. And one programming matra that I am 100% sure is true is “JOINS are EXPENSIVE.”
Django responds to inherited meta classes by keeping all of the fields in one table, not 20. And perhaps this is me just trying to get over my fear of multi-inheritance and break years of practice. To take advantage of Python being “First Class Everything”. To write code that is Better, faster, stronger than before.
The Tendenci Quadcopter visits the Houston Art Car Ball 2012.
“I respect the beliefs of others, and the right of religious institutions to act in accordance with their own doctrines. But I believe that in the eyes of the law, all Americans should be treated equally. And where states enact same-sex marriage, no federal act should invalidate them.”
– POTUS, 2012
Commentary: Yes I realize my job is a “role”, that of CEO. Yet sometimes I reserve the right to point out what I believe to be obvious. Sometimes that obviousness is bigotry in the form of discrimination against people for the way they were born, created, by God.
In 1981 when I met a good friend it was clear to me he was “born that way”. The first week of high-school we all didn’t know how to react to him. What was his deal? Huh? Turns out he is a great man. Different from many of us. Being born gay, something we all knew but he didn’t confirm until many years later. If asked he denied it. We didn’t care because he was a good friend and a good man. Period. He was part of our tribe and good heavens we all had our own weirdness.
Years later I remember the call when I was in college when he said “I have something to say” and I said “we know, we knew in high school, and it doesn’t change a bloody thing. We love you as you are dude.” His response was “you knew?” and, for lack of a more refined response I said something like “we all knew, we didn’t care, and I’m pretty sure you knew even back then but that doesn’t matter. You rock and it’s so great to hear from you.”
I’d have my PR team refine my response now. But it wouldn’t change the message.
I stand by my statements. I’d do the exact same thing today. I do. Accept.
Different? Yes, a minority. But God’s creation. This wasn’t some “choice.” This was simply who the man was. He was born that way. And who am I to judge how God creates us? Do I really understand it? No. Do I understand at a logical level why I find women attractive? No. We are truly just “born that/this/the-other way.”
So regardless of your politics, I love hearing the President of the United States state clearly his support of gay rights. States rights first, yes, but given a states’ choice the Federal Government should stay out of it. And I rarely agree with politicians, but in this case, I agree. Tip of the hat to your courage POTUS. Keep on keepin on.
Scores of readers, often students, wrote to Wilder over the years seeking his position on the questions posed in The Bridge. In this excerpt from a letter written march 6, 1928, four months after the appearance of the novel, Wilder responds to a query from John Townley, one of his former pupils at Lawrenceville.
Lawrenceville, New Jersey
The book is not supposed to solve. A vague comfort is supposed to hover above the unanswered questions, but it is not a theorem with its Q.E.D. The book is supposed to be as puzzling and distressing as the news that five of your friends died in an automobile accident. I dare not claim that all sudden deaths are, in the last counting, triumphant. As you say, a little over half the situations seem to prove something and the rest escape, or even contradict.
Chekhov said: “The business of literature is not to answer questions, but to state them fairly.“
I claim that human affection contains a strange unanalyzable consolation and that is all. People who are full of faith claim that the book is a vindication of this optimism; disillusioned people claim that it is a barely concealed “anatomy of despair. I am nearer the second group than the first; though some days I discover myself shouting confidentially in the first group.
Where will i be thirty years from now? – with Hardy or Cardinal Newman?
– Thornton Wilder
Afterward, The Bridge of San Louis Rey