8 ms·
I opened one package at random http://opensource.apple.com/source/IOFWDVComponents/IOFWDVComponents-207.4.1/DVControlComponent.c http://opensource.apple.com/so
by chollida1 12y ago
I opened one package at random
http://opensource.apple.com/source/IOFWDVComponents/IOFWDVComponents-207.4.1/DVControlComponent.c http://opensource.apple.com/source/IOFWDVComponents/IOFWDVCo...
I see this:
#include <Carbon/Carbon.h>
//#include <Resources.h>
//#include <OSUtils.h>
//#include <Components.h>
#include "DeviceControlPriv.h"
#include "IsochronousDataHandler.h"
#include "DVVers.h"
#include <stdio.h>
#include <stdlib.h>
//#include <syslog.h>
// Debug messages
It's good to know that I'm not the only one who has commented out code in their shipping code:)
- nkozyra 12y agoTrust me, you're among friends.
- themartorana 12y agoYou have no idea. I know git is supposed to mean I can delete code without fear of losing it. Still...
- knodi123 12y agoWhen I comment out code, I add a timestamp of when I disabled it. Then, when I come across commented code with a timestamp more than 6 months old, I go ahead and delete it. Best of both worlds!
- madeofpalk 12y agoOh lord. Best demonstration of Poe's Law right here.
- dshap 12y agoDoesn't "git blame" take care of your timestamps for you?
- gcb0 12y agono. vc will only take care if you have the history and know what you are looking. if you publish a final version only like this all that is lost. if you run a interpreted language you can't find the place of the old code while debugging at runtime. there are many reasons to leave code comments besides neglect. though in this case it's neglect :)
- agumonkey 12y agoHmm what a nice extension idea for emacs comment-dwim.
- deleted 12y ago[deleted]
- tempodox 12y agoYou still can put one on top of that, like this: #if 20141031 // Date as a valid number != 0 // Active code #else // Inactive code #endif Helps documenting experimental alternatives, even without SCM.
- philbo 12y agoThis is a similar to an idea that David Schnepper talked about at Velocity Ignite this year. It's only a five minute presentation but it blew me away and I'm keen to give it a try for real at some point. Video here: https://www.youtube.com/watch?v=29UXzfQWOhQ https://www.youtube.com/watch?v=29UXzfQWOhQ
- lewispb 12y agoI like this alot, would anyone be keen to collaborate on a simple ruby gem to implement this 'tombstone' method?
- thebouv 12y agoWow, simple and short, but has already given me a ton of ideas. Saved and shared with our IS department too.
- ionforce 12y agoFunny how this is kinda Halloween-ish. Great share, thank you!
- dj-wonk 12y agoThis is thought provoking; I shared my reactions here: http://djwonk.tumblr.com/post/101423057084/tombstones-as-a-way-to-safely-remove-code http://djwonk.tumblr.com/post/101423057084/tombstones-as-a-w...
- robomartin 12y ago
- phkahler 12y agoI like that idea. I remove commented code when it's "old enough" but know how long it's actually been could be really helpful.
- akirk 12y agoI would be awesome if there were a plugin (for your favorite text editor) for that. It should be easy to add automatically and remove when you uncomment it.
- dj-wonk 12y agoPerhaps not a bad idea. One advantage to David Schnepper's suggestion (in the video above) is that the tombstone is executable code, which can lead to metrics and even automated code removal. Buyer beware!
- johnmaguire2013 12y agoGlad to hear this isn't an odd concept. When I see others have commented out code in our codebase, I do a quick git blame (Sublime Git ftw!) and if it's from the previous year I'll just delete it.
- rjbwork 12y agoWe aggressively delete code. Hg/git will have it if you ever need it. We never have.
- Groxx 12y agoThis. Though I do often wonder how often I re-type the same thing, because I can't simply uncomment, simply because it's easier to type it out than it is to go hunting through the history. Maybe I should try to make a Git history "redone undos" script or something. When I actually think about it I realize it's probably very nearly never. But it's hard to shake the suspicion :)
- NietTim 12y agoIt's just more convenient to keep the code in, otherwise you'll have to look it up again which takes more time... (and effort, we're developers after all)
- calinet6 12y agoThis was the one thing that my CS professors drilled into my head most: you have source control, why would you comment? You only make your source control more valuable by not commenting out code; since you can then search for its presence more easily. Good advice, all around.
- budu3 12y agoI think it's genetic :) Some people are "code pack rats". They're afraid to delete anything.
- danudey 12y agoWhen you put a lot of time and effort into adding code in all the right places to provide for functional, helpful debugging, tearing it all out afterwards is just going to make you add it back in again when debugging something else down the road. Even if you tear it out, it's way more work to try to pull it all back out, line by line, and re-implement it than to comment it out and leave the actual debugging statements in #ifdef blocks that the pre-processor will pull out anyway.
- nraynaud 12y agoI'm the converse, I break other rules, but I really don't commit commented code (well I have some demo code commented somewhere, but it's runnable code).
- steedsofwar 12y agoCommented code, yuk.
- nextweek2 12y agoThis is bad practice, at best it shows a lack of confidence in what you've written. At worse it shows you don't understand what's going on. Version control shows the evolution of design, if you are leaving in dead code you need to take a step back and think about the real solution.
- gh02t 12y agoDoes anybody know what Apple uses internally as their version control setup? I did some Google searching that seems to suggest they use Git, but I'm curious if anyone knows more.
- jarjoura 12y agoWhen I was there it was a healthy mix of CVS, SVN and git. Engineering wanted to move to git, so I would assume they are on the path to 100% git, annnnd.... probably already are at this point.
- pixeloution 12y agoThere is still some SVN floating about but its primarily git
- jjtheblunt 12y agoThere's a great deal in Perforce too; the P4 gui tools are excellent, by the way, at illustrating changes in source over commits, and are incessantly in use.
- ssmoot 12y agoI've heard this so much. Usually from people who reinvent the wheel five times over. I've never seen anyone dig through VCS history to gain a better understanding of code. And since presumably things change because the understanding evolves, I'm not even sure what the thought process is that would lead someone to do that. You comment out code because your understanding might not be perfect, you might want the option to easily roll-back, or even have a reminder that a particular change was made. You'll remove it in the next revision or two. So yeah. I've heard this before. It's complete and total nonsense IME.
- 10098 12y agoExterminate it with a flamethrower
- callumprentice 12y agoI thought Carbon was already deprecated in favor of Cocoa - does that header mean it's still being used in the Yosemite?
- vor_ 12y agoCarbon applications are deprecated, but there are C-based APIs still in use that fall under that umbrella term, such as Keychain Services.
- callumprentice 12y agoUnderstood. Thank you.