Discussion Locked

Think like a computer

0 helpful
37 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Do you agree with Jonathan Yarden and believe that you can’t be a good programmer unless you think like a computer? Why or why not? Let us know if this information, as featured in the May 12 Internet Security e-newsletter, is useful to you.If you haven't subscribed to our free Internet Security e-newsletter, you're missing out on some great information. Subscribe today!

https://www.techrepublic.com/techmails.jhtml?repID=r001

37 replies

by maxwell edison

I had to read the original post and your answer two times before it registered, but it was a good laugh.

by r_leelavati

Computer is a Toy, which proceeds as you feed. Make it to dance as per the rhythm of your thoughts. So we need to think like creator of computer and not just as a computer.

by rickydoo

I wonder if anyone in the field of AI is working on this subject.
An infinite number of CPUs with an infinite number of clock cycles...

by maxwell edison

The best programmers are ones who can think logically and precisely, not missing a single detail, regardless of how "obvious" it may seem.

When I learned my first programming language (early 80s), that first instructor would illustrate this by constantly reminding us that computers are stupid - that computer's actually can't think. Therefore, we have to tell it exactly what to do.

An analogy:

Start walking

versus

Raise the right foot 4 inches - move the right foot 90 degrees for a distance of 18 inches - lower the right foot 4 inches - raise the left foot 4 inches - move the left foot 90 degrees for a distance of 18 inches - lower the left foot 4 inches - raise........

by maxwell edison

However, since you didn't provide a link to the article - AS USUAL - I can't comment on Jonathan's statement in its intended context.

by oz_media

No Max I'm not jumping on the bandwagon (I got tired of that last rant).
You are 100% right in saying computer programming involves logic, whereas computers are black and white (or should i say 0+1) the ability to resolve coding issues and make thecomputer perform a task is completely dependant on your use of logic. Computers without logical users writing code would be as useful as asking your shampoo bottle what your account balance is.
As for the article, I'm sure it was very nice.:-)

by guruofdos

And a programmer would have to allow for that, breaking these simple steps down even further and providing a logical solution for every possible condition. Max highlighted a point and you then picked up on it...he only broke the problem down to it'sfirst stage, and even his most basic steps could possibly be broken down some more. Conditional fators must be allowed for (is the surface level or not? Is the surface covered in mud or ice? Are we bare-footed or wearing shoes, when gumboots would be more appropriate?) and that is why humans think and computers only process the data given to them according to the parameters of the programming...which is in turn the creation of a supposedly-thinking programmer!

Assume NOTHING! Even the best programmers never 'solo' on a project...always get someone else in to play 'devils advocate' and they may spot something that you have taken for granted.

by guruofdos

Similar example: make a cup of coffee.

1) Make Coffee

or

2) Fill kettle to desired level, connect lead and switch on. While kettle is boiling the water, find out who wants coffee and of those, who requires milk and sugar. Amass the requisite number of mugs and add the required amount of coffee powder, sugar and milk according to preferences already established. When and only when the kettle has boiled, add the water to the already prepared mugs and then stir, deliver and enjoy.

Even the most simple tasks can be broken down into a series of logical sequences, with a few condition clauses. At the end of a day, the computer can only process these steps at the simplest logical level. The secret of good programming is NOT to think like a computer, but to do the thinking FOR the computer, breaking a problem down from it's highest level and defining each step or methodology in the sequence. This then allows the computer to do what it does best...not to think, but to perform mundane and repetitive tasks quickly and accurately. A good system is one where the programmer HAS thought out EVERY step and not just made assumptions that an end user WON'T do something unpredictable!

by cactus pete

There is no link to the article because it hasn't been published yet. It's due out in one of the mails in a few days, but someone, I don't know who, usually sends out the editor's response too early.

That's even worse, I think, than not linking to an existing article...

As for walking, your program crashed, you forgot to include the balance object.

by mrafrohead

And you also forgot to adjust for the nine inch stilleto's on her feet too :)

Because the woman in the red dress. I created her. You know, I could arrange for a "meeting" if you would like.

Mrafrohead

