Polymorphism -- "if else" statements considered bad, smelly code - Ubuntu Forums
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof.
If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
Tags: OOP, Polymorphism on 2008-10-23 -All Annotations (9) -About
more fromubuntuforums.org
-
gree, nice p
-
If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!
-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!

If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!

If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!

-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!

If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!

If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
-
Also, quite often I'll prefer to deal with 3 if-else than with a factory. One of gurus I know has a rule of thumb: Make generic solution when you do it 4th time. Only then you have enough info collected from special cases that the generalization you design has chance to be future-proof. Chance, not guarantee!

If you do generalizations too soon, you are something Joel Spolsky calls Architecture Astronauts, who use so high abstractions that they run out of oxygen
Exception when calling a DOM method using a reference to it - JavaScript
Illegal operation on WrappedNative prototype object" nsresult:
"0x8057000c (NS_ERROR_XPC_BAD_OP_ON_WN_PROTO
Tags: Browser_Issue, Forums, Mozilla, Firefox on 2008-10-01 -All Annotations (3) -About
more frombytes.com
-
Once that function receives the reference it is just a reference
to a function object and not a method of an object -
It would not necessarily work exactly the same for native code functions
(hence it working with IE) but calling - func(arg); - for a javascript
method would execute it in the global scope and result in the - this -
keyword referring to the window object instead of - elm.parentNode - -
Apparently, Mozilla's DOM methods need a context to execute correctly,
that is, you cannot pass the function without the appropriate "this"
value being set (this makes sense, since DOM object tend to be
prototyped in Mozilla, but not in IE, which therefore probably starts
from internal hash to resolve the property and re-set the "this" value)
What is ruby?
Tags: guide, ruby, programming, documentation on 2008-08-07 and saved by10 people -All Annotations (0) -About
more fromwww.rubyist.net
Generics in C#, Java, and C++
-
And really all they're doing in their
implementation is automatically inserting those type casts for you. So you get the syntactic
sugar, or some of it at least, but you don't get any of the execution efficiency -
because Java's generics
implementation relies on erasure of the type parameter, when you get to runtime, you don't
actually have a faithful representation of what you had at compile time. When you apply
reflection to a genericListin Java, you can't tell what theList
is aListof. -
C# does the instantiation at
runtime.
Artima.com Interviews
Tags: Interview on 2008-08-06 and saved by2 people -All Annotations (0) -About
more fromwww.artima.com
-
A Conversation with James Gosling
-
A Conversation with Bruce Eckel
-
A Conversation with Guido van Rossum
-
A Conversation with Scott Meyers
-
A Conversation with Martin Fowler
Python and the Tipping Point
-
It's very hard to think of everything up front
before you start coding. When you do a design, you think of some things,
perhaps most things. But when you go to implement it, you may learn all kinds of
things that change the design. Getting to a good design usually requires an
iterative process -
Ready,
fire, aim
Bruce Eckel's MindView, Inc: 3-10-04 Generics Aren't
Tags: article, bruceeckel, c++, generics, java, parameterized_type, templating on 2008-08-05 -All Annotations (0) -About
more fromwww.mindview.net
-
Java Generics use "erasure," which drops everything back to
Objectif you try to say "any type." So when I say<T>, it doesn't really mean "anything" like C++/ADA/Python
etc. does, it means "Object." -
generics have no advantage. In fact, it's confusing if you
see them used, because you scratch your head and wonder "why does he need a
generic here? What is the advantage?" Answer: none. -
So if we write generic code that actually takes a "type of anything," that
type can only be anObject, and our generic code must only callObjectmethods on it. -
Generics seem to only solve the problem of
automatically casting in and out of containers. -
So generics are really "autocasting."
-
That's the way of the
Java world, and we are going to miss out on latent typing (it's actually possible
to simulate latent typing using reflection, as I do once or twice in Thinking in Java,
but it's messy and much less elegant).
Coding Horror: Coding Without Comments
on code comments
Tags: Coding, Programming on 2008-07-28 and saved by5 people -All Annotations (0) -About
more fromwww.codinghorror.com
-
ou should always write your code as if comments didn't exist. This forces you to write your code in the simplest, plainest, most self-documenting way you can humanly come up with.
-
if your feel your code is too complex to understand without comments, your code is probably just bad. Rewrite it until it doesn't need comments any more.
Stevey's Blog Rants: Done, and Gets Things Smart
Tags: blog, steveyegge, HR, hiring on 2008-07-04 and saved by8 people -All Annotations (0) -About
more fromsteve-yegge.blogspot.com
-
hey hired brilliant seed engineers.
-
engineers you'd personally hire to work with you in your first startup company?
-
No! Screw that. You want someone who's superhumanly godlike. Someone who can teach you a bunch of stuff. Someone you admire and wish you could emulate, not someone who you think will admire and emulate yo
-
Someone who always seems to be finishing stuff so fast it makes your head spin. That's what my Done clause means. It means they're frigging done all the time.
-
They never seemed to be working that hard, but they were not only 10x as productive as their peers, they also managed technical feats that were quite frankly too scary for anyone else. They could (as just one trait) dive in and learn new languages and make fixes to tools that the rest of us assumed were, I dunno, stuff you'd normally pay a vendor to fix. They dove into the hairiest depths of every code base they encountered and didn't just add features and make fixes; they waved some sort of magic wand and improved the system while they were in there: they would Get Things Smart. Make the systems smarter, that is. Sort of like getting your act together, but they'd do it for your code.
-
You'll gradually realize that your math deficiencies aren't just something that you might need to beef up on if you ever "need to"; you'll see that virtually every problem space has a mathematical modeling component that you were blissfully unaware of until Done, and Gets Things Smart gal points it out to you and says, "There's an infinitely smarter approach, which by the way I implemented over the weekend."
-
your seed engineers: the ones who will make or break your company with both their initial technical output and the engineering-culture decisions they put into place — decisions that will largely determine how the company works for the next twenty years.
-
I think, that the Done, and Gets Things Smart folks aren't necessarily your friends. They're just people you're lucky enough to have worked with.
-
If you could mix in one Done, and Gets Things Smart person with every five to ten Smart, and Gets Things Done people, then you'd be in good shape, since the latter, being "smart", can hopefully learn a lot from the former.
-
And because Done, and Gets Things Smart people are worth their weight in refined plutonium, they're probably reasonably happy in their current position
-
eople who are freakishly good at what they do. People who finish things so fast that they seem to have paranormal assistance. People who can take in any new system or design for all intents instantaneously, with no "ramp-up", and who can immediately bring insights to bear that are quite simply beyond your rustic abilities.
-
the biggest enemy of geeks is not incompetence, it's arrogance. Not garden variety "I'm smarter than others" arrogance, but "I'm smarter than mostly everyone else, and I don't need to hear what you have to say, because I'm right, and you have nothing of value to say on this subject." It sabotages effective communication and learning by osmosis from coworkers.
-
being 'done' more often (and the only way there is to 'do' more efficiently)
Things You Should Never Do, Part I - Joel on Software
Tags: Blog, joel, Software_Engineering, Software_development on 2008-06-23 and saved by10 people -All Annotations (0) -About
more fromwww.joelonsoftware.com
-
They decided to rewrite the code from scratch
-
We're programmers. Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand. We're not excited by incremental renovation: tinkering, improving, planting flower beds.
-
The idea that new code is better than old is patently absurd.
-
it's just a simple function to display a window, but it has grown little hairs and stuff on it and nobody knows why. Well, I'll tell you why: those are bug fixes.
-
Each of these bugs took weeks of real-world usage before they were found.
-
When you throw away code and start from scratch, you are throwing away all that knowledge. All those collected bug fixes. Years of programming work.
-
You are throwing away your market leadership. You are giving a gift of two or three years to your competitors,
-
You are wasting an outlandish amount of money writing code that already exists.
-
These problems can be solved, one at a time, by carefully moving code, refactoring, changing interfaces.
-
When optimizing for speed, 1% of the work gets you 99% of the bang.
-
you probably don't even have the same programming team that worked on version one, so you don't actually have "more experience"
-
You're just going to make most of the old mistakes again, and introduce some new problems that weren't in the original version.
Coding Horror: The Noble Art of Maintenance Programming
Tags: Software_development, Blog, Software_Engineering on 2008-06-23 and saved by4 people -All Annotations (0) -About
more fromwww.codinghorror.com
-
This is why code reuse is so hard. This is why everybody on your team has a different function they like to use for splitting strings into arrays of strings. They write their own function because it's easier and more fun than figuring out how the old function works
MySQL :: MySQL Newsletter Efficiently using VARCHAR columns
using varchars fragmrentation sorting
Tags: MySQL on 2008-06-20 -All Annotations (0) -About
more fromwww.mysql.com
-
When MySQL will need to do the sort it will use corresponding fixed length field format, which will lead to larger temporary file and so slower sorting.
COUNT(*) vs COUNT(col) | MySQL Performance Blog
count(col) vs count(*)
Tags: MySQL, Performance on 2008-06-19 -All Annotations (0) -About
more fromwww.mysqlperformanceblog.com
-
Because val column is not defined as NOT NULL there can be some NULL values in it and so MySQL have to perform table scan to find out.
-
whether or not it is a valuable thing to know the accurate number of rows in an entire table at any time
MySQL :: How to Monitor MySQL's performance
Tags: MySQL, Performance, Optimization on 2008-06-18 and saved by3 people -All Annotations (0) -About
more fromwww.mysql.com
-
mysqladmin extended -i10 -r
MySQL Server Memory Usage | MySQL Performance Blog
myswl memory usage
Tags: MySQL, Tuning, Memory on 2008-06-18 and saved by2 people -All Annotations (0) -About
more fromwww.mysqlperformanceblog.com
-
About 256K is allocated at once even if thread is idle - they are used by default thread stack, net buffer etc.
-
if table will perform complex operations such as full table scans, sorts, or need temporary tables as much as read_buffer_size, sort_buffer_size, read_rnd_buffer_size, tmp_table_size of memory might be allocated. But they are only allocated upon the need and freed once given stage of query is done
-
32bit limits into account and probably limit “mysqld” size to about 2.5GB
-
Thread buffers can be allocated more than once for each thread.
-
MyISAM may allocate buffer which is large enough to contain largest record in the given table which is held until table is closed.
-
For example you may find out increasing sort_buffer_size from 1MB to 4MB and 1000 max_connections increases peak memory consumption just 30MB not 3000MB as you might have counted.
-
In practice however you would not have more than 2-3 connections doing it at the same time so you happen to be fine.
What exactly is read_rnd_buffer_size | MySQL Performance Blog
read_rnd-buffer_size
Tags: MySQL, Optimization on 2008-06-18 and saved by2 people -All Annotations (0) -About
more fromwww.mysqlperformanceblog.com
-
it takes only couple of UTF8 VARCHAR(255) to create a row which is longer than max_length_for_sort_data in its static presentation
Peter's Blog - Lazy Function Definition Pattern
function redefining itself
Tags: JavaScript, Designpatterns, Advanced on 2008-06-13 and saved by12 people -All Annotations (0) -About
more frompeter.michaux.ca
-
return arguments.callee.t || (arguments.callee.t = new Date);
-
It will leak memory because the objects (for example, the intermediate objects in a complex calculation) of the original function will be referred by the new closure and never be GC. In fact, they have no chance to be recycled except assigning them from null in the original function—Oops
-
the only problem with your solution is that we would be filling the memory with variables that would never be released, just because of the closures
-
“a,b,c,d,e” will never get released just because of our closure, even if not anymore needed. We just need “result”.
-
var foo = function()
{
return arguments.callee.t || (arguments.callee.t = (function(){
var result ;
var a,b,c,d,e ;
// using a,b,c,d,e to fill return
return result ;
})());
}; -
But, in the above example, the calculation will run for all calls if the final “result” is null, false, 0, NaN,
-
“return a ? a : b”, because in both cases the compiler will have to check the value of “a” before returning it (it means that it is not true that “a” is “immediately” returned in the first case). So, this is not a real shortcut.
-
a sane proposal, achieving the performance enhancements aimed by your pattern, would be using an old way of avoiding closures, by defining all functions outside foo>
-
var getScrollY = function() {
if (typeof window.pageYOffset == 'number')
return (getScrollY = getScrollY.case1)();
var compatMode = document.compatMode;
var documentElement = document.documentElement;
if ((typeof compatMode == 'string') &&
(compatMode.indexOf('CSS') >= 0) &&
(documentElement) &&
(typeof documentElement.scrollTop == 'number'))
return (getScrollY = getScrollY.case2)();
var body = document.body ;
if ((body) &&
(typeof body.scrollTop == 'number'))
return (getScrollY = getScrollY.case3)();
return (getScrollY = getScrollY.case4)();
};
getScrollY.case1 = function() {
return window.pageYOffset;
};
getScrollY.case2 = function() {
return documentElement.scrollTop;
};
getScrollY.case3 = function() {
return body.scrollTop;
};
getScrollY.case4 = function() {
return NaN;
}; -
The core idea of this article is that during the execution of a variable’s function value, it is possible to change that variable’s function value. I believe this idea is solid. Clearly the implementation of this is tricky in particular cases but can lead to very efficient programs.
SHOW INNODB STATUS walk through | MySQL Performance Blog
Tags: MySQL, InnoDB on 2008-05-27 and saved by2 people -All Annotations (0) -About
more fromwww.mysqlperformanceblog.com
-
"16384 avg bytes/read" shows average size of read requests. For random IO these should be 16K - page size, for full table scan or index scan read-ahead may be performed which can increase average read size significantly
What MySQL buffer cache hit rate should you target | MySQL Performance Blog
what hit ratio is good
Tags: MySQL, Caching, InnoDB on 2008-05-27 -All Annotations (0) -About
more fromwww.mysqlperformanceblog.com
-
SHOW INNODB STATUS
Todoist
Tags: Todo, calendar, time_management, productivity, tools on 2008-05-07 and saved by143 people -All Annotations (1) -About
more fromtodoist.com
-
he central ideas are presented i
Notation: * = Private bookmark and comment|… = Clipping [?] | … = Public highlight [?]
Recent Tags (50)
- 6Advanced,
- 3Blog,
- 2Browser,
- 3BruceEckel,
- 2Bugs,
- 4C++,
- 5CSS,
- 3Caching,
- 2Cloning,
- 3DOM,
- 4DesignPatterns,
- 7Documentation,
- 4Editor,
- 2Gecko,
- 2Generics,
- 2Guide,
- 5Html,
- 2IE,
- 3InnoDB,
- 2Interface_based_programming,
- 2JSON,
- 7Java,
- 19Javascript,
- 3Linux,
- 8MDC,
- 2MSDN,
- 6Mozilla,
- 15MySQL,
- 3OS,
- 3Optimization,
- 6Performance,
- 13Programming,
- 2Programming_techniques,
- 2Python,
- 6Reference,
- 5Ruby,
- 2Rules_Engine,
- 2Software_Engineering,
- 4Software_development,
- 4Tuning,
- 9Vim,
- 4Windows,
- 3XPCOM,
- 2YUI,
- 2article,
- 3development,
- 2jEdit,
- 2mcconnell,
- 6tools,
- 2w3c
Public Tags (454)
- 1abstractions,
- 1access_manaement,
- 5access_management,
- 1activedirectory,
- 1adobe,
- 7Advanced,
- 1AdventNet,
- 1agile,
- 2AI,
- 14Ajax,
- 1Algorithm,
- 1algorithms,
- 1Algoritms,
- 1annotations,
- 1antipatterns,
- 10apache,
- 5API,
- 2apple,
- 1applications,
- 1application_security,


