Why teach C using scanf without talking about command line arguments?Should I teach modern web development in an introductory programming course? How?Is it okay to teach C++ to my 7 year old brother?Why do educators not set an upper bound for the amount of times we're allowed to compile code?Why and how is it efficient to process sorted arrays than unsorted arrays?Students seem to be unable to use code to express their ideas. Is the teaching methodology improvable?How to teach C++ language to beginners of (BSCS) students who have no any idea about it?How can I improve other programming languages while having command on one languageWhy Computer Science students learn Digital Logic Design?Why do computer science students learn electronics and electric circuit analysis?How to teach so that your student doesn't feel stupid?

Not able to find the "TcmTemplateDebugHost" process in Attach process, Even we run the Template builder

How would thermophilic fish survive?

Operation Unzalgo

What was the difference between a Games Console and a Home Computer?

When can a polynomial be written as a polynomial function of another polynomial?

Grouping into more groups in one iteration

The most secure way to handle someone forgetting to verify their account?

Is there a difference between PIO and GPIO pins?

Change Opacity of Style

Why is Google approaching my VPS machine?

Do dragons smell of lilacs?

Why won't some unicode characters print to my terminal?

How fast does a character need to move to be effectively invisible?

Term “console” in game consoles

Why is the Intel 8086 CPU called a 16-bit CPU?

I want to identify a part from a photo

Necroskitter and creatures dying because of placing -1/-1 counters

Is it ethical for a company to ask its employees to move furniture on a weekend?

Amira L'Akum not on Shabbat

Random piece of plastic

How do you send money when you're not sure it's not a scam?

How is Buchholz score calculated in a Swiss tournament?

Is it possible to breed neanderthals through selective breeding?

Why aren't there any women super GMs?



Why teach C using scanf without talking about command line arguments?


Should I teach modern web development in an introductory programming course? How?Is it okay to teach C++ to my 7 year old brother?Why do educators not set an upper bound for the amount of times we're allowed to compile code?Why and how is it efficient to process sorted arrays than unsorted arrays?Students seem to be unable to use code to express their ideas. Is the teaching methodology improvable?How to teach C++ language to beginners of (BSCS) students who have no any idea about it?How can I improve other programming languages while having command on one languageWhy Computer Science students learn Digital Logic Design?Why do computer science students learn electronics and electric circuit analysis?How to teach so that your student doesn't feel stupid?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








3












$begingroup$


Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



I think this:



$ whatdaywas 1982 02 16
Monday


Is much better than:



$ whatdaywas
Enter a year: 1982
Enter a month: 2
Enter a day: 16
It was a Monday.


Is there any rationale behind this pedagogical approach?










share|improve this question