by cactus pete

You forget that this is all taking place in the future! By the time most people will read the article in question, I will have seen Reloaded.

You think that's air you're breathing now? Hm.

by mrafrohead

I finished that pill you were talking about in the other thread.

/me dcc's dpetrak "The Blue Pill"

Mrafrohead

by techrepublic

A quick shout around the office and I find that more than half of the programmers don't even know what these things are!

Surely though it is not up to the programmer of the application do understand the workings of the compiler? Microsoft make .net (or whatever) and it is up to them to make sure it does it's job and up to us to make sure we do ours. Unless working on mission critical systems (such as flight controllers) I imagine that most programmers work on more mundane everyday software like office apps and internet solutions and do not need to know about such things as automatic variables.

Analogy

When you buy a car do you make sure you know how the alternator produces charge for the battery in order that the battery provides the starter motor with charge and the coils with power to send the spark to the plugs etc etc etc... or do you just fork out your hard earned and drive the damn thing and go to work and do the job you are paid for.

Similarly do you expect that users of your application need to know how it works under the hood. Life is too complex already. Who cares?

by cactus pete

Why people love car analogie, I don't know...

But your analogy would be better if you had the right hypothetical subjects in there.

You're comparing a car driver and the auto to a programmer and a platform. The relationship between programmerand car driver doesn't quite cut it. A programmer would be more like a stereo manufacturer. Yes, the car stereo manufacturer should know ho the alternator provides power to the device!

If you as a programmer knows no more about how the code works within a system than a user does, how can you expect to make good software?

If you don't care how your code runs, fine, don't write with a powerful language that gives you control over how well it runs. Use something that end users can master in 30 days.

by david.irving

I agree with you - a programmer who doesn't know (or at least have a nodding acquaintance with) an assembler is more like a mechanic who doesn't understand how the car works. If the driver (cf user) doesn't it's not a big deal, but I wouldn't take my car to an ill-educated mechanic.

That said, I think more buffer overflows are caused through carelessness than ignorance.

by jrosenberger

I think you would want to know these things if your a mechanic. You might not need to know the impedance of the diode's and resistors in the alternator, but you should know where the alternator is and how it works with the electrical system.

by oz_media

I am a licenced mechanic and worked in the field five years as a journeyman before the IT world showed me how to make money without the physical work.
As a mechanic, it is imperative that you know the impedance of the diodes in an alternator, otherwise you become a backyard mechanis who simply replaces working parts until the trouble goes away.
Ok a little nit-picky, I do see your point but had to clear the misconception that a mechanic only thinks in a mechanical way. You just gave a poor analogy.

by rickydoo

that's just my nature.
I know how the electrical system works so if my battery goes flat, I know what areas to look at for the cause. I know how my fuel injection system works, and my transmission, etc etc. When the car goes "Kachunk-a-thunka-chunka" I'm reasonably sure of what the problem is, and I'm not scrutinizing the fuel pump while the gear teeth slowly collect in the transmission pan.
Know your tools as well as your task and it makes the job easier.

by jimhm

As in my other post -it depends on your definition and job description of programmers.

As we move into the OO world here, we are building job classifications, descriptions and functions around it. Lets call them color coded programmers - Red, Blue, Green and yellow - our Red programmers will be Object designers our Blue's code those Objects and store in a library - Green's will assemble the Objects into a program and Yellow's are business analysis that define the spec's of the program.

So our - Red's, blues and greens need to be very logical thinkers, the Yellows need to be process and business thinkers. The yellows don't care how it's done - it just needs to be done - IE - Don't care how you calculate salary just that it is calculated.

So again - not a car / drive - its more on the job function you are fulfilling

by quagm

Everything is a question of degree. In the real world I find myself generally learning what I need to know about 10 minutes after I needed it. Understanding assembly is a goal but so is living in Belize.
Do you suppose that understanding the electrical diagrams of heating systems would make me a better carpenter? If so would you want to pay me?

by dlw6

Don't universities require programming in assembly for a computer science/engineering degree anymore?

