From the bottom of the Leith Walk - "the fit o' the Walk" as Leithers invariably refer to it - you can go every which way.

Here east meets west and south meets north. The Walk's tributaries are Great Junction Street, Constitution Street and Duke Street, each of which will lead you into parts of Scotland's capital unfrequented by many of its inhabitants and only the most intrepid - or disorientated - tourists. They may have heard of the Shore, where the Water Of Leith spills into the Firth Of Forth and where a few boats are still berthed. There, the streets are cobbled and the restaurants familiar to Michelin inspectors and you can almost imagine yourself in the swankier arrondissements of Amsterdam and Copenhagen.

But amid the gentrification, the bonded warehouses converted into loft apartments and the gastropubs, one does not need to dig too deep to detect signs of seediness, of the old, salty, tar-stained, tattooed Leith, where for centuries sailors came ashore to quench their thirst and satisfy their lust. As the shadows lengthen, prostitutes, stamping their heels and waving their arms for warmth, tout for business and whey-faced men, walking as if wound up like toy soldiers, go in search of a fix. This is not a good place to stumble on unawares. Nor is it advisable to seek refuge in certain watering-holes. In a city in which there is competition aplenty for the accolade of the worst pub, Leith has more than its fair share of contenders. One landlord barred 80 of his clientele but police continue to drop by several times a day to deal with the fallout of over-consumption and a surfeit of testosterone.

There is little evidence of the independence referendum, only a few tattered posters pasted by the Scottish Socialist Party. I bump - literally - into an elderly man called John carrying a ladder. He says he is a window cleaner and when I ask for his thoughts on the September vote, he replies: "Is there an election?" John retains an identifiable London accent and loyalty to Tottenham Hospur, despite having lived in Edinburgh for almost 30 years. John laughs, then moves off, his view on the state of the Union unexpressed.

The Walk stirs slowly to life. Commuters have already made the journey into the centre of Edinburgh and the few people who huddle in doorways as an icy wind shrieks down the broad street are in no hurry to move on. It's just after 10am and a young man cadges a fag from his older companion outside the Central Bar. It has already been open for over an hour. It's a grand, old pub with a gilded interior, built in the late 19th century to pander to passengers who used Leith Central Station, which closed in 1972. In the 1980s, the derelict building was a favourite haunt of drug addicts who, if ever they were asked what they were up to, professed to be trainspotting, hence the title of Irvine Welsh's totemic novel.

The Leith evoked by Welsh is as alien to many Scots as a planet light years away. "Sunny Leith", as it's ironically called, is as far removed from postcard Edinburgh, with its castle and festival and bourgeois pretensions, as the Bronx is from the Hamptons. Though it was always the capital's port, it has had to fight hard to retain its identity and maintain a semblance of independence. It was a place prone to upheaval, reinvention, flux. In the aftermath of the Second World War, countless Leithers were moved to housing schemes in peripheral parts of Edinburgh and Leith acquired an air of abandonment and neglect. Some find its transient nature unnerving; more optimistic others prefer to see it as energising.

Longer ago than I care to remember I worked in McDonald Road public library, into which I drop for old times sake. Then, most of the staff were female, except for the boss, Mr Craise, Dave, the caretaker, and myself. Dave's job was to keep the boiler stoked and ensure the unemployed men hogging the radiators in the newspaper reading room did not have access to the racing pages, lest they blow their buroo money on tips that might change their luck. His trick - which he played on me when we first met - was to offer his gloved hand for you to shake, whereupon you found yourself holding his whole arm. After he stopped laughing, he explained he had been given an artificial arm after he lost his real one in the war.

Now the library is barely recognisable from the one I knew. Moreover, its stock is eclectically reflective of the community it serves, which is as diverse as any in Scotland. Thinking back, I don't recall any Chinese or Urdu speakers ever frequenting it. The only non-native Scots were Italian and they were expected not to read books in their own language but in English. Integration may not have been a buzzword in the 1970s but it was taken for granted.

