|
|
Into a function? I don't even see how that makes sense.
Generally though I hate dependency injection. It makes it really really hard to find out what type of object you're actually dealing with when you're looking at the code.
|
|
|
|
|
Parameters?
Why not just use Global Variables???
Wait for it...
ROTFLMAO... I did flag this as a JOKE!
That is a HORRIBLE IDEA, for the record...
And for the record, we used a structure, and it worked beautifully.
The tricky part is when you call a function that needs 1 of those parameters... Do you pass the structure, or struct.val3 ? (we based it on the completeness of the function. If we felt it wasn't changing, then we sent as little data as possible, but more than one field meant the structure).
|
|
|
|
|
If the function has "too many" arguments, accept that it's ugly and live with it. Putting them in a struct is just hiding the ugliness and moving the complexity elsewhere, possibly remote from the function call itself. In my mind, it just makes for extra work to understand and maintain.
The optional argument example is a perfect time to use an overload. That way you have a place to document the unique behavior of that variation of the function, and have documented for the next developer which arguments need to be specified as a set.
The struct solution isn't a bad way to hide the problem, although a polymorphic class might be better depending on the needs.
We can program with only 1's, but if all you've got are zeros, you've got nothing.
|
|
|
|
|
If the function requires less than 10 arguments, then I let them be as parameters, otherwise, I may start making classes of the one that have something in common and pass that instead.
|
|
|
|
|
A simple object would suffice.
modified 20-Oct-19 21:02pm.
|
|
|
|
|
Three of my computers developed completely different problems this morning.
0) The wife's PC exhibits a noise coming from the hard drive.
1) My database server decided that Windows 7 was not longer genuine. I reinstalled Weven and am now in Windows Update hell.
2) My own PC had two fans go out
3) The NIC on my laptop expired - no wifi, no hard-wire. For all intents and purposed, it's practically useless.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
Did you feed any of them after midnight?
|
|
|
|
|
... Either that or he got them wet.
|
|
|
|
|
Paul Watt wrote: he got them wet.
Last time I got an electrical device wet, it also acted bizarre.
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Entropy isn't what it used to.
|
|
|
|
|
John Simmons / outlaw programmer wrote: 0) The wife's PC exhibits a noise coming from the hard drive.
Something is dying... Back it up.
Coincidentally, around this time last year my HDD was dying too
Beauty cannot be defined by abscissas and ordinates; neither are circles and ellipses created by their geometrical formulas.
Carl von Clausewitz
Source
|
|
|
|
|
I already did, and went this morning to get a new hard drive. Restoring from the backup as we speak...
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
The house transformer is probably not beyond suspicion? (or do you have spike protection)
|
|
|
|
|
I have a whole-house surge suppressor and all six desktop computers are on separate 1100ma UPS devices. Although not out of the question, I suspect a power spike is not the problem.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: I suspect a power spike is not the problem So you're going with the evil pixies theory, eh?
Software Zen: delete this;
|
|
|
|
|
Yeah - otherwise, I'd have to go with coincidence, and we all know there's no sch thing. Pixies, on the other hand, are very real.
".45 ACP - because shooting twice is just silly" - JSOP, 2010 ----- You can never have too much ammo - unless you're swimming, or on fire. - JSOP, 2010 ----- When you pry the gun from my cold dead hands, be careful - the barrel will be very hot. - JSOP, 2013
|
|
|
|
|
John Simmons / outlaw programmer wrote: Pixies, on the other hand, are very real.
Quite true!
Once the evil pixies move in, the only cure I've found is to shut down everything electronic for a few hours, spend some time relaxing at the shooting range, then come back after they've moved along. It doesn't fix the damage they've already done, but it stops them from committing more mayhem.
Will Rogers never met me.
|
|
|
|
|
The ethics of technology and their application is an oft debated subject. What is ignored is that, without technology, these debates on ethics and morality would not even occur. While it has been cited that our social development has been lacking with regards to our technological development, it is technology, in part, that forces us to develop socially as well. The nature of this tension between an objectifying technology and the subjective issues of ethics and morality is even found in the words we use to describe technologies.
The word "device" has several meanings:
- a thing made for a particular purpose; an invention or contrivance, especially a mechanical or electrical one.
- a plan or scheme for effecting a purpose.
- a crafty scheme; trick.
- a particular word pattern, figure of speech, combination of word sounds, etc., used in a literary work to evoke a desired effect or arouse a desired reaction in the reader: rhetorical devices.
- something elaborately or fancifully designed.
Note how a term we often use when speaking of our technological gadgetry can be both "a thing made for a practical purpose" and "a crafty scheme; trick."
The word "machine" has a similar duality -- "a mechanical apparatus or contrivance", deriving from the Latin machina, again includes the concept of a "trick." The similar word "machination" means "an intrigue, plot, or scheme."
As software engineers, we employ our "craft" in the construction of computer programs, using the definition "an art, trade or occupation requiring special skill", however, the term can also mean "skill in deception and trickery."
Even the word "technology", deriving from the Greek teckhne, "was not concerned with the necessity and eternal a priori truths of the cosmos, nor with the a posteriori contingencies and exigencies of ethics and politics." (http://en.wikipedia.org/wiki/Techne) In this interpretation we see that technology lives outside the realm of truth and ethics. Further "Epistêmê is the Greek word most often translated as knowledge, while technê is translated as either craft or art." (http://plato.stanford.edu/entries/episteme-techne/) Here again we have a reference to "craft."
It is an interesting thing to notice how several of our words, "device", "machine", "craft", and "technology", have a duality to them, indicating both something representing skill and purpose as well as craftiness and trickery. This duality has its parallels and expression in the complexities in determining the ethics of a technology in all its various applications.
-- Reference: In the Belly of the Beast, Technology, Nature, and the Human Prospect, Steve Talbott, 2004, ISBN: 0-9744906-1-X
|
|
|
|
|
Marc Clifton wrote: a duality to them, indicating both something representing skill and purpose as well as craftiness and trickery I suggest that the 'skill and purpose' connotations were supplied by the technical folks who created the words, and the 'craftiness and trickery' by the great unwashed hordes that couldn't understand what the technical folks were yammering on about.
Software Zen: delete this;
|
|
|
|
|
I'd counter-suggest that the duality is inherent and independent of the knowledge divide. Why this should be so is obvious. Any labour saving device is both a good thing in that it makes some task easier and a bad thing in that it robs us of some part of our identity as an achiever of tasks; a good thing in that it increases the number of tasks that might be achieved and a bad thing in that it increase the number of tasks we are expected or required to achieve. And, of course, any technological advance leaves us open to the charge of hubris, the 'sin' most likely to lead to disaster. Progress we may call it but the inescapable fact is that it always pulls us as far backward as it does forward and for the most part there's not a damned thing you can do about that.
|
|
|
|
|
Okay,
while I agree with the simple fact that we would not have these debates without the technology, I laugh at the various meanings references.
In AI classes we studied the difficulties involved in parsing ANY natural language and discovering the meaning. My favorites were always:
Fruit flies like a banana.
Their spirits are strong, but their muscles are weak.
If a farmer has less than 5 kids, he can only kill 1 kid per year.
The first one has 2 different ways to read it, the second is variable based on what Spirit means. Without context, it could be a restaurant review (Wine and Seafood), or a statement about the troops being tired and yet willing. That last is a paraphrased old law. In this case, kid was a reference to animals, not children.
So, even over time, accepted meanings change, and one word changes everything.
Like everything else, it is not what we hear, but the meaning we apply to the words we heard...
Interesting sermon...
|
|
|
|
|
Marc,
Very nice. Good definitions and insights.
Here's some of my thoughts:
1. Most developers/coders are not actually "software engineers". Nor do they actually "engineer" anything. They just "write" code. But would you actually fly in a plane that was "written" rather than "engineered"? This last weekend I made a note that I'm going to have to finally write a book about software engineering rather than "writing" or "coding" software because I mention it significantly in a book that that I'm currently writing. If anyone has suggestions for materials or reference books/blogs/etc on "software engineering" versus "software writing/coding" I'd like to hear them. Thanks!
2. Devices/Machines/Tools are all really what I would call "Constructs". A Construct can be a physical tool or device that extends our normal body actions (that's what all tools really do) or it can be a conceptual construct that provides a structure to knowledge/ways of looking or classifying or organizing ideas/thoughts. Software is really a tool, a construct, and a very poorly defined one at that. Ideas for "constructing" can be as simple as the creation of a struct or class instead of using a loose grouping of global variables to the development of true software engineering (which has not occurred yet). Thus, there can be devices/machines/tools of a conceptual nature also.
3. Ethics is all about actions and their results and ramifications (echoing results). Each person engages in interaction with their 3D environment here. And use tools and machines to extend and amplify those actions. Ethics/morality can only apply to individuals. Tools have no ethics or morals. While the intended action of a tool may have sinister implications (a doomsday device for example) the tool technically does not have ethics or morals although it may provide any easy avenue towards misuse by an individual(s) which would be immoral/unethical. So we should look at tools and devices as only things, sometimes with implicit intents, and focus on the people/individuals who would build and/or use them.
4. The duality you mention is interesting. I would ask, "What is the purpose of the device? It's intent? And it's vector of change that it performs?" The device/machine/tool is an Object built with intent and purpose. And it can show the intent(s) of the creator/builder as well. I think that this is the duality to which you write.
But how does this apply to software?
Perhaps viruses, malware, and Trojans are the doomsday devices of software with unethical intent. Other tools are just tools without evil intent buy may be simply misused. A hard disk format utility comes to mind. Much software is poorly written but usable. And the constant pseudo-evolution of software and software development shows an immature field (where's the engineering for example) and the inability to actually build good generic general purpose tools that can do elementary things like nicely represent (and update) data from a person to/from a database. But are you trying to say something more?
- Grant
Cary Grant Anderson
-------------------------------------------------
www.CGrantAnderson.com, www.CaryGrantAnderson.com
|
|
|
|
|
Can I get an EOF
MAn! That is a great line.
|
|
|
|
|
Very interesting and provocative, Marc. Thank you.
Even after reading your mini-essay quite a few times, I remain at a loss as to your point. But, I did enjoy it.
As I read the curious references to trickery in relation to the definitions, I was reminded that there has always been, it seems, a certain mysterious quality to technology for most people. The Arthur C. Clarke quote came to mind, "any sufficiently advanced technology is indistinguishable from magic." (from memory)
I experience the same wonder and awe at seeing a great magician perform. I think it's the same thing. Objectively, the magician is executing a known, rationally explainable, physical act; so from the magician's perspective, it ISN'T magic. Since I, the audience, have no clue how it's done, to me there's mystery, and it IS magic.
How this all ties into ethics is this for me...
a) some people fear what they don't understand;
b) some people imagine the worst possible outcomes;
c) some people are moved to attempt control of everyone else's behaviour because of a) and b).
It is unethical and immoral to limit my freedom to employ and enjoy technology, just because you're frightened I MIGHT do something unethical or immoral with it.
On the other side, I have a responsibility to use technology ethically and morally - according to the codified standards of society; i.e., the laws of the land.
Cheers,
Mike Fidler
"I intend to live forever - so far, so good." Steven Wright
"I almost had a psychic girlfriend but she left me before we met." Also Steven Wright
|
|
|
|
|
I got this in the mail recently.
Question: What is the truest definition of Globalization?
Answer: Princess Diana's death.
Question: How come?
Answer : An English princess with an Egyptian boyfriend crashes in a French tunnel, riding in a German car with a Dutch engine, driven by a Belgian who was drunk on Scottish whisky, (check the bottle before you change the spelling), followed closely by Italian Paparazzi, on Japanese motorcycles, treated by an American doctor, using Brazilian medicines.
This is sent to you by a Sri Lankan, using the American Bill Gates' technology, and you're probably reading this on your computer, that uses Taiwanese chips, and a Korean monitor, assembled by Bangladeshi workers in a Singapore plant, transported by Indian truck drivers, hijacked by Indonesians, unloaded by Sicilian longshoremen, and trucked to you by Mexican illegals.....
That, my friends, is Globalization !
|
|
|
|
|