Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article)
-
@kt_ said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
I SERIOUSLY MISS THIS DISCOURSE'S "THIS THREAD IS FUCKING DEAD IN THE WATER, ARE YOU SURE YOU WANT TO REPLY" TOSTER
NodeBB has one. But then after the first asshat replies, there's a fresh reply so it's not a year old anymore.
-
@Yamikuronue said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
NodeBB has one. But then after the first asshat replies, there's a fresh reply so it's not a year old anymore.
That's what makes necroing so appealing to asshats.
-
@Jaloopa said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
and sounded like I knew things like connection string formats off the top of my head
-
@dkf said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
It's easy: mathematicians say logic is a branch of math, and logicians say math is a branch of logic. Philosophers are wiser, and say both groups should shut up and buy another round of .
It's amusing that in my lifetime programming evolved from being an exact science to some witchcraft were programmers are full of superstition and don't understand how the frameworks they are using work.
-
@Tsaukpaetra said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@mott555 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
for(int i = 0; i < 100; i++)
{
system("sudo format c:");
}FTFY
-
@Yamikuronue this topic has been more fun the second time around anyway
-
@groo said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
It's amusing that in my lifetime programming evolved from being an exact science to some witchcraft were programmers are full of superstition and don't understand how the frameworks they are using work.
Programming is very much about abstracting the complexity of a system to a comprehensible level and working on a small part you understand well.
Abstraction is what allows us to build system complex beyond any single human's mental capability.
-
@Adynathos said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Tsaukpaetra said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Too many errors in the bitstream to correctly decode. Try again with higher resolution?
There is no secret meaning in this, its the picture from wikipedia article about white noise.
WHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!
Thank you for your attention.
-
@kt_ said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Adynathos said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Tsaukpaetra said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Too many errors in the bitstream to correctly decode. Try again with higher resolution?
There is no secret meaning in this, its the picture from wikipedia article about white noise.
WHOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOSHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHHH!
Thank you for your attention.
no, that's not what white noise sounds like.
white noise sounds like KSSSSsSSSSssssSSSSSSSSkSSSSSSKSssssssssssssssSSSSSSSSSSSSSSSSSSSSSSSSS
-
@Adynathos said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Abstraction is what allows us to build system complex beyond any single human's mental capability.
And the Techological Imperative (can == must) is what convinces far too many of us that doing that very thing is always and everywhere an excellent idea.
-
@groo said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
in my lifetime programming evolved from being an exact science to some witchcraft were programmers are full of superstition and don't understand how the frameworks they are using work
To be fair, most of the people who have ever lived are in that exact philosophical position almost all the time.
-
@Fox said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Grunnen No. Something you can google in 5 seconds is not something you need to know.
-
@anotherusername said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Computers perform almost all math by adding.
Anyone who has studied even the most basic hardware design knows that this is false.
First off, from the perspective of the CPU itself, all that happens is that a set of high and low voltages get passed through a set of transistors, based on input received at intervals defined by high signals from a oscillator, with the transformed signals coming out on the same intervals. Everything else is an interpretation we as programmers and users put on those state changes
Design-wise, the actual gates are all NANDs (or NORs, though NAND is the more common form since it is easier to implement in transistors) and inverters. Most of the 'arithmetic' is done in terms of a number of intermediate steps, such as AND, OR, and XOR, which are in turn defined in terms of NAND.
Shifts and rotates are performed through barrel shifters, which are done in the obvious manner of sending the input value for each bit to the output value of the bit n bits over in the appropriate direction, with the bits going off the end being re-routed to the opposite end of the value for a rotate and discarded for a shift. The actual implementation is fairly complex (involving n multiplexers for n bits), but much faster than a single integer addition (though usually the cycle time is determined by longer operations than either of those, anyway).
Integer addition itself is performed in terms of XOR and a ripple-carry, or some variant thereof. A series of n full-adders like the one below are used, with the carry output of a given bit feeding to the carry input of the next.
Two's complement integer subtraction is usually done one of two ways:
- Inline to the adder by inserting a logical XOR into the second operands inputs, and another one to the carry outputs; a selector bit is used for these XORs, as well as for the carry input for bit zero.
- Pre-inverting the value to be subtracted by putting a MUX on each input for the second operand, based on the selector bit; as in the other design, the selector value is also used for the carry in of the zero bit.
The integer multipliers I studied worked through a series of passes, involving a barrel shifter followed by an adder; this used relatively little chip real estate, but required several cycles, which is why the MIPS design I studied de-coupled multiplication and division (to allow other non-dependent operations to continue while the M/D operations were performed rather than stalling the pipeline). However, according to Wicked-Pedo, with modern chip densities this is approach has mostly been replaced by something called a 'Wallace Tree' multiplier (or several variants of it), which can do an integer multiplication in one cycle. The multiplier below is a 2 bit x 2 bit layout, which has a four bit output. While half-adders are part of the design in both cases, there is significantly more to them than that.
https://upload.wikimedia.org/wikipedia/en/7/7b/Binary_multi1.jpg
Division is done is several different ways, not all of which are intuitive. The same is true of pretty much all floating-point operations, which are often done through microcode even in otherwise RISCy designs.
-
@dkf said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@ben_lubar Even the compiler ought to at that code.
I think Ben's point is that this is pretty close to the algorithm the hardware actually uses. From a written code standpoint, it looks absurd; from a digital design perspective, not so much.
-
@Tsaukpaetra Try saving the file as "setup.exe". No seriously.
-
@Tsaukpaetra said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Lorne-Kates said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@fwd said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Lorne-Kates said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
for(int i=0;i>=-100;i--){printf("%d", i * (-1));}
this prints 0 through 100.
That's what I get for copying @fox's shitty code.
You really didn't see that cummings?
FTFY HTH HAND
-
@ScholRLEA cool story bra?
-
@ScholRLEA aaaaand you just went down the rabbit hole. I did say I was talking about mathematical operations, not logic operations? Yes, obviously all of the digital logic is NAND-based. The only point is that all mathematical operations can be broken down into simple steps that are easily explained to a beginner: adding and shifting. Then it's optimized for dedicated silicon traces and it's hardly recognizable as adding, but nevertheless.
The Wallace Tree multiplier, at its core, is basically just dedicated silicon to perform the same thing as the shift-adder multiplier.
-
Programming is about making flashy lights appear on a screen
Sometimes the lights are wrong, and that makes everyone sad
-
@anotherusername said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
all mathematical operations can be broken down into simple steps that are easily explained to a beginner: adding and shifting
How do logarithms break down into adding and shifting?
-
@Jaloopa good effort, though I'm still waiting for an
abstract class forLoopBuilder
followed bypublic static class reverseForLoopByilderFactory
Filed under: Fun fact: due to bad tapping and autosuggest, first two words of this post were originally "food exorcism"
-
@ScholRLEA I made a simple processor in VHDL once. I implemented addition by writing
output <= i1 + i2;
.
-
https://en.wikipedia.org/wiki/CORDIC#Applications
CORDIC uses simple shift-add operations for several computing tasks such as the calculation of trigonometric, hyperbolic and logarithmic functions, real and complex multiplications, division, square-root calculation, solution of linear systems, eigenvalue estimation, singular value decomposition, QR factorization and many others.HP 35 Logarithm Algorithm
multiply intermediate result ... This operation is a pseudo multiplication using adding and shifting ... intermediate calculation step is done simply by shifting the previous result to the right ... and adding the result to the previous intermediate value.http://home.citycable.ch/pierrefleur/Jacques-Laporte/chen.pdf
It is shown how a relatively simple device can evaluate exponentials, logarithms, ratios and square roots for fraction arguments, employing only shifts, adds, high-speed table lookups, and bit counting.
-
stephen@kitchen:/tmp$ cat silly.c #include <stdio.h> void main() { for(int i=0;i<100;++i)printf("%d ",100-i); } stephen@kitchen:/tmp$ diff silly.c sensible.c 3c3 < for(int i=0;i<100;++i)printf("%d ",100-i); --- > for(int i=100;i;--i)printf("%d ",i); stephen@kitchen:/tmp$ gcc -S silly.c sensible.c stephen@kitchen:/tmp$ diff silly.s sensible.s 1c1 < .file "silly.c" --- > .file "sensible.c" 17c17 < movl $0, -4(%rbp) --- > movl $100, -4(%rbp) 20,21c20 < movl $100, %eax < subl -4(%rbp), %eax --- > movl -4(%rbp), %eax 26c25 < addl $1, -4(%rbp) --- > subl $1, -4(%rbp) 28,29c27,28 < cmpl $99, -4(%rbp) < jle .L3 --- > cmpl $0, -4(%rbp) > jne .L3 stephen@kitchen:/tmp$ gcc -O1 -S silly.c sensible.c stephen@kitchen:/tmp$ diff silly.s sensible.s 1c1 < .file "silly.c" --- > .file "sensible.c" stephen@kitchen:/tmp$
-
@Onyx said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
"food exorcism"
Good effort?
Huh, your keyboard just be used to you typing weird things....
-
@Tsaukpaetra that's nothing. One time, I forgot to switch to a private tab before looking for porn...
Google was never the same for anyone else using that computer...
-
@pydsigner said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@slapout1 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
I had a friend who said they stopped giving the FizzBuzz. Said they get people who can't even write an IF statement.
...So they stopped? That'd be a reason for me to keep giving it. Sounds like the is the company that is so bad at advertising their jobs that they can't get enough qualified applicants and are forced to hire people who can't program.
It's for an entry level programmer job at a government agency. The requirements to apply are two college programming classes. Hard to believe you could get through two programming classes and not be able to write an IF statement.
-
@bb36e said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Sometimes the lights are wrong, and that makes everyone sad
Not the HPCs. Usually means some more HP for them.
-
@Onyx said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Google was never the same for anyone else using that computer...
Yeah, not my search results are 4x more likely to include ponies....
Wait, what were we talking about?
-
@groo said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
programmers are full of superstition and don't understand how the frameworks they are using work
And that surprises you? I’m not a real programmer at all (I can write stuff that mostly satisfies my own needs but that’s about it) but it looks to me like encouraging the use of frameworks is pretty much asking for programmers to learn to do things the way the framework wants it without really learning the language they’re using underneath those frameworks. In other words, that they ( overly simplified example ahead) learn to do stuff like
myString.frameworkSuppliedMethods.stringInformation.whatIsCharacterAtPos(FRAMEWORK_CONST_INTEGER_VALUE_1)
instead ofmyString[1]
.Note I’m not saying frameworks are useless. I am saying that I think it’d be better if people learned to code without them and only then begin using them, so that they can do without if they need to, and can hopefully recognise when not using one is the better solution.
-
@groo said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
It's amusing that in my lifetime programming evolved from being an exact science
Bwhahahahahahahaha!!!!!!! Tell me another one!
-
-
@anotherusername said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Darn, thought you were talking about
http://store.steampowered.com/app/317400/
-
@Gurth said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
recognise when not using one is the better solution
No, I'm sorry. The Technological Imperative makes that course of action inadmissible. CAN == MUST. It's just the way things are and always have been. You can argue with me, but you can't argue with progress.
-
mapM_ (putStrLn . show) [100..1]
-
@groo said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
don't understand how the frameworks they are using work.
I mean... with some of the frameworks out there, can you blame them?
-
A useful framework will hide a difficult to understand/solve problem and present an simpler API.
If you have to understand the inner workings of the framework to use it, it means it has failed to encapsulate the problem and does not help you.
-
@Adynathos Exactly, "don't make me think" is the prime objective when making user interfaces, and APIs are user interfaces!
-
@anonymous234 USER INTERFACES if the users are developers.
EDIT: The initialism does stand for Advanced Programming Interface ... at no point does that suggest that is anything for users as most software developers consider them.
-
@lucas1 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@anonymous234 USER INTERFACES if the users are developers.
Developers who don't want to have to know the nitty-gritty of how your library works.
-
@cvi said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@Tsaukpaetra said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@mott555 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
for(int i = 0; i < 100; i++)
{
system("sudo format c:");
}FTFY
'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. 'sudo' is not recognized as an internal or external command, operable program or batch file. <snip>
-
@lucas1 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
USER INTERFACES
NEW SOLUTION:
document.write(webrequest.get(("http://lornespersonalwebsite.example.com/GetFuckingStupidAnswerToShittyCannedProgrammingTest?test_id=100ToOne"));
-
@Lorne-Kates said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
@lucas1 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
USER INTERFACES
NEW
SOLUTIONBUSINESS:document.write(webrequest.get(("http://lornespersonalwebsite.example.com/GetFuckingStupidAnswerToShittyCannedProgrammingTest?test_id=100ToOne?visa=1234123412341234"));
and leave it http - because this is afterall...
-
@ScholRLEA said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Design-wise, the actual gates are all NANDs (or NORs, though NAND is the more common form since
it is easier to implementthey operate faster in transistors) and inverters.If I were on a computer instead of my phone, I'd explain, but it's too much typing for a phone, and most of you wouldn't care, anyway. Inverters are simply a single-input NAND (or NOR) gate.
AND, OR, and XOR, which are in turn defined in terms of NAND.
Can be, but usually aren't. OR is based on NOR. Basing XOR/XNOR on NAND or NOR is inefficient in both chip area and speed. They have their own unique structure.
-
@HardwareGeek said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
Can be, but usually aren't. OR is based on NOR. Basing XOR/XNOR on NAND or NOR is inefficient in both chip area and speed. They have their own unique structure.
TIL, thanks. Ditto regarding the reason why NAND is the more common basis for compound logic gates being due to speed rather than complexity or die real estate.
-
@lucas1 If developers are users, users are developers.
When you program, you interact with the API much like how you interact with Photoshop when editing a picture... sure, it's the program that does the actual calling of functions later, but that's secondary (see discussion "source code is primarily written for people").
-
When you program, you interact with the API much like how you interact with Photoshop when editing a picture.
absolute bollox, lets ignore all the UI stuff going on.
-
@anotherusername said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
I'm not sure that SoM supports the claim of it being an exact science, rather the opposite in fact. Abstraction is generally a Good Thing in engineering, as is being able to build upon existing components.
One can know every detail of what they are doing and still be . The problems @groo sees come not from a lack of detailed knowledge of the framework's internals, but from a combination of shoddy design in those frameworks themselves, inaccurate documentation of their purpose, interfaces, and use, and a cavalier attitude towards learning how to use them on the part of many less-competent developers.
(I was tempted to mention the rise of Sewage Outflow and coding-by-copypasta, but these problems were already endemic in the field in the 1980s when I was first learning how to program myself - including copypasta coding, which at the time involved a copy of the latest issue of Byte and a lot of typing - it just that at that time, it was relatively self-limiting due to a smaller scale for the possible mayhem it could lead to.)
-
@ScholRLEA it's not about whether anyone else was able to understand the code that Mel produced. It was written with the precision of a brain surgeon. Granted he had some habits that made it really hard for anyone coming after him to understand what he'd done, and this might be a bad thing, but he definitely made programming an exact science... that's partly why his code was so indecipherable.
-
@lucas1 said in Easier Than Fizz Buzz - Why Can't Programmers Print 100 to 1? (article):
The initialism does stand for Advanced Programming Interface
Bullshit. API stands for application programming interface. GUIs might be interfaces, but they aren't APIs. APIs are what you want to use from code, GUIs are what you want to use from a graphical desktop.