In my day (graduated in '91), my BS in Computer Science and Engineering required us to build a computer from the ground up: flip-flops on a circuit board, then a timing circuit, then building a CPU with memory, then programming in assembly, then writing an OS, etc. Each was a different class, of course. While each built on the principles of the previous one, the underlying layers were simulated for each step but the first. The course of study also included the standard stuff (graphics, SQL, and 6 different high-level languages), but we built the computer first.

By the time we were coding trigonometric equations in C to do 3-D graphics rendering, coding SQL databases, or doing our capstone software design project (mine was a word processor), we were definitely thinking like computers.

Are you saying this isn't done anymore? If so, that's unfortunate.

Good fortune,
Don

by cactus pete

Not all software developers are people who went through college. Many are self-taught, at least at first. If they like it, perhaps then they go back for some technical training in that field. By then, fundamentals are assumed.

I firmly believethat if you work, you should do what makes you happy. And if you like it so much, shouldn't you understand how it works? This only makes you better at what you love doing anyway.

by gheitman

Any good resources for the type pf information being prescribed by Mr. Yarden -- besides a BS in CS, etc. ? (books, sites)

That would seem rather scary, though -- "Inner Workings-of-the-Machines-that-Rule-Our-Lives For Dummies" ...

Thanks...

by getabargain4u

But their are hackers out there that are trying to to stop the computer from learning to fix itself because their position will no longer be in high demand. Maybe your next topic is on How to get the computer to fix itself simplified.

by guruofdos

Twenty years ago before ATC, ABS, active suspension and other modern driving aids became common on cars, divers DROVE their car and had to have an awareness of what goes on under the hood. Nowadays we get in, turn the key, point the wheels and go. If we screw up, modern electronics and automotive systems can compensate to an extent. If we push too hard on a bend, traction control and anti-lock brakes can often prevent a crash which otherwise would be left to the skill of the driver or the foibles of the Gods.

Many programmers rely on assumptions and the ability of modern OS's etc. to play the role of ABS and traction control, whereas if their methodology was correct, they would leave nothing to chance.

My wife learned to drive on a car with power assisted steering and ABS and was told that it makes manouvering easier and the car safer. Twenty years ago, I had to learn on a car with none of these luxuries. When the on-board systems fail on a steep descent at the edge of a cliff on a curve, I'm glad I learned how to 'drive'!

by cactus pete

That phrase is the background image on my iPAQ. I love it when people give a little 'half-laugh' upon seeing it.

by jimhm

It all depends on your definition of a programmer - if it is a person that takes detail spec's to code - then no. But if you they are to be involve in analysis, design and code then yes. They need to think in logical steps one thing at a time.

Here's a test for logical thinking - write or try to explane to someone "how to lite a match from a paper match book."

This person just fell out of the sky and knows nothing except the language. They don't know anything about what a match is, whatis fire, how to hold it, how to strick it, what is the front or back, what is a flap. Try it on a friend - or even try something simpler than that - open a pack of gum is another good one.

If you can do it in under 30 pages - good luck..

Computers know nothing before the program starts and know nothing after it ends.. its nothing more than a step by step processing of logical events.

by cactus pete

?If you want to make an apple pie from scratch, first you must create the universe.?
-Carl Sagan

by ravi_g_it

It not fair, just to think as only a computer, but one should be as a rational being. Since it is totally different how the human psycology and of a computer imagination. So be realistic and think like as human thoughts and work with the computer, in such a way make the computer to be worked like a human being. Because these might sometimes leads to the disaster that can't be imagined. So i would like to conclude that that it is not just to think like a computer only.

by cactus pete

It's not "Think like a computer" and that's it. The idea is that you understand how a computer works, so that you write code better adapted to the needs of the customer, inluding better stability, faster, leaner, etc.

by 5q

Do you remember Clipper'87, where "abcd"="abc" is true and "abc"=abcd" is false? (The compiler ends comparing at the end of the right string.)
Yes, the computer cannot think but sometimes following the logic of computation let's you give up so "basic defaults" of your mind that probably "think like a computer" is a good figure of speech in such case.

This discussion is closed to new replies.