Our server costs ~$56 per month to run. Please consider donating or becoming a Patron to help keep the site running. Help us gain new members by following us on Twitter and liking our page on Facebook!
Current time: December 27, 2024, 4:44 am

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Bit flipping
#31
RE: Bit flipping
(Walks in quietly) It's hot in here. (Walks back out)
"Hipster is what happens when young hot people do what old ladies do." -Exian
Reply
#32
RE: Bit flipping
For those of you against the project on the grounds that clean, easy-to-understand code is more important than optimization: I disagree.

The real learning in computer science isn't just the grunt work of learning syntax and the programming basics. It's in finding a love of problem solving and constantly looking to find new angles on your thought about the programming process. Trying to do things without functions, and getting back to simple comparisons, bit rotations, etc., really helps one appreciate the joy of using anything more than assembly language.
Reply
#33
RE: Bit flipping
Dr. Chrisila Pettey would agree.

As would I. That project was 'fun' (as school projects could be) in the deep problem solving that makes me want to be a computer scientist in the first place.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply
#34
RE: Bit flipping
(April 25, 2016 at 8:09 am)bennyboy Wrote: For those of you against the project on the grounds that clean, easy-to-understand code is more important than optimization: I disagree.

Doesn't matter how optimised it is if it's giving you the wrong results.

Code changes over its lifetime. Maintenance introduces bugs. Legibility reduces the chance of bugs being introduced.

Writing legible code is a good habit to develop from the very beginning.
Reply
#35
RE: Bit flipping
(April 25, 2016 at 8:24 am)Mathilda Wrote: Writing legible code is a good habit to develop from the very beginning.

Remember, we're talking about an academic exercise here. It is possible to ask something of students that you would never ask of an employee. We can accomplish both tasks. Sometimes going to extremes is helpful.

For example, we were writing code for a Finite State Machine, and instead of having an if-else statement, I could make a change to one of two states with a single statement that depends on the input. So I turned 8 lines of code into 3. Thinking like that can sometimes help simplify your code.

I assure you, my code is always legible. I am OCD about annotating and whitespace and whatnot.
"There remain four irreducible objections to religious faith: that it wholly misrepresents the origins of man and the cosmos, that because of this original error it manages to combine the maximum servility with the maximum of solipsism, that it is both the result and the cause of dangerous sexual repression, and that it is ultimately grounded on wish-thinking." ~Christopher Hitchens, god is not Great

PM me your email address to join the Slack chat! I'll give you a taco(or five) if you join! --->There's an app and everything!<---
Reply
#36
RE: Bit flipping
(April 24, 2016 at 7:41 am)Cthulhu Dreaming Wrote: Yes... Perl can look like awk, sed, C-like languages, and probably more I can't remember.  Nothing like having a project that uses multiple styles, often badly.

Larry Wall ought to be taken out to the server farm and be forced to enter PDP-11 bootstraps for an eternity.

Literally all my perl programs look like this:

"
Open some files

A while loop reading in the lines from one or more of them

A forest of if conditions with regular expressions, writing some of the stuff in a different file

Close the files
"
The fool hath said in his heart, There is a God. They are corrupt, they have done abominable works, there is none that doeth good.
Psalm 14, KJV revised edition

Reply
#37
RE: Bit flipping
As an exercise, eschewing functions and if-then cascades can force you to consider the problem in alternate ways. Program design is all about choosing the right way to model the problem. If you get in the habit of modeling all problems the same way, both efficiency and clarity can suffer. I was good at building DFAs, so many times I'd program a problem as a DFA, even if it wasn't the most natural way of expressing the problem. (I'm a lousy programmer.) As a student you're both assessed on your ability to be flexible in solving the problem, as well as how good a coder you are. Flexibility is all about the design stage of programming, but it's hard to teach such skills in a classroom. So as a classroom exercise, I think it can be useful.
[Image: extraordinarywoo-sig.jpg]
Reply
#38
RE: Bit flipping
*idly wonders if saying "I write PHP" is the equivalent to "My cat's breath smells like cat food" in this thread....*
"I was thirsty for everything, but blood wasn't my style" - Live, "Voodoo Lady"
Reply
#39
RE: Bit flipping
(April 25, 2016 at 10:32 pm)KevinM1 Wrote: *idly wonders if saying "I write PHP" is the equivalent to "My cat's breath smells like cat food" in this thread....*
I wouldn't say so.

To me, it seems that almost all programming languages are pretty similar.  A new language just means a couple extra trips to Google to figure out some of the syntax.  The real important thing is what platform your langage is for and what libraries you can use out of the box.  If you want to do open-source web programming, PHP is the one you want.  If you want to do client-side stuff on the web, it's jQuery or bust.  If you want to write something for a robotics project, then c or maybe java IMO.  If you want to throw together a complete program in a couple minutes, then maybe C#.  If you want to write plugins for popular graphics development software, maybe Python.

But in the end, it's really all the same language with slightly different accents.  The only thing that is really different, at least to me, is database programming-- that is a really different experience.
Reply
#40
RE: Bit flipping
(April 25, 2016 at 8:24 am)Mathilda Wrote:
(April 25, 2016 at 8:09 am)bennyboy Wrote: For those of you against the project on the grounds that clean, easy-to-understand code is more important than optimization: I disagree.

Doesn't matter how optimised it is if it's giving you the wrong results.

Code changes over its lifetime. Maintenance introduces bugs. Legibility reduces the chance of bugs being introduced.

Writing legible code is a good habit to develop from the very beginning.

Saying that a basketball player should develop a good layup right from the start doesn't mean he shouldn't spend a little time trying to see if he can do a slam dunk.  Yeah, a visually-pleasing program is a good professional practice.  But trying to see how much use you can squeeze into a single line of code, or counting clock cycles on 3 different variants of a routine, can increase programming IQ-- and that can eventually make seemingly impossible tasks possible.
Reply



Possibly Related Threads...
Thread Author Replies Views Last Post
  Coin Flipping Poll Tiberius 15 5766 April 19, 2010 at 1:00 pm
Last Post: Violet



Users browsing this thread: 1 Guest(s)