So i am pretty sure my C++ teacher is bullshitting us...Do the "pros" use Truth Tables?
Name:
Quam2005-01-12 3:03
By "truth tables", I can only assume that you mean looking at a chart that show you T and F for some given inputs... I have maybe once in my life actually sketched out a truth table when it wasn't for a logic or computer engineering 101 class, and even then it was probably because I wasn't sure what I was trying to accomplish.
But then, I'm a web programmer and I mostly work in C#/.NET, not C++. I'm sure someone somewhere takes truth tables very seriously. That would be your teacher. Have fun!
Name:
Anonymous2005-01-12 8:01
What kind of truth tables? More involved ones like Karnaugh maps? Corner cases in logic that aren't easily solvable? Logic design? Yes, sometimes.
Or do you mean things like for AND, OR, XOR, NAND, NOT, etc? No, of course not, any real coder can do that pretty much unconsciously.
Name:
Virtual Korean!DSv3yyjLCE2005-01-12 16:35
(my thread, forgot name)
Truth Tables like
A | B | (A and B)
T | T | T
T | F | F
F | T | F
F | F | F
Name:
Anonymous2005-01-12 16:58
See >>3 then. No programmer, including most novices, use truth tables. They can do it in their head unconsciously for things like AND, OR, NOT, XOR, etc. It's not an option either. You must know how to do them in your head (and they're bloody simple anyway).
So if your teacher meant that programmers always use that knowledge, yes they do. Constantly. If said teacher meant coders actually have truth tables written on post-it notes on the monitor then your teacher isn't qualified to teach programming in any language.
Name:
Virtual Korean!DSv3yyjLCE2005-01-12 17:53
nono, she meant that they sit at their computers and write out truth tables on paper, she also says that "professional programers" also write "Pseudocode" on paper with pencils even though there is a computer right next to them.
Name:
Anonymous2005-01-12 18:29
Well, depending on how complicated your boolean expressions get it might be worthwhile to scrawl a truth table. For example, it may not be immediately obvious that
>>6
Truth tables on paper? Almost never. On very rare occasions it can be helpful. I personally can never recall having needed it, and I do a fair bit of system programming. In cases like >>7 it helps to know boolean algebra (or some form of predicate logic) to do the reduction.
Pseudocode is a different matter. Quiet a few developers do in fact step away from the machine and write pseudocode. I don't do pseudocode myself, but I never attempt to solve a difficult problem (or build a design) while seated in front of a keyboard.
So, for the second it really comes down to style.
Name:
82005-01-12 19:32
>>7 >>8
Yeah, I failed it. b=1, c=0, d=1 fails it, too. Either way, I don't quite see the advantage of that "simplification." Is two XORs and an AND that much quicker than two ANDs, an OR, and a NOT? Especially when you get the advantage of short circuiting with the or? (b=1, c=1 means d doesn't ever have to get evaluated). The "simplification" seems much more complicated to read, and slower to boot.
>>11
I see. But the conversation, before I derailed it, was about boolean operators I thought, not really bitwise operators. Eh, whatever. Thanks for the info.
Name:
Chuiu2005-01-13 0:06
Only for large or complicated statements do I use a truth table.
Name:
Christy McJesus!DcbLlAZi7U2005-01-14 6:25
Truth tables are for people who can't handle boolean algebra, and it's not exactly hard.
Pseudocode is for people living in the 70s where programming languages hate you and there aren't any library routines so you have to code all your algorithms from scratch.
If I write anything on paper it's for a big system where I need to get the architecture down; then I draw out some UML, use it as a starting point for coding and change it as the code suggests new designs.
Name:
Anonymous2005-01-14 16:49
Ugh. UML. A whole new level of hate.
There are considerably better methods for modelling. Why did the industry have to settle on UML? --
Name:
Anonymous2005-01-16 12:42
hmm you really use UML? Never thought of that. Maybe because I am just a beginner and the longest class I've written was 1000 lines. I think comments are enough for that
Name:
!I42/sTTijk2005-01-16 16:26
Why did the industry have to settle on UML?
industry ≇ anything logical
∴ industry chooses UML
also, ⊯ (just because "Negated Double Vertical Bar Double Right Turnstile" is a totally kickass name for a character)z
Name:
!I42/sTTijk2005-01-16 16:27
Why did the industry have to settle on UML?
industry ≇ anything logical
∴ industry chooses UML
also, ⊯ (just because "Negated Double Vertical Bar Double Right Turnstile" is a totally kickass name for a character)z
Name:
Halcyon2005-01-18 12:24
Another question that fits in nice with this one: When designing an application, do you use program structure charts? (I hope I/Babelfish translated that word correct)
Name:
Anonymous2005-01-18 16:23
70's-style flowcharts? No.
There are more modern iterations which do get used occasionally, but nobody except managers take them seriously.
Name:
Anonymous2005-01-19 2:10
I do it the wrong way arround usually. Hey maybe it would be cool to make somthing do this. flowchart fuck flowchart. this little function goes here and this little function goes here hey lets put a loop around this and see how it works out.
well now that it can do this why not add something like this, etc, etc.
Name:
Christy McJesus!DcbLlAZi7U2005-01-19 10:23
>>16
That's s pretty big class. I usually have lots of smaller classes and I need to model it so I know where I am with the object interactions.
Name:
Anonymous2005-01-31 16:08
>>22
thought so but I just can't stop writing once I began and I am too lazy to make up a new class. So I view my function list getting bigger and bigger but I kinda still give them reasonable names so I at least know what they are doing.
And sometimes I make a second class but then later on copy the sourcecode into the first one because I get some really stupid errors or I just don't see the use of a second class. But I guess I gotta change that.
Name:
Anonymous2005-01-31 18:20
Let me take a moment to recommend the book Code Complete. It doesn't show you the one true way -- no book does, but it certainly makes you think about the way you write your code.
Name:
deitarion2005-02-23 6:12
Out of curiosity, does anyone here just use their favorite high-level language in place of pseudocode? I know that's what I do. (And throw in "TODO: What happens" comments here and there)
Name:
JoeOsborn2005-03-13 20:27
>>25
I definitely don't use languages that don't read like pseudo-code. That is to say, I'd rather the language fit my needs than have to contort myself to a draconic syntax. Axiomatic simplicity is the name of the game, and there are only two, maybe three languages for me, in this order: Io (http://www.iolanguage.com), Lisp, and Smalltalk (http://www.squeak.org).
As for a programming methodology(which is basically what this talk turned to), I like Extreme Programming(http://www.c2.com/cgi/wiki), as it mirrors the behaviors of programmers in the wild. And it seems to work.
As for UML, it's a blight and the bane of my existence. Index cards > *; CRC cards(http://www.c2.com/cgi/wiki?CrcCard) are the best modeling tool if you need something more than a paper napkin. Usually, the napkin is sufficient.
Anyone who wants to tell you more than that is probably trying to sell you something.
As for boolean expressions, if they're complicated, factor them out. Turn
( b & c ) | ( (~ b) & d )
into
isHungry | needsToSleep .
There is never any substitute for useful identifiers.
Name:
Christy McJesus!DcbLlAZi7U2005-03-14 7:15
>>25
Microsoft has the patent on TODO lists in sauce code. Or was it IBM, I forget.
>>26
I'm beginning to suspect pseudocode is a relic taught by dinosaurs who had to deal with COBOL and Pascal et al. Powerful languages aren't just for coding in; they're for thinking in.
Now if only we can get this UML ... thing ... off of our necks.
Oh, the promises of the Rational Company, they sound so alluring... but they are the lid on the jar of Pandora's Extra Chunky Peanut Butter, and woe unto the poor bastard who forces me to use Rational Rose.
Name:
Anonymous2005-03-14 10:49
>>6
I loled. I wouldn't want to write a program on paper even if my ass burnt. Pseudocode... I do that on design, and when I need to think of a fairly complex algorithm, to do it from a top-down perspective, and I progressively replace a copy of it by actual code in the program. Of course, I usually write it in a pseudolanguage similar to what I'm going to replace it with.
As for truth tables, I dream in logic, why would I need any. Electronic engineering and optimization like Karnaugh's are a different matter, but I haven't ever needed them in years of programming home and work high and low level.
>>15
Agreed and sharing your experience. I guess UML was adopted by the industry(*) because it ends in ML, and anything that ends in ML, like HTML, XML, etc. is good.
UML is just an industry standard waste of time. With it, you can produce a half-assed, yet self-righteous design (as well as industry standard™) for bloatware. Implement it in Java, and you're done.
(*): And almost anywhere the word "industry" appears to justify something standard it's bad news because either it sucks, it's expensive as hell, or both.
In early system design and early program design stages, I used something that resembled a part of UML, mostly for documentation though. And in any case, it's the tool what you need to adapt to your problem, not your problem to the tool! Never follow methodologies. They suck. In fact, do you know what's the difference between a terrorist and an object methodologist? You can negotiate with the terrorist.
>>19
Never. Or I risk god killing kittens, and boss firing me for wasting my time ^_^.
>>23
Wouldn't it be great if you didn't have to do that OO? But OO is "industry standard", so we have to cope with that even if it's just nice for a few common cases and a pain in the ass for everything else, including maintenance.
>>25
Actually, I use C... with pseudofunctions, of course.
>>26
I guess it's a matter of taste, but (do (you) (really like (((Lisp)'s) syntax))) ?
Name:
Christy McJesus!DcbLlAZi7U2005-03-14 14:41
>>29
Lisp doesn't have "syntax" so much as "notation"
>>32
Um... (say "Yeah I failed at VSO but all I wanted to do is an English parse tree.")
Name:
Christy McJesus!DcbLlAZi7U2005-03-15 19:54
(eval '(this motherfucker!))
Name:
Anonymous2005-04-01 13:31
Truth tables are very much used in architecture design. More importantly for you to understand than truth tables is FORMAL LOGIC.
If you ever plan to work for a bachelors/masters degree in computer science, you absolutely must understand Formal Logic, as well as (formal) Predicate Logic. This is absolutely necessary for any logical proof.
remember, there is a big difference between computer science, and computer programming. If you're going to a technical school for programming, then you can just throw this logic out the window :P
Name:
Anonymous2005-04-01 16:44
i'm filling heaps of paper with text and drawing all the time. Mostly it's not what you call pseudo code but either normal text with code fragments thrown in or real code with text thrown in. I like do dig in a staple of paper more than scrolling through screens over screens of that stuff to look up something.
Of course, that's not for work where i mostly do easier and small things.
Well, the clever people at Anamitech came up with this rather clever box. We plug these wires in to the sockets on the dog’s cheeks, here and here, slip the harness over the back of the head behind the ears and press the green button. The once odor deprived canine can now ’smell’ through a series of 20 microprocessors all stimulating cells within the brain using minute pulses that work together to replicate the dog’s ability to ‘re-assign’, if you like, an objects DNA. Past association to that certain scent structure can now be recalled from deep within the dog’s subconscious. In layman’s terms, it’s a bit like an air conditioning unit/video player that captures smells and chooses which memory to play to back the dog in order for it to recognise the scent.
Why is his head on the floor? Is he recalling memories?
No. That’s because at the moment the box weighs in at about 200kg
Name:
Anonymous2008-03-05 14:30
The truth is a lie.
Name:
Anonymous2008-03-05 15:35
Wow, this must have been what /prog/ was like before everyone read SICP and achieved satori. I don't see one expert bbcode programmer.