12,740 karma · joined Feb 17, 2008 (18y ago) · 2,917 submissions
comment 15y ago · link · parent
comment 15y ago · link · parent
But also, it's a matter of copying what you see. When learning to program for the first time, a developer seems to do most of his or her learning on one platform, and copy that style for the most part (both the good and the bad, in everything from the design of GUIs to programming APIs). Regardless of what you think of either company, is there any doubt that Apple is better at coming up with good examples of design, than Microsoft? I consider Windows to be mediocrity breeding mediocrity; while this isn't 100% true, it's true enough for me to hate using the average PC.
Diversity is also a good indicator of quality; the more methods a programmer is familiar with, the more likely a program is to be well-designed. As a single platform, Mac OS X is pretty diverse; it comes with lots of tools, and is influenced by many different roots (Unix philosophy; NeXT/IBM with Objective-C/Smalltalk; classic Mac OS GUI elements; etc.).
comment 15y ago · link · parent
comment 15y ago · link · parent
Brevity helps maintainability. It increases the chance of correctness. It also saves time; you will never anticipate every question, so it is far better to document some basics and instead just expect to answer questions periodically.
To be able to answer questions, you should document the people involved with each part of a system. This makes it incredibly obvious if you have any holes (i.e. is there any place in the system where, if ONE guy leaves the company, you're screwed?).
OmniGraffle (on the Mac) is an outstanding tool for making various charts.
comment 15y ago · link · parent
If you are feeling a bit adventurous, note that many Mac apps use Cocoa and their text fields tend to share the same text entry system, and people have even written extensions for it. You can tweak config files to change the behavior. The default is a bit Emacs-like, e.g. Control-A to move to beginning of line, Control-E to move to end of line. The traditional Mac OS keys also work, so e.g. Option-left-arrow or Option-right-arrow moves between words; Command-left-arrow and Command-right-arrow move to the beginning or end of the visible boundary of the line you're on; holding down the Shift key selects text as you use cursor keys, etc.
comment 15y ago · link · parent
The "explicit" keyword for constructors addresses part of the problem, but not all of it. The real issue is one of programming style. Personally, I feel this is a case where C++ programmers should think more like C programmers, and not be offended by having to give functions different names, or otherwise making things more distinct when the behavior is totally different anyway.
If I have to call handleChar() and handleInt() with an "if" statement, instead of relying on one of the 12 overloads of handleAnything() to perform magic, I think that is fine because it will one day save me hours of debugging. Notice that printf("%c", c) has pretty damned clear behavior, and it requires someone to say the equally-clear printf("%d", (int)c) to get a number when they want a number; this might not be C++-like, but it's the right way to think about the problem.
comment 15y ago · link · parent
comment 15y ago · link · parent
comment 16y ago · link · parent
Though I think "command-tabbing quickly" isn't a very convenient thing to do...much better to add a "sleep 2 && " in front of the command line (say), so that you can execute it immediately and have it take effect right about the time you're ready for it.
2178.
Ask HN: Thoughts on phone keyboards
2 points · by makecheck · 16y ago · discuss
comment 16y ago · link · parent
comment 16y ago · link · parent
Some companies that sell content have decided to use a heavy-handed approach (DRM), demonstrably punishing their paying customers. They are not looking for new ways to make perhaps even more money in the Internet age; they are only trying to preserve what is arguably a dying business model. They ignore legitimate questions like, "if I can't afford this and you give it to me for half price, and I can easily share it with 10 of my friends, will that generate sales you wouldn't have otherwise seen"?
The "pirates" are a bit like a rally to restore sanity: they provide what people actually want (which is NOT "free movies"), and frankly content companies have been too stupid to realize this outcome. Not everyone cares if a download is free. What they really want is freedom from the bullshit that is digitally shoved into DVDs these days (like previews you can't skip, commercials when you've already paid for content, and other restrictions on what you can do). They want to play something they've bought on one device, and not have an error box come up when they shamefully try to play it on another device that they also own.
If you're wondering why artists don't see much money, take a look at the insultingly small percentages they get from their rich overlords.
comment 16y ago · link · parent
OpenOffice proved that it's possible to break free, but change may come at a glacial pace.
Competitors need a push-button way to get data out of Facebook, they need to match most features, and they need to be free. And, they either have to convince 30 of your friends to switch, or make sure that you can still interact with them perfectly if they choose to stay on Facebook.
comment 16y ago · link · parent
One reason is to have result or loop variables, which help debugging. You can ask debuggers to watch the value change, or print it, and so forth. Almost always create variables; ignore premature-optimization "experts" who think they've sped stuff up because they used fewer variables.
Cleanup isn't repeated. I despise "hunting" for return statements to ensure the same 3 things always happen. Yes, maybe functions shouldn't do so much; but if you're stuck maintaining something you didn't write, you still have to be able to apply a change correctly.
Another problem with multiple returns is inconsistent types. I've seen code where one person did "return false" and another did "return 1.0" in the same function; whereas, if you're forced to type "isOK = 1.0", you'll see the problem immediately.
And a single return point keeps overly-complex logic in your face, so that you have good incentive to fix it. You're less likely to put off refactoring an ugly and oversized function if you keep having to scroll through it to figure out what a single case is doing. Less code is ultimately good for maintainability.
comment 16y ago · link · parent
While C was the first language used, I added the others to gain their strengths, which include maintainability and access to powerful libraries.
comment 16y ago · link · parent