Within the Italian community, and especially among the generation born in Scotland, says Mary Contini over coffee, there was a desire to assimilate while, simultaneously, staying in touch with their roots. With her husband Philip, Mary runs Valvona and Crolla, which, with its shops, cafes and restaurants, has contributed immeasurably to the nurturing of our national palate. This year marks its 80th in business. It is as much of a local landmark as Arthur's Seat or Calton Hill; without it Edinburgh would be conspicuously the poorer. When she was dating Philip she would serve in the shop at the top of Leith Walk. Once, she recalls, she asked Philip's uncle, Victor Crolla, its legendary proprietor, what she should charge for something. He told her to take a look at the customer and see how much he or she could afford. Victor's philosophy was to pile it high and sell it cheap; bread, wine, coffee, olive oil and pasta were the staples. While he served, he sang, told jokes, offered children sweets, flirted outrageously and greeted everyone, whether or not he knew them, as old friends. "Italians," says Mary, "do like to act the act, while we're taking the money off you."

Mary is amazed by the effect legislation can have on a place and our lives, whether it is changes in the licensing laws, the smoking ban, or devolution. The Scottish Parliament has transformed Edinburgh, she adds, making it a European capital in more than just name. It is one reason why, increasingly, more people are visiting the city. Another is the number of festivals which, as they proliferate, promise to eventually merge into one long, evergreen festival.

Nor does the trams debacle dampen Mary's spirit, though initially the route was planned to embrace Leith Walk. While the wrangling continued, even businesses as robust and well-established as Valvona and Crolla suffered. Mary reckons that in a seven-month period takings dropped 25%. Her attitude now, however, is that what is done is done.

She feels similarly about the referendum, taking the view that in business you have to adapt or die. Flexibility is paramount. It is not, one suspects, an opinion held by a majority of the city's business community. Over the past several decades it is the city's bankers and insurers, stock brokers and lawyers, who have been the strongest critics of any move towards independence, each step along the way being marked by cries of dismay, predictions of dire economic consequences and threats to up sticks. If their arguments had held sway, there would be no Parliament at Holyrood and certainly no SNP Government. They are an inherently conservative caste, as you can tell from the clothes on their backs. In Edinburgh, it is a mark of class that you do not buy new clothes; you must inherit them. And, like the estate owners of old, "business leaders" seem to feel their employees cannot be allowed minds of their own, that they are somehow their vassals.

Doubtless, much may be explained by schooling. Around one in four children in Edinburgh is educated in the independent sector, which is an astonishingly high number. Traditionally, from schools such as Fettes and Edinburgh Academy and St George's have come the advocates and judges, captains of commerce and politicians of tomorrow. They are guaranteed tickets to the best seats at the Festival and invitations of hospitality at Murrayfield. Moreover, they keep themselves to themselves, like mafioso, saying little publicly and passing on their privileges from one generation to the next. What do they think of the prospect of independence? It is impossible to know but the vibe is they are not enthusiasts, that, like the archetypal Scot on the make, they still see London and the glittering prizes it offers as the height of their ambition. "They know what they think," wrote Hugo Rifkind - son of former Defence Minister, Malcolm - in a recent column in The Spectator. "They have just grown accustomed, insidiously, to avoiding stating it."

It was Robert Louis Stevenson who said that Edinburgh pays cruelly for its lofty position. But the wind that drove RLS away has died, the rain has ceased and the sun shines blindingly. A tram slithers snake-like and silently along Princes Street, heading west towards the airport, a journey of nine miles. Who cares how many pounds per yard the project has cost. The message it sends is as symbolic as it is cheering: at last Edinburgh is casting off the suffocating cloak of history and embracing the future. Unlike buses, trams are cool, classy, modern, a 21st century technology; unlike cars, they do not displace people or pollute the atmosphere or clutter streets. But it is typical of Edinburghers to bemoan their lot, the gist of which is that their once perfect city is now irrevocably despoiled. Dissatisfaction is in their genes.

Waiting for me in Glass and Thomson in Dundas Street, one of many establishments memorialised in Alexander McCall Smith's 44 Scotland Street series, is Duncan Thomson, erstwhile director of the Scottish National Portrait Gallery. He is a lifelong Labour supporter who may - pace the referendum - be described as swithering. For Duncan, with the educated, sensitive eye of the aesthete, Edinburgh appears to be in a perpetual struggle, in which the modern attempts, more often than not unsuccessfully, to compete with the model of the Enlightenment. Nor, he argues, do we take good care of what we need to protect. Take, he says, the Scott Monument, which is what smacks most people in the face when they emerge from Waverley Station. "The stone is so blackened that its neo-Gothic intricacies are all but invisible. Thus, it besmirches Scott's honour, although it is supposed to do the opposite. Why so? Because the guardian of our heritage, Historic Scotland, seems to have a mental block about cleaning stonework."

