Skip to Main Content

Java EE (Java Enterprise Edition) General Discussion

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Kids Experiencing Programming in Java - Devoxx4Kids South Africa

Naoko-JCP-OracleJul 6 2020 — edited Jul 10 2020

I was told that Java was a difficult language to teach to kids, hence why the government curriculum didn’t include programming languages like Java in the school curriculum so before we hosted this event on 28 September 2019, I had a challenge in my hands.

When Progate approached me to use their platform to teach kids programming, I tried it out and found it extremely useful so I couldn’t wait to have this event.

I have had various experiences going to disadvantaged school, trying to entice kids to fall in love with programming and, hopefully, take programming and/or other computer science courses in tertiary education.

With over a decade of software development, predominantly coding in Java, and my love to “giving back to society” Devoxx4Kids South Africa was started in 2017 with a simple goal of enticing kids to fall in love with basic digital skills, such as programming, robotics, etc., with the hope that they can become tech innovators of the future.

As we prepared for the event we thought it would be cool to add a Hello World java program at the back of the kids Devoxx4Kids T-shirts, which we supplied to them for free. The Programme we selected was “Java Study 1 - Getting Started with Java.” from Progate. On the day of the event, after brief introduction to programming on Hour of Code and Code Combat and filling our bellies with free pizza for lunch, the moment of Truth arrived.

We did a small slides into presenting on What is Java and why is it relevant in today’s world (made it short and straight to the point) and then it was off to the actual coding exercises.

Learning Programming: What is Java? (teaching kids the basics of Java - Presentation)

Mind you, unlike Hour of Code & Scratch, where one can create code using blocks, our kids had to physically write code segments on the online editor window and submit the solution online (by clicking the submit button below on the editor window) and see what type of errors they were getting OR seeing the output of their code written on the console window, at the right of the editor window.

Yes, we had feared that kids wouldn’t understand data types. In fact, some kids didn’t know what decimal numbers were but after explaining the basic concepts of numbers it was easy for us to carry on with the exercise. In essence, after the end of our Java session, the kids learnt:

  • String object & String concatenation
  • Integers
  • Double
  • Calculations
    • Additions
    • Multiplications
    • Subtractions
    • Divisions
    • Modulus (yes, tricky but all plausible to teach)
  • Variables
    • Using Variables
    • Updating variables
    • Roles of variables
  • Explicit type conversion
  • Implicit type conversion

And they had the opportunity to write a final Java program using what they have learnt. The kids were put in pairs, essentially practising pair programming. We’ve figured out that when kids are put in pairs they solves problems quicker and they can easily teach their peer on how to get to the solution. We’ve even found that they learn to code by themselves without the need of tutors. In short, in the 2 hours that we allocated for this session, only a 6 year child old finished it in 2 hours. The rest were done within an hour.

Summary

We had a school teacher helping us tutoring the kids during the programming sessions and the feedback we received from him was beyond words. You don’t have to believe our words, we’ve attached the YouTube video highlighting what transpired on the day and the feedback we’ve received.

Should our children be taught Java? (Devoxx4Kids event - 28 September 2019)

Also, it is said that a picture says a thousand words, so here are few of those images of the event:

devoxx4Kids_South_Africa.png

The kids thoroughly enjoyed it. In fact, some have asked us to teach them to build Android apps, now that they realise that Android apps are built in Java. Who knows, we might start a course just on mobile apps development!

So, what’s the takeaway from this?

  1. Never box a child. Children have the ability to tackle any challenges, as long as it’s fun, with no perceptions of time and they will eventually figure it out. We were told that Java is not suitable for kids and, yet, a 6 year old managed to write a compilable program in Java.
  2. There is a huge demand for digital skills. Every child that has participated our events have requested for more of such events and they have even shown interest of introducing this to their friends.

Where can you find us? (Like/Follow us, where possible)

P.S. Seeing that the world has changed due to the pandemic and government lockdown regulations in effect, we’re planning to do online video tutorials on programming topics that kids can learn at their own leisure at home. We’re looking for volunteers that are willing to help us create video content that we can upload on our YouTube channel. Please feel free to reach us on any of the above-mentioned platforms if you’re willing to volunteer your services and we will get back to you ASAP.

We can’t wait to hear from you. Thank you for taking time to read this post.

Comments

Laurent Schneider
SQL> select deptno,
  2    replace( replace( replace(
  3      XMLQUERY('for $cc in ora:view("emp")
let $ename:=$cc/ROW/ENAME/text()
where $cc/ROW/DEPTNO/number()=$deptno/d/number()
return <e>{$ename}</e>'
  4      passing by value xmltype('<d>'||deptno||'</d>') as "deptno"
  5      returning content
  6    ),'</e><e>', ','),'<e>'),'</e>') enames
  7  from dept
    DEPTNO ENAMES
