Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #37052 > unrolled thread
| Started by | Andreas Leitgeb <avl@logic.at> |
|---|---|
| First post | 2017-08-03 13:42 +0000 |
| Last post | 2017-08-08 21:00 -0400 |
| Articles | 7 — 5 participants |
Back to article view | Back to comp.lang.java.programmer
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: A small challenge at beginner's level Andreas Leitgeb <avl@logic.at> - 2017-08-03 13:42 +0000
Re: A small challenge at beginner's level Andreas Leitgeb <avl@logic.at> - 2017-08-03 14:02 +0000
Re: A small challenge at beginner's level Martin Gregorie <martin@address-in-sig.invalid> - 2017-08-03 22:47 +0000
Re: A small challenge at beginner's level Eric Douglas <e.d.programmer@gmail.com> - 2017-08-08 08:01 -0700
Re: A small challenge at beginner's level Sebastian <nowhere@nirvana.org> - 2017-08-08 22:59 +0200
Re: A small challenge at beginner's level Eric Douglas <e.d.programmer@gmail.com> - 2017-08-09 05:16 -0700
Re: A small challenge at beginner's level Arne Vajhøj <arne@vajhoej.dk> - 2017-08-08 21:00 -0400
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2017-08-03 13:42 +0000 |
| Subject | Re: A small challenge at beginner's level |
| Message-ID | <slrnoo6aad.o2q.avl@logic.at> |
Stefan Ram <ram@zedat.fu-berlin.de> wrote:
> public final class Main
> { public static void main( final java.lang.String[] args )
> { java.lang.System.out.println( ... ); }}
>
> where an expression can be inserted replacing
> the »...«.
Is it also allowed to fix the atrocious formatting?
> and in between you may use literals of the types double, int
> and String, the operators »+«, »-«, »*« and »/« and
> parentheses »(...)« and method calls of static methods of
> the Java SE standard library.
String.format("you have%5.5s.",String.format("%"+(1+4*Math.round(Math.random()))+".1s"," lost")+"won")
certainly newbie level ;-)
[toc] | [next] | [standalone]
| From | Andreas Leitgeb <avl@logic.at> |
|---|---|
| Date | 2017-08-03 14:02 +0000 |
| Message-ID | <slrnoo6bf2.o2q.avl@logic.at> |
| In reply to | #37052 |
Andreas Leitgeb <avl@logic.at> wrote:
> Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>> public final class Main
>> { public static void main( final java.lang.String[] args )
>> { java.lang.System.out.println( ... ); }}
>>
>> where an expression can be inserted replacing
>> the »...«.
> Is it also allowed to fix the atrocious formatting?
>
>> and in between you may use literals of the types double, int
>> and String, the operators »+«, »-«, »*« and »/« and
>> parentheses »(...)« and method calls of static methods of
>> the Java SE standard library.
> String.format("you have%5.5s.",String.format("%"+(1+4*Math.round(Math.random()))+".1s"," lost")+"won")
> certainly newbie level ;-)
Apparently still too hard for me to get right at first...
(Java doesn't use [precision] for 's', so it always printed same)
alternative: (even shorter and simpler)
String.format("you have %s.",String.format("%"+(1+Math.round(Math.random()))+"$s","won","lost"))
[toc] | [prev] | [next] | [standalone]
| From | Martin Gregorie <martin@address-in-sig.invalid> |
|---|---|
| Date | 2017-08-03 22:47 +0000 |
| Message-ID | <om0965$6tt$1@dont-email.me> |
| In reply to | #37052 |
On Thu, 03 Aug 2017 13:42:46 +0000, Andreas Leitgeb wrote:
> Stefan Ram <ram@zedat.fu-berlin.de> wrote:
>> public final class Main { public static void main( final
>> java.lang.String[] args )
>> { java.lang.System.out.println( ... ); }}
>>
>> where an expression can int be inserted replacing the »...«.
>
> Is it also allowed to fix the atrocious formatting?
>
>> and in between you may use literals of the types double, int and
>> String, the operators »+«, »-«, »*« and »/« and parentheses »(...)«
>> and method calls of static methods of the Java SE standard library.
>
> String.format("you
> have%5.5s.",String.format("%"+(1+4*Math.round(Math.random()))+".1s","
> lost")+"won")
>
> certainly newbie level ;-)
At the bare minimum you should be teaching:
- proper use of insertion symbols in format strings - even showing them
"%5.5s" as a bad example is abominable
- at least one conditional form:
either
if (condition) ... else ....;
or
( condition ? trueval: falseval )
- assignments
If only because showing them both condition forms and assignments would
let them write:
double selector = Math.round(Math.random());
System.out.println("You have " + (selector > 0.5 ? "won" : "lost"));
or
double selector = Math.round(Math.random());
String result = "lost";
if (selector > 0.5)
result = "won";
System.out.println("You have " + result);
Both of which are, in my opinion anyway, both simple to write and simple
to understand.
If you're not going to teach them anything about conditionals at the point
where you give them the exercise, then don't set them problems that are
expected to produce conditional results: just stick to calculations,
e.g. ask them to calculate the difference Math.PI and 22 divided by 7:
double diff = Math.abs(Math.PI - (22.0/7.0));
System.out.println("22/7 differs from Pi by " + diff);
--
martin@ | Martin Gregorie
gregorie. | Essex, UK
org |
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2017-08-08 08:01 -0700 |
| Message-ID | <199fd5af-e4a2-4451-97bf-0e19ad9fc2d9@googlegroups.com> |
| In reply to | #37052 |
On Thursday, August 3, 2017 at 9:47:12 AM UTC-4, Andreas Leitgeb wrote:
> String.format("you have%5.5s.",String.format("%"+(1+4*Math.round(Math.random()))+".1s"," lost")+"won")
>
> certainly newbie level ;-)
Stefan's posts don't show up in Google Groups, so I'd like to see the original full question.
The first simple beginner's challenge should of course be the FizzBuzz test.
I agree with the sentiment of this thread, beginner challenges should be practical. Don't ask them to write obscure logic or syntax they'll likely never need in the real world.
I've only tried to teach programming to a couple people who were incapable of learning (to verify, had another developer also fail to teach them), so I'm not sure what a typical programmer needs to hear to get started on their first training of their first ever programming language. My first language was BASIC in 8th grade, a few decades ago.
Now I already know more than a few languages myself, but when I teach myself a new language I like to copy and paste working code then start changing it to do something different. I'm not sure how well this would translate to a class if each student would want to personalize their code to enjoy learning. Maybe one wants to write a program that has to do with dogs, and another with cars. Just in the end make sure they can code. One guy I tried to teach was completely clueless and had a BS in programming from a college that apparently teaches programming theory with no hands on.
[toc] | [prev] | [next] | [standalone]
| From | Sebastian <nowhere@nirvana.org> |
|---|---|
| Date | 2017-08-08 22:59 +0200 |
| Message-ID | <omd8oa$6bb$1@news.albasani.net> |
| In reply to | #37083 |
Am 08.08.2017 um 17:01 schrieb Eric Douglas:
> On Thursday, August 3, 2017 at 9:47:12 AM UTC-4, Andreas Leitgeb wrote:
>> String.format("you have%5.5s.",String.format("%"+(1+4*Math.round(Math.random()))+".1s"," lost")+"won")
>>
>> certainly newbie level ;-)
>
> Stefan's posts don't show up in Google Groups, so I'd like to see the original full question.
> The first simple beginner's challenge should of course be the FizzBuzz test.
You can get into deep waters with FizzBuzz. You could even teach an
entire undergraduate course about programming principles with it. See
for example
http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/
-- Sebastian
[toc] | [prev] | [next] | [standalone]
| From | Eric Douglas <e.d.programmer@gmail.com> |
|---|---|
| Date | 2017-08-09 05:16 -0700 |
| Message-ID | <d9fa01e9-04c4-43ff-aef4-525dbc22c527@googlegroups.com> |
| In reply to | #37090 |
On Tuesday, August 8, 2017 at 5:00:17 PM UTC-4, Sebastian wrote: > You can get into deep waters with FizzBuzz. You could even teach an > entire undergraduate course about programming principles with it. See > for example > http://www.tomdalling.com/blog/software-design/fizzbuzz-in-too-much-detail/ > > -- Sebastian That article is pretty funny, and while I do sometimes agree we need to "keep it simple, stupid", we have also had plenty of code oversimplified that needs to be completely rewritten later because we added an option that doesn't fit. A beginner course should start with teaching all the principles to arrive at the first result, understanding variable types, conditional statements, and handling output. An intermediate course should get into the principles that run through some of those other iterations, how to make code more flexible.
[toc] | [prev] | [next] | [standalone]
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Date | 2017-08-08 21:00 -0400 |
| Message-ID | <omdmrs$b6m$1@gioia.aioe.org> |
| In reply to | #37083 |
On 8/8/2017 11:21 AM, Stefan Ram wrote: > Eric Douglas <e.d.programmer@gmail.com> writes: >> The first simple beginner's challenge should of course be the FizzBuzz test. > > Depends on the definition of "beginner". I am often giving > beginner's courses with just 18 hours for participants with > no previous programming knowledge/experience, and I can report: > > At the /end/ of my beginner's course most (estimated: at > least 95 percent) of the participants of this course will > /not/ be able to pass FizzBuzz. It is already too > advanced/difficult for them. > > Of course, I could modify the course so that it will > prepare especially for FizzBuzz, and then more would be able > to pass at the end of the course, but this is not my goal. If the content of the training course is somewhat "normal" then I will consider it 100 times more likely that they can do FizzBuzz than your puzzle! > A problem with some books and courses "for beginners" > is that they overestimate how fast beginners can learn. > (At least according to the experiences I made with > participants of my courses. The participants of my courses > are not pre-selected, everyone who pays the fee can > participate. Experiences with participants pre-selected by > some tests or qualifications might differ.) There is a huge different between teaching students with an interest in programming and relevant skills (let us broadly call it skills in math and natural sciences), which usually gets it relative quickly, and students that are having different interests and skills, which in many cases just don't think the IT way. They can be super intelligent etc., but they just don't think the right way for programming. I have taught students in Economics and students in Languages (university students) and I experienced it many times that some otherwise bright students struggled enormously with programming. Arne
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.java.programmer
csiph-web