Will independence address such matters? Or, perhaps more pertinently, why aren't they being addressed now? They are legitimate questions that could be applied to numerous irritations, from the parlous condition of the roads to the neglect of town centres. There is a tendency among some in the pro-independence camp to describe the present as a kind of limbo during which any change is impossible. Hence the palpable sense of postponement and prevarication. It is easy to find excuses not to do things. It is as if many Scots think the country in which they are living is rented from someone else and there is no point in them improving it because it will not ultimately be to their benefit.

Like many cities with what the Italians call a centro historico, Edinburgh finds it difficult to strike a balance between embracing the imperatives of now with the responsibility of preserving that which gives it its distinctive character. There is always, inevitably, a danger in being seduced into thinking that we live in coarser and uglier times than our predecessors. One does not need to delve far to discover that is not necessarily the case. Writing in the 1930s, the Orcadian poet Edwin Muir was struck by displays of intoxication in Princes Street and its byways. "During a fortnight's stay in Edinburgh," Muir remarked, "I did not get through a single evening without seeing at least one example of outrageous or helpless drunkenness."

Hastening along Princes Street's shopless south side, I dart into the Gardens near the west end, skirt St Cuthbert's Cemetery, where Thomas de Quincey, the self-styled "opium-eater", is buried, and emerge in King's Stable Road. From there it is a short stroll to the Grassmarket, the locus of many of the city's most famous and notorious happenings, including hangings. Through it, Muriel Spark had Miss Jean Brodie escort her impressionable charges, offering them a glimpse of an Edinburgh to which hitherto they were oblivious, "a foreign country, which intimates itself by its new smells and shapes and its new poor." When I first knew it - in the 1960s - it was still a quarter that reeked of deprivation. There were hostels for the homeless and belligerent men shook bottles at you as you passed. There is less sign of that today, but enough remains to trouble the conscience. More conspicuous, though, are the stag and hen parties that make a beeline for the pubs and restaurants, which, in defiance of the weather, offer the hardy the opportunity to sup - and smoke - outdoors.

Sean Bradley and his wife have lived up a turnpike stair in the Grassmarket for nearly 40 years, raising four children. Formerly a careers adviser, latterly a freelance magazine and book editor, he is active within the Edinburgh Old Town Development Trust. When he moved in, he recalls, there was no hot running water, one of several great improvements to the area.

During the 1980s and 1990s, the population of the Old Town, the lizard's skeleton that stretches from Holyrood Palace to the Castle, doubled and it is still growing. But it is an unstable, floating population, dominated, as are other parts of Edinburgh, by students, of whom there is an estimated 40,000, few of whom have a long-term stake in the community and many of whom have habits unfit for communal living. Meanwhile, families are few and children are notable by their absence. "And of course," says Sean, "the high levels of noise and disturbance in much of the area is a major negative factor - Edinburgh City Council has long had a love affair with the licensed trade." Another downside, he adds, is he can't buy a decent loaf of bread in the neighbourhood. "But there are two joke shops within a stone's throw of the flat."

Such tension is doubtless inevitable when trying to satisfy the divergent demands of two distinct groups, fly-by-nights and permanent residents. Nor is it unique to Edinburgh. Far from it. Here, however, it is magnified, where the natives - with their objections and petitions, societies and associations - are often viewed as a nuisance and anything that attracts more footfall and bed nights is deemed desirable. "Patrick Geddes," recalls Sean, "described the city as not just 'a place in space but a drama in time'. For a truly successful city, residents need to play a full part in the drama that is Edinburgh, not just be the victim bystanders in a cheap soap opera."

Sean will vote Yes in the referendum, in the hope it will lead to a more equal and just society and an end to the persecution of the poor. "I think it is important to qualify one's Yes or No," he adds."In my case I'm supporting no party, state or nation; I'm voting for localism not nationalism." Looking north from the top of Royal Mile, as day turns to dusk, you can just about still see Leith in the distance and beyond it the Forth. The Lawnmarket is thronged with tourists heading to the Castle, past the shops selling tartan tat and leaking ersatz bagpipe music. There is a haar coming in, which I always find nostalgically cheering, and the mouths of the closes seem to emit smoke. Outside the City Chambers, the woman whom the Guinness Book Of Record says has the most body piercings in the world is chatting to the human statue of John Knox as councillors and their officials come and go without batting an eyelid. "Surreal", I overhear someone say, and so it is. n