Thursday, March 19, 2020

Encapsulation in Computer Programming

Encapsulation in Computer Programming Encapsulation in programming is the process of combining elements to create a new entity for the purpose of hiding or protecting information. In object-oriented programming, encapsulation is an attribute of object design. It means that all of the objects data is contained and hidden in the object and access to it is restricted to members of that class. Encapsulation in Programming Languages Programming languages arent quite so strict and allow differing levels of access to an objects data. C supports encapsulation and data hiding with user-defined types called classes. A class combines data and function into a single unit. The method of hiding details of a class is called abstraction. Classes can contain private, protected and public members. Although all the items in a class are private by default, programmers can change the access levels when needed. Three levels of access are available in both C and C# and an additional two in C#Â  only. They are: Public: All objects can access the data.Protected: Access is limited to members of the same class or descendants.Private: Access is limited to members of the same class.Internal: Access is limited to the current assembly. (C# only)Protected Internal: Access is limited to the current assembly or types derived from the containing class. (C# only) Advantages of Encapsulation The main advantage of using encapsulation is the security of the data. Benefits of encapsulation include: Encapsulation protects an object from unwanted access by clients.Encapsulation allows access to a level without revealing the complex details below that level.It reduces human errors.Simplifies the maintenance of the applicationMakes the application easier to understand. For the best encapsulation, object data should almost always be restricted to private or protected. If you choose to set the access level to public, make sure you understand the ramifications of the choice.

Tuesday, March 3, 2020

Analysis of Snow by Charles Baxter