$endgroup$


















    3












    $begingroup$


    Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



    To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



    I think this:



    $ whatdaywas 1982 02 16
    Monday


    Is much better than:



    $ whatdaywas
    Enter a year: 1982
    Enter a month: 2
    Enter a day: 16
    It was a Monday.


    Is there any rationale behind this pedagogical approach?










    share|improve this question











    $endgroup$














      3












      3








      3





      $begingroup$


      Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



      To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



      I think this:



      $ whatdaywas 1982 02 16
      Monday


      Is much better than:



      $ whatdaywas
      Enter a year: 1982
      Enter a month: 2
      Enter a day: 16
      It was a Monday.


      Is there any rationale behind this pedagogical approach?










      share|improve this question











      $endgroup$




      Most of the books I read give examples using printf and scanf. At some point the students know perfectly how to use these two functions but they don't know about stdin, stdout and argv.



      To me and according to many programming principles (e.g. KISS) a program should not interrupt the execution for prompting the user. Instead, and this is a much clever approach, the developer should learn to use the power of pipes and use the options and the arguments.



      I think this:



      $ whatdaywas 1982 02 16
      Monday


      Is much better than:



      $ whatdaywas
      Enter a year: 1982
      Enter a month: 2
      Enter a day: 16
      It was a Monday.


      Is there any rationale behind this pedagogical approach?







      programming c






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited 4 hours ago









      Buffy

      24.9k9 gold badges42 silver badges86 bronze badges




      24.9k9 gold badges42 silver badges86 bronze badges










      asked 9 hours ago









      nowoxnowox

      1434 bronze badges




      1434 bronze badges




















          3 Answers
          3






          active

          oldest

          votes


















          4












          $begingroup$

          I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



          That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



          As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






          share|improve this answer









          $endgroup$








          • 1




            $begingroup$
            I like the incantation term you use.
            $endgroup$
            – nowox
            6 hours ago










          • $begingroup$
            Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
            $endgroup$
            – thesecretmaster
            3 hours ago



















          2












          $begingroup$

          Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



          They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



          Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






          share|improve this answer









          $endgroup$




















            0












            $begingroup$

            Because, traditionally, programs iterate over data. See JSP.



            Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



            (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)






            share|improve this answer








            New contributor



            Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
            Check out our Code of Conduct.





            $endgroup$












            • $begingroup$
              Do you have a citation for your Pascal factoid? I don't remember that one.
              $endgroup$
              – Buffy
              34 secs ago













            Your Answer








            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "678"
            ;
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function()
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled)
            StackExchange.using("snippets", function()
            createEditor();
            );

            else
            createEditor();

            );

            function createEditor()
            StackExchange.prepareEditor(
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader:
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            ,
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













            draft saved

            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcseducators.stackexchange.com%2fquestions%2f5820%2fwhy-teach-c-using-scanf-without-talking-about-command-line-arguments%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown

























            3 Answers
            3






            active

            oldest

            votes








            3 Answers
            3






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            4












            $begingroup$

            I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



            That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



            As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






            share|improve this answer









            $endgroup$








            • 1




              $begingroup$
              I like the incantation term you use.
              $endgroup$
              – nowox
              6 hours ago










            • $begingroup$
              Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
              $endgroup$
              – thesecretmaster
              3 hours ago
















            4












            $begingroup$

            I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



            That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



            As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






            share|improve this answer









            $endgroup$








            • 1




              $begingroup$
              I like the incantation term you use.
              $endgroup$
              – nowox
              6 hours ago










            • $begingroup$
              Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
              $endgroup$
              – thesecretmaster
              3 hours ago














            4












            4








            4





            $begingroup$

            I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



            That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



            As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.






            share|improve this answer









            $endgroup$



            I think that the rationale is so you don't have to introduce arrays and array notation on day 1. Typically, arrays enter into the picture at roughly the same time as loops, which would take place a few weeks or months later, depending on the pacing of your course.



            That said, if you want to start with command line programs, it's not a huge problem to do so. At the very, very beginning of programming, there are always a few magical incantations that students must type, but won't fully explore until later. args[0] could easily be such an incantation.



            As a side benefit to this approach, your students may have an easier time when they come to arrays, since they've already used them a bit.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered 8 hours ago









            Ben I.Ben I.

            18.7k7 gold badges43 silver badges109 bronze badges




            18.7k7 gold badges43 silver badges109 bronze badges







            • 1




              $begingroup$
              I like the incantation term you use.
              $endgroup$
              – nowox
              6 hours ago










            • $begingroup$
              Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
              $endgroup$
              – thesecretmaster
              3 hours ago













            • 1




              $begingroup$
              I like the incantation term you use.
              $endgroup$
              – nowox
              6 hours ago










            • $begingroup$
              Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
              $endgroup$
              – thesecretmaster
              3 hours ago








            1




            1




            $begingroup$
            I like the incantation term you use.
            $endgroup$
            – nowox
            6 hours ago




            $begingroup$
            I like the incantation term you use.
            $endgroup$
            – nowox
            6 hours ago












            $begingroup$
            Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
            $endgroup$
            – thesecretmaster
            3 hours ago





            $begingroup$
            Can't you still talk about stdin/stdout/stderr without using the argv array? I believe that scanf still just reads from stdin, so you can easily store stdin to a variable.
            $endgroup$
            – thesecretmaster
            3 hours ago














            2












            $begingroup$

            Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



            They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



            Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






            share|improve this answer









            $endgroup$

















              2












              $begingroup$

              Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



              They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



              Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






              share|improve this answer









              $endgroup$















                2












                2








                2





                $begingroup$

                Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



                They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



                Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.






                share|improve this answer









                $endgroup$



                Ultimately they need to understand both ways. Which you do first seems to be a matter of preference - or maybe just following the textbook.



                They need to understand at some point that 'main' in C is an interface with the OS. But, since you can't teach everything at once, you have do pick the order of instruction. But teaching command line params later can give you a way to talk about "elegance" in program design.



                Of course, the program written to accept args needs to behave properly if none (or too few) are presented. Often this defaults to prompting for data in simple programs.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered 9 hours ago









                BuffyBuffy

                24.9k9 gold badges42 silver badges86 bronze badges




                24.9k9 gold badges42 silver badges86 bronze badges





















                    0












                    $begingroup$

                    Because, traditionally, programs iterate over data. See JSP.



                    Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                    (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)






                    share|improve this answer








                    New contributor



                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.





                    $endgroup$












                    • $begingroup$
                      Do you have a citation for your Pascal factoid? I don't remember that one.
                      $endgroup$
                      – Buffy
                      34 secs ago















                    0












                    $begingroup$

                    Because, traditionally, programs iterate over data. See JSP.



                    Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                    (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)






                    share|improve this answer








                    New contributor



                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.





                    $endgroup$












                    • $begingroup$
                      Do you have a citation for your Pascal factoid? I don't remember that one.
                      $endgroup$
                      – Buffy
                      34 secs ago













                    0












                    0








                    0





                    $begingroup$

                    Because, traditionally, programs iterate over data. See JSP.



                    Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                    (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)






                    share|improve this answer








                    New contributor



                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.





                    $endgroup$



                    Because, traditionally, programs iterate over data. See JSP.



                    Admittedly, prompting the user for data is weird, however we're talking about beginners here, having them try to remember what the different fields of data they have to enter isn't the point of the exercise, and is likely to make them view interacting with computers as needlessly complicated. As a bonus, prompting for the values helps make the beginner programs self documenting - the text of the prompt is an explanation of the variable that is to be read - so this will hopefully help our novice programmers understand the simple program without introducing the complex topic of comments.



                    (fun fact: originally in pascal it wasn't legitimate code to output before input, so you couldn't prompt for input. This was quickly abandoned)







                    share|improve this answer








                    New contributor



                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.








                    share|improve this answer



                    share|improve this answer






                    New contributor



                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.








                    answered 48 mins ago









                    GrumpGrump

                    101




                    101




                    New contributor



                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.




                    New contributor




                    Grump is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
                    Check out our Code of Conduct.













                    • $begingroup$
                      Do you have a citation for your Pascal factoid? I don't remember that one.
                      $endgroup$
                      – Buffy
                      34 secs ago
















                    • $begingroup$
                      Do you have a citation for your Pascal factoid? I don't remember that one.
                      $endgroup$
                      – Buffy
                      34 secs ago















                    $begingroup$
                    Do you have a citation for your Pascal factoid? I don't remember that one.
                    $endgroup$
                    – Buffy
                    34 secs ago




                    $begingroup$
                    Do you have a citation for your Pascal factoid? I don't remember that one.
                    $endgroup$
                    – Buffy
                    34 secs ago

















                    draft saved

                    draft discarded
















































                    Thanks for contributing an answer to Computer Science Educators Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid


                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.

                    Use MathJax to format equations. MathJax reference.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fcseducators.stackexchange.com%2fquestions%2f5820%2fwhy-teach-c-using-scanf-without-talking-about-command-line-arguments%23new-answer', 'question_page');

                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Sahara Skak | Bilen | Luke uk diar | NawigatsjuunCommonskategorii: SaharaWikivoyage raisfeerer: Sahara26° N, 13° O

                    The fall designs the understood secretary. Looking glass Science Shock Discovery Hot Everybody Loves Raymond Smile 곳 서비스 성실하다 Defas Kaloolon Definition: To combine or impregnate with sulphur or any of its compounds as to sulphurize caoutchouc in vulcanizing Flame colored Reason Useful Thin Help 갖다 유명하다 낙엽 장례식 Country Iron Definition: A fencer a gladiator one who exhibits his skill in the use of the sword Definition: The American black throated bunting Spiza Americana Nostalgic Needy Method to my madness 시키다 평가되다 전부 소설가 우아하다 Argument Tin Feeling Representative Gym Music Gaur Chicken 일쑤 코치 편 학생증 The harbor values the sugar. Vasagle Yammoe Enstatite Definition: Capable of being limited Road Neighborly Five Refer Built Kangaroo 비비다 Degree Release Bargain Horse 하루 형님 유교 석 동부 괴롭히다 경제력

                    19. јануар Садржај Догађаји Рођења Смрти Празници и дани сећања Види још Референце Мени за навигацијуу