---------- --------------------------------------
        10 CLARK,KING,MILLER
        20 SMITH,JONES,SCOTT,ADAMS,FORD
        30 ALLEN,WARD,MARTIN,BLAKE,TURNER,JAMES
        40
http://www.oracle-base.com/articles/10g/StringAggregationTechniques.php
naveenhks
Hi,
Thanks for your response.

I missed out to specify my database version. I am working on below specified version:
Oracle8i Enterprise Edition Release 8.1.7.4.0 - Production
PL/SQL Release 8.1.7.4.0 - Production

and moreover without using dept table is it possible to display all the employee names in single line with "," as delimiter.

like a sql query which displays all the employee names present in employee table in a single string with "," as delimiter.

Thanks!

Naveen.
Jens Petersen
http://asktom.oracle.com/pls/ask/f?p=4950:8:::::F4950_P8_DISPLAYID:229614022562
6363
SQL> select deptno,
  2      max(substr(sys_connect_by_path(ename,','),2)) emps
  3  from
  4      (
  5      select e.deptno, e.ename,
  6          row_number() over (
  7              partition by e.deptno order by e.ename
  8              ) curr,
  9          row_number() over (
 10              partition by e.deptno order by e.ename
 11              ) - 1 prev
 12      from emp e, dept d
 13      where e.deptno = d.deptno
 14      )
 15  start  with curr = 1
 16  connect by prior curr = prev
 17      and prior deptno = deptno
 18  group by deptno
 19  /

 DEPTNO EMPS
------- ----------------------------------------
     10 CLARK,KING
     20 ADAMS,FORD,JONES,SCOTT,SMITH
     30 ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD
     40 MILLER
Jens Petersen
3360,
sys_connect_by_path does not work on 8i, it was introduced in 9i
naveenhks
Can any one help me out in this ............ Plzzzzz
Kamal Kishore
Did you read the link posted above by Jens?
Did you try the solution provided there?
naveenhks
Hi,
I need the output as below :
EMPS
----------------------------------------
CLARK,KING,ADAMS,FORD,JONES,SCOTT,SMITH,ALLEN,BLAKE,JAMES,MARTIN,TURNER,WARD, MILLER

The solution given Jens displays department number wise names , however i want all names to be displayed as mentione above irrespective of department number
6363
Did you upgrade yet?
naveenhks
I am using oracle-8i, is there any possibility to get the result as specified using oracle 8i
Aketi Jyuuzou
create table KeyList(
Key char(3),
Val char(2),
primary key (Key,Val));
insert into KeyList values('AAA','12');
insert into KeyList values('AAA','2A');
insert into KeyList values('AAA','32');
insert into KeyList values('AAA','44');
insert into KeyList values('BBB','11');
insert into KeyList values('BBB','33');
insert into KeyList values('BBB','8S');
commit;
col ConcatVal for a20
select Key,
substr(
replace(
    replace(XMLAgg(XMLElement("dummy",Val) order by Val),'</dummy>'),
    '<dummy>',',')
,2) as ConcatVal
from KeyList
group by Key;
select Key,max(SubStr(sys_connect_by_path(Val,','),2)) as ConcatVal
from (select Key,Val,
      Lag(RowID) over(partition by Key order by Val) as LagRowID
      from KeyList)
start with LagRowID is null
connect by Prior RowID = LagRowID
group by Key;

OracleSQLPuzzle
http://www.geocities.jp/oraclesqlpuzzle

Rengudi
Dear Naveenhks

select 'empno '||empno||','||chr(15) from emp;

Try this.