Analysis of 'Snow' by Charles Baxter Charles Baxters Snow is a coming-of-age story about Russell, a bored 12-year-old who apprentices himself to his older brother, Ben, as Ben dangerously attempts to dazzle his girlfriend on a frozen lake. Russell narrates the story as an adult looking back on events many years after theyve taken place. Snow originally appeared in The New Yorker in December of 1988 and is available to subscribers on The New Yorkers website. The story later appeared in Baxters 1990 collection, Relative Stranger, and also in his 2011 collection, Gryphon. Boredom A sense of boredom pervades the story right from the opening line: Twelve years old, and I was so bored I was combing my hair just for the hell of it. The hair-combing experiment - like many things in the story - is partly an attempt to grow up. Russell is playing Top 40 hits on the radio and trying to make his hair look casual and sharp and perfect, but when his older brother sees the result, he just says, Holy smoke [†¦] What did you do to your hair? Russell is caught between childhood and adulthood, yearning to grow up but not quite ready for it. When Ben tells him his hair makes him look like [t]hat Harvey guy, he probably means the movie star, Laurence Harvey. But Russell, still a child, innocently asks, Jimmy Stewart? Interestingly, Russell seems perfectly aware of his own naivete. When Ben chastises him for telling an unconvincing lie to their parents, Russell understands that  [m]y unworldliness amused him; it gave him a chance to lecture me. Later, when Bens girlfriend, Stephanie, persuades Russell to feed her a piece of gum, she and Ben burst out laughing at the sensuality of what shes put him through. The narrator tells us, I knew that what had happened hinged on my ignorance, but that I wasnt exactly the butt of the joke and could laugh, too. So, he doesnt understand exactly what has happened, yet he recognizes how it registers with the teenagers. He is on the cusp of something, bored but feeling that something exciting might be around the corner: snow, growing up, some kind of thrill. Thrills Early in the story, Ben informs Russell that Stephanie will be impressed when he shows her the car submerged under the ice. Later, when the three of them start walking across the frozen lake, Stephanie says, This is exciting, and Ben gives Russell a knowing look. Ben intensifies the thrill hes giving Stephanie by refusing to confirm what he knows that the driver escaped safely and no one was killed. When she asks if anyone was hurt, Russell, the child, immediately tells her the truth: No. But Ben instantly counters with, Maybe, offering that there might be a dead body in the backseat or the trunk. Later, when she demands to know why he misled her, he says, I just wanted to give you a thrill. The thrills continue when  Ben gets his car and starts spinning it on the ice on his way to pick up Stephanie. As the narrator says: He was having a thrill and soon would give Stephanie another thrill by driving her home across ice that might break at any time. Thrills did it, whatever it was. Thrills led to other thrills. The numbing repetition of the word thrill in this passage emphasizes Russells alienation from - and ignorance of - the thrills Ben and Stephanie are seeking. The phrase whatever it was creates a sense that Russell is giving up hope of ever understanding why the teenagers are behaving as  they are.   Even though Stephanies taking off her shoes was Russells idea, he is only an observer, just as he is an observer of adulthood - getting close, definitely curious, but not participating. He is moved by the sight: Bare feet with painted toenails on the ice - this was a desperate and beautiful sight, and I shivered and felt my fingers curling inside my gloves. Yet his status as an observer rather than a participant is confirmed in Stephanies answer when he asks her how it feels: Youll know, she said. Youll know in a few years. Her comment implies so many of the things hell know: the desperation of unrequited affection, the relentless impulse to seek new thrills, and the bad judgment of teenagers, which seems to be a powerful antidote to boredom.   When Russell goes home and sticks his arm in the snowbank, wanting to feel cold so cold the cold itself became permanently interesting, he keeps his arm there as long as he can stand it, pushing himself to the edge of thrills and adolescence. But in the end, hes still a child and not ready, and he retreats into the safety of  the bright heat of the front hallway. Snow Job In this story, snow, lies, adulthood, and thrills are all closely intertwined. The lack of snowfall in this drought winter, symbolizes Russells boredom - his lack of thrills. And in fact, as the three characters approach the submerged car, just before Stephanie announces that [t]his is exciting, snow finally begins to fall. In addition to the physical snow in (or absent from) the story, snow is also used colloquially to mean to deceive or to impress through flattery. Russell explains that Ben brings girls to visit their old, large house so [t]heyd be snowed. He continues, Snowing girls was something I knew better than to ask my brother about. And Ben spends most of the story snowing Stephanie, trying to give her a thrill. Notice that Russell, still a child, is a lousy liar. He cant snow anyone. He tells his parents an unconvincing lie about where he and Ben are going, and of course, he refuses to lie to Stephanie about whether anyone was hurt when the car sank. All of these associations with snow - lying, adulthood, thrills - come together in one of the most perplexing passages of the story. As Ben and Stephanie are whispering to each other, the narrator says: Lights were beginning to go on, and, as if that werent enough, it was snowing. As far as I was concerned, all those houses were guilty, both the houses and the people in them. The whole state of Michigan was guilty - all the adults, anyway - and I wanted to see them locked up. It is clear that Russell feels left out. He notes that Stephanie whispers in Bens ear for about fifteen seconds, which is a long time if youre watching. He can see adulthood - hes getting close - but he cant hear the whispering and probably wouldnt understand it, anyway. But why should that result in a guilty verdict for the entire state of Michigan? I think there are numerous possible answers, but here are some that come to mind. First, the lights coming on could symbolize some of Russells dawning awareness. Hes aware of the way hes been left out, hes aware that teenagers dont seem to be able to resist their own bad judgment, and hes aware of all the lies that seem to be inextricable from adulthood (even his parents, when he lies about where he and Ben are going, engage in the usual pantomime of skepticism but dont stop them, as if lying is just a part of life). The fact that its snowing - which Russell  somehow takes as an insult - could symbolize the snow job that he feels adults perpetrate on children. Hes been longing for snow, but it arrives just as hes starting to think it might not be so fabulous after all. When Stephanie says, Youll know in a few years, it sounds like a promise, but its also a prophecy, underscoring the  inevitability of Russells  eventual understanding.  After all, he has no choice but to become a teenager, and its a transition he isnt quite ready for.