Computer Science Canada

2nd day of turing! XD

Author:  bc123 [ Fri Oct 16, 2009 2:08 pm ]
Post subject:  2nd day of turing! XD

hey i just wanted to show some of the stuff i made and today is my 2nd day of turing! Mr. Green
Turing:
%Stat Viewer
%bc123
%Hockey Stats
%Oct 16 2009
put "Hello compsci.ca"
put "I made this program to view statistics of hockey players"
put "You might not need this becuase u can just check the nhl site for statistics"
put "If you are reading this, thank you for trying something i made XD "
put "instructions : answer what is asked, please DO NOT use spaces or symbols, if u need to space it out then use underscore"
var player : string
var goals : int
var assists : int
var percent_of_shots_scored : real
var wins : int
var losses : int
locate (10,25)
put "Enter your Hockey Player"
get player
locate (11,25)
put "Enter goals"
get goals
locate (12,25)
put "Enter assists"
get assists
locate (13,25)
put "Enter Percent of shots scored"
get percent_of_shots_scored
locate (14,25)
put "Enter wins"
get wins
locate (15,25)
put "Enter Losses"
get losses
put "   Statistics :\n", "Name : ", player, "\nGoals scored : ", goals, "\nAssists : ", assists
put "Percent of shots scored: ", percent_of_shots_scored
put "Wins : ",wins
put "Losses : ",losses


If i can add to this plz tell meh Wink

Author:  ecookman [ Fri Oct 16, 2009 7:34 pm ]
Post subject:  RE:2nd day of turing! XD

You have really come far from where you were struggling with yesterday.

There are always things that you can to any program, for instance you could create a part that checks to see that the user has entered the right text. Just a thought.


Oh one last thing just being picky...when you are using variables that are more than one word, in standatd practice it looks like this:

firstSecondThirdNoUnderscores.

Author:  Tony [ Fri Oct 16, 2009 7:49 pm ]
Post subject:  Re: RE:2nd day of turing! XD

ecookman @ Fri Oct 16, 2009 7:34 pm wrote:
in standatd practice it looks like this:

firstSecondThirdNoUnderscores.


That is very much not "standatd" [sic].

There isn't really a consensus on which guideline to follow; although there _is_ a consensus that the naming of variables should be consistent throughout the project. Personally, I think that underscore_delimited_naming is cleaner and easier to read.

Author:  bc123 [ Sat Oct 17, 2009 7:49 am ]
Post subject:  RE:2nd day of turing! XD

hey how would i enter player name with a space and not underscore??

Author:  BigBear [ Sat Oct 17, 2009 8:31 am ]
Post subject:  Re: 2nd day of turing! XD

replace

get variable

with

get variable : *

Take a look Here for more information

Author:  bc123 [ Sat Oct 17, 2009 8:35 am ]
Post subject:  RE:2nd day of turing! XD

Thnx realy helpful XD

Author:  ecookman [ Sun Oct 18, 2009 8:41 pm ]
Post subject:  Re: RE:2nd day of turing! XD

Tony @ Fri Oct 16, 2009 7:49 pm wrote:
ecookman @ Fri Oct 16, 2009 7:34 pm wrote:
in standatd practice it looks like this:

firstSecondThirdNoUnderscores.


That is very much not "standatd" [sic].

There isn't really a consensus on which guideline to follow; although there _is_ a consensus that the naming of variables should be consistent throughout the project. Personally, I think that underscore_delimited_naming is cleaner and easier to read.


In my cs class if you made variables with _'s you would automatically fail the assignment. I was taught that firstSecond was the "standard way"

Author:  Tony [ Sun Oct 18, 2009 9:08 pm ]
Post subject:  RE:2nd day of turing! XD

well a) the style of naming isn't a vital enough point to warrant an auto-fail. b) you were taught wrong anyway.

There might be a recommended usage in a language's style guideline (if a consensus on such exists in the community), but the choice is certainly not universal.

Out of Python's PEP8 -- http://www.python.org/dev/peps/pep-0008/
Quote:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Constants are usually declared on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL.

etc.

Author:  ecookman [ Mon Oct 19, 2009 4:26 pm ]
Post subject:  Re: RE:2nd day of turing! XD

Tony @ Sun Oct 18, 2009 9:08 pm wrote:
well a) the style of naming isn't a vital enough point to warrant an auto-fail. b) you were taught wrong anyway.

There might be a recommended usage in a language's style guideline (if a consensus on such exists in the community), but the choice is certainly not universal.

Out of Python's PEP8 -- http://www.python.org/dev/peps/pep-0008/
Quote:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Constants are usually declared on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL.

etc.



hehehe I wish I could show that to my CS teacher and be like "READ IT AND WEEP....NOW GIVE ME BACK SOME MARKS."

Author:  bbi5291 [ Mon Oct 19, 2009 5:19 pm ]
Post subject:  Re: RE:2nd day of turing! XD

ecookman @ Mon Oct 19, 2009 4:26 pm wrote:
Tony @ Sun Oct 18, 2009 9:08 pm wrote:
well a) the style of naming isn't a vital enough point to warrant an auto-fail. b) you were taught wrong anyway.

There might be a recommended usage in a language's style guideline (if a consensus on such exists in the community), but the choice is certainly not universal.

Out of Python's PEP8 -- http://www.python.org/dev/peps/pep-0008/
Quote:

Function names should be lowercase, with words separated by underscores as necessary to improve readability.

Constants are usually declared on a module level and written in all capital letters with underscores separating words. Examples include MAX_OVERFLOW and TOTAL.

etc.



hehehe I wish I could show that to my CS teacher and be like "READ IT AND WEEP....NOW GIVE ME BACK SOME MARKS."

I think the real point of this is that hopefully you've learned a valuable lesson: that you should take everything your teacher says with a grain of salt. And don't ever forget that programming is an art --- think about how artists make choices when they create their works of art.

Author:  petree08 [ Mon Nov 16, 2009 7:49 pm ]
Post subject:  RE:2nd day of turing! XD

Programming is a science not an art. it is problem solving not expression.

it can be a tool to bring about art but it in itself is not art.

Author:  Tony [ Mon Nov 16, 2009 8:05 pm ]
Post subject:  RE:2nd day of turing! XD

I would disagree, there is certainly art in programming.

We do talk about how expressive languages are. Programming is social, it's about expressing ideas (of how to solve problems) to others. Some code can be perceived as elegant. Some other code will make you cringe in disgust. There is some chance that both sets of codes will compile down into an identical binary.

Author:  petree08 [ Mon Nov 16, 2009 8:21 pm ]
Post subject:  RE:2nd day of turing! XD

yes some code is more pleasing to eye than others and i would like to think of good code to be artistic but that would be just reading into it too far. Clean concise code is the result of an organized approach, analytical thought process and problem solving to get the most efficient result.

that being said there are very compelling arguments on both sides of this and i don't think we are going to solve the debate on this forum,

but again the end result of the code may be considered an art in the right context


: