Smalltalk Best Practice Patterns
Rate it:
Open Preview
Read between December 3 - December 10, 2016
39%
Flag icon
Once we had enough memory that we no longer needed to commit atrocities in the name of space efficiency, state still bit us on the backside. Huge programs were written where many many functions used many many different bits of state. No part of the state could be changed without changing many parts of the program.
Jaaved Ali Khan
q: why excessive usage of states became a bad idea? Or excessive usage of serious results in side effects.
39%
Flag icon
In spite of their conceptual and mathematical elegance, functional programming languages never caught on for commercial software. The problem is that programmers think and model in terms of state. State is a pretty darn good way to think about the world.
Jaaved Ali Khan
q: why functional programming did not do well in commerical sotwares - atleast till 1996 ( when this book was published)?
39%
Flag icon
Objects represent a middle ground. State is good, but only when properly managed. It is manageable if it is chopped into little pieces, some alike and some different. Similarly, related programs are chopped into little pieces, some alike, some different. That way, changing part of the representation of the state of a program need lead to only a few, localized changes in the program.
Jaaved Ali Khan
q: how objects are middle ground between functions and procedural language?
39%
Flag icon
Instance variables have a very important communicative role to play. They say once and for all and out in the open, “Here’s what I’m modeling with this object.” A set of objects reveals a lot that was in the mind of the original programmer just by what the instance variables are and what they are named. Be sure to declare instance variables in order of importance in the class definition.
Jaaved Ali Khan
q: what instance variable says about an object?
39%
Flag icon
Instance variables have a very important communicative role to play. They say once and for all and out in the open, “Here’s what I’m modeling with this object.” A set of objects reveals a lot that was in the mind of the original programmer just by what the instance variables are and what they are named. Be sure to declare instance variables in order of importance in the class definition.
Jaaved Ali Khan
**, o: names of instance variables are as important as the class definition.
49%
Flag icon
Temporary variables let you store and reuse the value of expressions. They can be used to improve the performance or readability of methods. The following patterns motivate and guide the use of temporary variables. The examples are taken from Smalltalk, but the discussion applies to any language with procedure-scoped variables.
Jaaved Ali Khan
q: what is the purpose of temparory variable?
49%
Flag icon
Long extent, wide scope, and large type all make variables difficult to manage. If all three factors are present in many variables, you have a program that can only be understood in its entirety. Limiting the scope, extent, and type of variables wherever possible produces programs that are easier to understand, modify, and reuse.
Jaaved Ali Khan
q: what type of temparory variables make the program better?
50%
Flag icon
All performance tuning boils down to two techniques—either you execute code less often or you execute code that costs less. Of these, the first is often the most valuable. It relies on the fact that for reasons of readability, expressions are often executed several times even though they return the same value. Caching saves the value of the expression so that the next time the value is used instantly.
Jaaved Ali Khan
q: 2 techniques for performance tuning in a program?
75%
Flag icon
Good class names provide insight into the purpose and design of a system. They reveal underlying metaphors. They communicate themes and variations. They break the system into parts and show how the parts get put back together.
Jaaved Ali Khan
q: why good names for a class are important?
75%
Flag icon
You’re creating a vocabulary, not writing a program. Be a poet for a moment. The simple, the punchy, the easily remembered will be far more effective in the long run than some long name that says it all, but in such a way that no one wants to say it at all.
Jaaved Ali Khan
o: By giving meaning full names you are creating a vocabulary. It is very important to give appropriate name.
1 3 Next »