Ranga
495612
hi naveen, try this
SQL> create table tst ( n varchar2(100);
SQL> declare
H varchar2(100):=' ' ;
begin
for R in (select ename from emp) loop
H:=R.ENAME || ' , ' || H ;
end loop;
insert into tst values(H);
end;
/
SQL> SELECT * FROM TST;
MILLER,FORD,JAMES,ADAMS,TURNER,KING,SCOTT,CLARK,BLAKE,MARTIN,JONES,WARD,ALLEN,SMITH
----- is it what u need ?????
RadhakrishnaSarma

Is this what you are looking for?

SQL> ;
  1  select max(substr(sys_connect_by_path(rtrim(ename), ','), 2, 200)) conc
  2  from (select ename, rownum rn
  3                     from emp)
  4  start with rn = 1
  5* connect by rn = prior rn +1
SQL> /

CONC
----------------------------------------------------------------------------------------------------
KING,BLAKE,CLARK,JONES,MARTIN,ALLEN,TURNER,JAMES,WARD,FORD,SMITH,SCOTT,ADAMS,MILLER

SQL> 

Oh! I didn't see if it doesn't work on 8i.

Cheers
Sarma.

Message was edited by:
Radhakrishna Sarma

495612
Naveen !!! Try this one also.
SQL> set serveroutput on
SQL>declare
v varchar2(100):='';
begin
for r in (select ename from emp order by sal) loop
v:=r.ename|| ',' ||v;
end loop;
dbms_output.put_line(v);
end;
/
--------------
KING,FORD,SCOTT,JONES,BLAKE,CLARK,ALLEN,TURNER,MILLER,MARTIN,WARD,ADAMS,JAMES,SMITH
457512
Its Nice

Thank you
Raj Deep.A
RogerPerkins
I tried the fully generic string_agg function on Oracle 9.2, my output has a space between each character, could that be because my input is an NVARCHAR2?

SQL> select string_agg(licensenumb)
2 from clbce.avgrid
3 group by addby;

STRING_AGG(LICENSENUMB)
--------------------------------------------------------------------------------

a s d f a s f a s d g a s e r, k j h k
A 1 2 3 A B C, 3 P R Y 0 8 6

SQL> column plate format a50
SQL> select string_agg(licensenumb) as plate
2 from clbce.avgrid
3 group by addby;

PLATE
--------------------------------------------------

a s d f a s f a s d g a s e r, k j h k
A 1 2 3 A B C, 3 P R Y 0 8 6

SQL> describe clbce.avgrid
Name Null? Type
----------------------------------------- -------- ----------------------------
AVGRIDKEY NOT NULL NUMBER(9)
CASEDETAILKEY NUMBER(9)
ADDDTTM DATE
ADDBY NVARCHAR2(30)
MODBY NVARCHAR2(30)
MODDTTM DATE
MAKEOFCAR NVARCHAR2(10)
MODELOFCAR NVARCHAR2(10)
COMPLIANCEDATE DATE
LICENSENUMB NVARCHAR2(15)
VIN NVARCHAR2(25)

SQL>

7/5/2007
Alessandro Rossi

Hi,
Thanks for your response.

I missed out to specify my database version. I am
working on below specified version:
Oracle8i Enterprise Edition Release 8.1.7.4.0 -
Production
PL/SQL Release 8.1.7.4.0 - Production

and moreover without using dept table is it possible
to display all the employee names in single line with
"," as delimiter.

like a sql query which displays all the employee
names present in employee table in a single string
with "," as delimiter.

Thanks!

Naveen.

Here it is

Connected to:
Oracle8i Enterprise Edition Release 8.1.7.4.1 - Production
With the Partitioning option
JServer Release 8.1.7.4.1 - Production

SQL> set pagesize 9999;
SQL>
SQL> CREATE OR REPLACE
  2  type string_table as table of varchar2(4000)
  3  /

Type created.

SQL>
SQL> CREATE OR REPLACE
  2  FUNCTION concat_strings (
  3      strtab IN string_table,
  4      sep IN varchar2
  5  )
  6  RETURN
  7      varchar2
  8  IS
  9      outval varchar2(4000);
 10  BEGIN
 11      outval := null;
 12      if (( strtab is not null )and (strtab.count > 0 ) ) then
 13         for i in strtab.first .. strtab.last loop
 14                 if ( outval is null ) then
 15                 outval := strtab(i);
 16                 else
 17                     if sep is not null then
 18                         outval:=outval||sep||strtab(i);
 19                     else
 20                             outval:=outval||strtab(i);
 21                             end if;
 22             end if;
 23             end loop;
 24             end if;
 25      return outval;
 26  END;
 27  /

Function created.

SQL> drop table KeyList
  2  /

Table dropped.

SQL> create table KeyList(
  2  Key char(3),
  3  Val char(2),
  4  primary key (Key,Val));

Table created.

SQL>
SQL>
SQL>
SQL> insert into KeyList values('AAA','12');

1 row created.

SQL> insert into KeyList values('AAA','2A');

1 row created.

SQL> insert into KeyList values('AAA','32');

1 row created.

SQL> insert into KeyList values('AAA','44');

1 row created.

SQL> insert into KeyList values('BBB','11');

1 row created.

SQL> insert into KeyList values('BBB','33');

1 row created.

SQL> insert into KeyList values('BBB','8S');

1 row created.

SQL> commit;

Commit complete.

SQL>
SQL> SELECT CONCAT_STRINGS( CAST (
2 MULTISET (
3 SELECT B.VAL
4 FROM KEYLIST B
5 WHERE B.key = A.KEY
6 ORDER BY B.VAL
7 ) AS STRING_TABLE
8 ),',') as output
9 FROM (
10 SELECT DISTINCT KEY
11 FROM KeyList
12 ) A
13 /

OUTPUT
---------------

12,2A,32,44
11,33,8S

SQL>

Bye Alessandro

1 - 18

Post Details

Added on Jul 6 2020
0 comments
522 views