Bruce Malone is a headteacher bucking a depressing trend. According to received wisdom, and a raft of national statistics, his school in the east end of Glasgow should be struggling to give its pupils a decent education, given the severe deprivation that surrounds it.

Yet, according to schools inspectors, St Andrew's in Carntyne - which serves some of the poorest postcodes in the UK, including Easterhouse, Cranhill, Ruchazie and Shettleston - is one of Scotland's best-run schools.

Although still below the national average in terms of attainment at Higher exams, the school outperforms those serving similar socio-economic areas, with 20% of pupils going on to higher education, compared to 6% in comparable secondaries.

Malone believes the school's success is based on strict discipline - including a uniform and a code of conduct - and an absolute desire from staff to get the best out of every pupil. "We know that if there is not discipline in class, learning and teaching cannot happen," he says. "If I was to sum up my job in one sentence, it is to ensure that the conditions we create are such that the highest quality of teaching and learning can be delivered."

Scotland's education system is often touted as one of the best in the world. Despite the increasing proportion of parents who choose to go private, or who use placing requests to cross catchment-area boundaries, there are many reasons to be positive about local schools.

According to the Organisation for Economic Co-operation and Development (OECD) and its Programme for International Student Assessment - the recognised international benchmark for educational performance - Scotland is not only ahead of England in key areas such as reading and maths, but outperforms countries such as Germany and Sweden. In exam attainment at Standard Grade and Higher, results have gradually improved over the past few years, but not by such a margin as to incur accusations that the system is dumbing down, as has happened in England.

However, there are still obvious areas where the comprehensive system is not delivering on its founding principles. Every year, the stark impact of deprivation on attainment is laid bare, with exam results showing that council areas where a high proportion of pupils take free school meals - a key measure of deprivation - have some of the lowest pass rates.

Last year, eight of the 12 lowest-achieving local authorities at Higher level were also in the group of 10 councils with the highest proportion of pupils eligible for free school meals. Glasgow, which has 31.8% of its pupils taking free meals, is the worst performing authority, with just 12% of pupils getting three or more Highers at grades A to C. North Lanarkshire, West Dunbartonshire, North Ayrshire, Dundee, West Lothian, East Ayrshire and Inverclyde, which each have more than 15% of pupils eligible for meals, have fewer than 20% of pupils going on to get three or more Highers in S5. Clackmannanshire and South Lanarkshire are the only two local authorities with a high proportion of pupils on free school meals to punch above their weight.

Earlier this year, HM Inspectorate of Education found that the gulf between the best and worst-performing pupils in Scotland was growing wider, despite a raft of government initiatives and £19bn spent on education since devolution. The study found that while the average exam performance of the highest-achieving teenagers had gradually increased in recent years, figures for the lowest 20% had remained constant.

Graham Donaldson, senior chief inspector of education, believes that too little attention has been paid to the lowest-performing pupils. "Consideration of the high proportions of young people whose life chances are reduced through low achievement at school has become a loud and clear wake-up call for everyone involved," he said.

While the gulf in attainment is the one significant issue that mars the reputation of Scotland's education system, there are other key areas that cause concern. Of these, indiscipline is the most emotive.

Figures obtained by the Scottish Tories in September showed a 25% increase in attacks on teachers in 2005-06, with 2768 incidents of physical violence against school staff. A Scottish Executive-backed survey published two months later found that primary and secondary teachers thought schools had become more violent since 2004.

Although there is a view that the disruption is a reflection of a more troubled society, where respect for elders has diminished and the traditional family unit has broken down, part of the problem is also seen as so-called "mainstreaming": the controversial policy of including children with behavioural problems in state schools. Mainstreaming was introduced in an effort to treat all children as equals, but while teachers support the principle, they argue that the policy has not been funded adequately and has been a significant factor in rising levels of indiscipline.

Ministers are spending £29m a year to implement the Better Behaviour - Better Learning strategy, which encourages local authorities to prepare plans for discipline, with a focus on adopting restorative justice for minor disputes and "sin bins" for persistently disruptive pupils.

However, there are concerns that the policies are not having the desired impact. Ronnie Smith, general secretary of the Educational Institute of Scotland, says: "In recent years, there has been significant investment by the executive aimed at improving discipline, but to date there is little evidence this is reaching individual classrooms."

Concerns also persist about the basic skills of literacy and numeracy, after a report by school inspectors in 2004 called for more to be done to ensure all pupils reached appropriate levels of numeracy. HMIE found that too often pupils did not see the relevance of the maths they were being taught, or the connection with everyday skills. The comments echo those of many employers and staff in higher education institutions, who have expressed concern about the basic mathematical abilities of young people. In 2005, a study of 200 staff members at Scottish university science, technology and engineering departments called for "fundamental and comprehensive" changes to the maths curriculum.

