The subquery task in this year’s coursework requires a computed value that is trivial in Access SQL, but requires the use of additional function(s) in other SQL platforms.
Some pupils may have been taught these function(s) already, but many will not. The course specification for SQL includes “computed values”. This is open to a huge range of potential calculations and functions.
SQA staff are not allowed to communicate through non-official channels, such as CompEdNet. Advice I have received is that it would not appropriate to specifically teach pupils these functions directly – this would be teaching to the published task. However these functions can be included as part of a larger practice task, as long as there is enough additional content included to disguise the fact that an example of the necessary calculation was being delivered, and the practice task does not mimic the live assignment.
Also, you will need to change the format of the fields (from the CSV files) involved to standard SQL before you even try this part of the task.
I’m glad I’ve been using Access with my classes, then 🙂
I had a question that relates to something in the coursework but hopefully is general enough that it isn’t considered discussing solutions to live assessments…
What (in the eyes of the SQA) is the difference between a function and a procedure?
I’ve always taught that a function returns a value or multiple values, but a procedure doesn’t return anything and just executes commands (like displaying text on screen or writing to a text file).
I know a procedure could be used to alter global variables, but I’ve taught my pupils to never use globals unless completely necessary.
Any ideas if I’m on the right lines?
The way I’ve always understood it is that functions should only return one result but that a procedure can be used to change many variables. I still teach the by ref and by value so pupils are using local variables and not globals in their programs.
Andy – that was what I was working with for a while but we sought clarification and nobody can pinpoint where that definition came from! What we were told is as follows:
Function: returns a value or several values
Procedure: returns no values
In old higher, 2016 exam specified function as “Returns a single value…Do not accept other expressions of modular”. I couldn’t find a similar SQA-sourced definition of a procedure. In SQA Standard Reference Language, functions and procedure are defined by appearance, not by functionality.
However, such definitions, along with byRef/byVal, are outmoded. All subprograms in JavaScript are called functions – even if they don’t return values.
byRef/byVal is meaningless in object languages such as Python. In Python it is impossible to change non-mutable parameters – even though the task says “procedure”, the data flow requires a function that returns multiple values.
If values are explicitly returned, then it is a function. Otherwise the SQA should be using the term “subprogram” rather than “procedure” and allow candidates to implement in whatever method works for their language.
Even if you google it, there are several differing answers and they often depend on the programming language you use.
For example, in VB it’s easy. A function returns a single value but a procedure returns nothing (it could pass in variables by reference and edit their values that way, but it technically returns nothing).
In Python you don’t have byRef or byVal and to teach what actually happens would be, I feel, too much effort and time for what it’s worth. Not only that, but there doesn’t seem to be any distinction between a function or a procedure (or subroutine or whatever) in Python. It’s all the same and can return nothing or return anything.
So in exams or courseworks, what do Python programmers do? What is the difference between a python function and a python procedure?
EDIT –
Having read what Peter has said, I agree. The coursework tasks should not specify procedures and/or functions.
And this is where the argument begins for “we should all be teaching in the same language to prevent these issues”, but which for many reasons this is unworkable. Or at least highly impractical!
We teach Python and go by the “function returns, procedure doesn’t” definition. There are _always_ going to be issues with one set of questions being applied to multiple languages, each with their own terminology. It’s our job as teachers to prepare the pupils for this based on the language we (as schools) decide to use.
Or we just go back to BBC Basic where functions returned a value and procedures didn’t 😉
Or we could have Course Specifications, exams and course assignments that don’t favour or discriminate any language.
I also see no reason why the SQA couldn’t dictate the programming language. They already dictate the questions and assignments, so why not the programming language?
I’ve never understood the ‘non-prescriptive’ argument. What’s wrong with prescribing things when, in the end, there is a prescribed exam?
If there is no prescribed programming language, then there should be no instructions or questions that are not applicable to all programming languages. If these questions and instructions do crop up (as they do every single year), there should be rock-solid information on what pupils should do under these circumstances, otherwise we are giving advantages to: 1) pupils who happen to be in a school who use the languages the SQA are writing for, 2) pupils who use a language that the SQA aren’t writing for but just get lucky when they create their solutions.
We are disadvantaging the group who are unlucky enough to be using the language the SQA doesn’t prefer and also unluckily, through no fault of their own, choose a solution that the SQA doesn’t expect or accept.
If my pupils create functions but the question asks for procedures, will they be penalised?
There will not be any prescription of languages, nor should there be.
Even if specific platforms (language, SQL, web server) could be agreed, there would be problems with staff training, licenses and installation. After such a project, we would then be stuck with (obsolete versions of) platforms for years to come.
Flowcharts can’t do FOR loops. Some languages don’t have post-conditional loops. Some languages don’t pass parameters by reference.
It is annoying when SQA tasks don’t match your own platforms – especially when it advantages some candidates over others, but Computing is all about problem solving. Candidates have to figure out how to best complete the tasks – even if this requires justified deviation from the algorithm or literal wording of the task.
However, if the marking schemes don’t accommodate the variety of solutions and platforms, then we have a problem.
As previously said, python doesn’t distinguish between function and procedure, however, in the program requirements it is used to specify what should happen in this block of code; return a value or not.
The labelling of a function/procedure surely is to be taken as what that block of code should do.
With no current definitions of functions or procedures from the SQA, let’s go back to the very old Higher when BCS definitions were used.
BCS Glossary of Computer Terms 13ed
Function: is similar to a procedure but returns a single value…
Procedure: is a subprogram… receives data… manipulates… and makes the results available to the program
The function definition is basically the same as the 2016 exam answer, and as illustrated in SQA Reference Language.
The problematic subprogram of the Higher task has multiple “outs”. This is not a single value, so by definition is not a function. It does meet the definition of a procedure – regardless of whether you pass parameters by reference or by returning multiple values – and must be marked accordingly.
Peter, you say there shouldn’t be a prescribed programming language but then give very good reasons for why there should be. I can understand issues such as training, licenses and installation, but we had those exact issues when SQL was introduced, with many schools scrambling to get EasyPHP and the like installed. There are still people who aren’t comfortable with the SQL queries at Higher level, so still need training.
Flowcharts not showing fixed loops is a problem with flowcharts, not any prescribed programming language.
Some programming languages not having post conditional loops or functions or procedures or passing parameters by value or by reference are all arguments for a standardised programming language. If everyone used the same language, the exams and courseworks would obviously be tailored to those languages and these issues wouldn’t arise.
Computing is about problem solving, but the problems we are faced with is “I cannot possibly match that design so I’m screwed”. Some pupils will be lucky and just crack on with it anyway, other pupils will be unlucky and will panic and not know what to do. It’s like setting a question that has two perfectly valid answers but only accepting one of them. And not telling anyone which one it is.
Joe, you’re kind of just repeating my question. The design or labling of a sub-routine should be taken as what the sub-routine should do, but Python cannot do those things. How can a python procedure get details from a user and then store those details for use in other parts of the program without global variables? Visual basic would pass the variables by reference. Python doesn’t do that. We’d have to talk about passing object references by value and mutability and all that junk which I think is just far too much.
My question is: how do we make that procedure in python?
Wasn’t this one of the reasons that passing by reference and value was taken out of the arrangements? Why are functions and procedures still in there?
Couldn’t agree more with Lee, it’s becoming imperative that a standard programming environment and course specification is being adopted.
Students are clearly being disadvantaged by ambiguity in terms/definitions across language, and the lack of understanding caused by this. Flow chart discussion here is the perfect example – of course this can be represented in a flow chart – its just represented as a conditional which will run a fixed number of time. I imagine the same will apply to the function/procedure discussion here, and that students will not be penalised as long as the subprograms do the right things, but me imagining this to be the case is not really good enough for our students is it?
Seems the given answer for the question with the SQL error has errors in the answer that is to be compared. Averages are inconsistent and the pupils are confused about if that is the problem or if its the code.
You must be logged in to reply to this topic.