The one significant piece of work that could change the landscape in Scotland's schools is the Curriculum for Excellence, launched in 2004 to assess whether subjects were being taught in a relevant and interesting way. It is also seeking to make what is taught less prescriptive, and to allow teachers greater freedom to follow pupils' interests.

Although the review has provoked fears that traditional subjects such as maths, English, history, geography, science and modern languages could be undermined, Brian Boyd, professor of education at Strathclyde University, believes the exercise has the potential to improve the education system for all. "The curriculum needs to be made more relevant, which will allow pupils of all abilities and backgrounds to engage better with what is being taught in schools," he says.

"The review is at an early stage, but if it truly gives teachers more flexibility and gets us away from the idea that we need to teach pupils simply to get them to pass exams, that will be an improvement for all."

Smaller class sizes: the case for and against
Reducing class sizes is a policy all parties support, not only because of the evidence that it can make a difference to standards, particularly in the early years, but also because it has become the priority of teachers themselves.

With the 2001 McCrone deal settling many of the old arguments over pay and conditions, the Educational Institute of Scotland, Scotland's largest teaching union, has turned its attention to ensuring all classes in all subjects should have no more than 20 pupils.

In a recent survey of parents from the Scottish independent school sector, small class size was ranked as the most important factor in their decision to go private.

The key argument is that teachers have more time to recognise the individual needs of each child, as well as being able to keep better discipline.

However, international research is divided on the merits of reducing class sizes. A study by researchers at Glasgow University which looked at the available evidence from around the world found that reducing class numbers could raise school attainment, but the policy was expensive and did not necessarily work for all pupils.

The report, by the Scottish Centre for Research in Education, found that a "significant reduction" in numbers was likely to improve pupil performance, especially for children in the early years of schooling.

However, it also suggested such gains were "prohibitively expensive" and that alternative methods of raising attainment would be more cost-effective.

"Class size reduction is attractive but there is no evidence that in the long term it will be sufficient to raise the attainment of all pupils," it concluded.

The latest figures for the 25 countries belonging to the Organisation for Economic Co-operation and Development show the average class size in primary schools was 21.5 in 2004, compared to a Scottish figure of 23.9.

What the parties say
Labour
Increase modern apprenticeships and establish skills academies. Make leaving school at 16 and 17 conditional on staying in education, training or full-time volunteering. Rebuild 250 more schools. Give children access to language tuition from primary three onwards, and introduce 500 extra modern language teachers. Discipline code to set out rights and responsibilities of teachers, parents and pupils.

SNP
Greater freedom for teachers to deliver a broad curriculum. Parity of esteem between academic and vocational subjects. Reduction in primary class sizes. Chill-out zones in schools for disruptive pupils. Scottish culture and heritage will become a national priority. Encourage pupils who wish it to pursue vocational education opportunities in S3 and S4. Introduction of an international and domestic baccalaureate. Moratorium on the reduction of playing fields.

Tories
Councils to be given control of education budgets and catchment areas, and to be required to produce a strategy on teaching sciences and technical subjects. Give parents some choice on having their children placed in mainstream or specialist education. Pilot scheme for a city academy in Glasgow to pave way for the possible roll-out of specialist vocational schools.

Lib Dem
Open 250 new and refurbished schools and bring in 1000 new teachers to cut class sizes. One hour of PE for every child every day. Give headteachers power to require parents to attend meetings to tackle problem pupils. Raise the number of school-business partnerships to 10,000 by 2010. Introduce a second language early in the primary curriculum. A £22m Young Opportunity fund to support youth projects. Lower the voting age to 16.

Green
Maximum primary school class sizes of 20. Time in the curriculum for extended work experience. Bonuses for teachers successful in raising attainment in deprived areas. Ban advertising in schools and bring in free, healthy school meals. Integrate state-funded religious schools into nondenominational education. Improve support for home learning. Fund outdoor skills training for teachers.

SSP
Maximum class sizes of 20. No school closures except with the agreement of the local community. Increase adult numeracy and literacy programmes. Rights of religious observance for all denominations, implemented by consent. One-to-one teaching for children with classic autism.

Solidarity
Bring in a bill setting targets for individual councils to cut primary school class sizes to an average of 19 pupils. Employ and train additional teachers, paid for by cutting "bureaucratic management" and also by abolishing charitable tax relief for private schools.