Friday, March 20, 2020

What a Java Package Is In Programming

What a Java Package Is In Programming Programmers are an organized bunch when it comes to writing code. They like to arrange their programs so that they flow in a logical way, calling separate blocks of code that each has a particular job. Organizing the classes they write is done by creating packages. What Packages Are A package allows a developer to group classes (and interfaces) together. These classes will all be related in some way – they might all be to do with a specific application or perform a specific set of tasks. For example, the Java API is full of packages. One of them is the javax.xml package. It and its sub packages contain all the classes in the Java API to do with handling XML. Defining a Package To group classes into a package, each class must have a package statement defined at the top of its .java file. It lets the compiler know which package the class belongs to and must be the first line of code. For example, imagine youre making a simple Battleships game. It makes sense to put all the classes needed in a package called battleships: package battleships class GameBoard{ } Every class with the above package statement at the top will now be part of the Battleships package. Typically packages are stored in a corresponding directory on the filesystem but it is possible to store them in a database. The directory on the filesystem must have the same name as the package. Its where all the classes belonging to that package are stored. For example, if the battleships package contains the classes GameBoard, Ship, ClientGUI then there will be files called GameBoard.java, Ship.java and ClientGUI.java stored in a directory call battleships. Creating a Hierarchy Organizing classes doesnt have to be at just one level. Every package can have as many sub packages as needed. To distinguish the package and subpackage a . is placed in-between the package names. For example, the name of the javax.xml package shows that XML is a sub package of the javax package. It doesnt stop there, under XML there are 11 sub packages: bind, crypto, datatype, namespace, parsers, soap, stream, transform, validation, ws, and XPath. The directories on the file system must match the package hierarchy. For example, the classes in the javax.xml.crypto package will live in a directory structure of ..\javax\xml\crypto. It should be noted that the hierarchy created is not recognized by the compiler. The names of the packages and sub-packages show the relationship that the classes they contain have with each other. But, as far as the compiler is concerned each package is a distinct set of classes. It does not view a class in a subpackage as being part of its parent package. This distinction becomes more apparent when it comes to using packages. Naming Packages There is a standard naming convention for packages. Names should be in lowercase. With small projects that only have a few packages the names are typically simple (but meaningful!) names: package pokeranalyzer package mycalculator In software companies and large projects, where the packages might be imported into other classes, the names need to be distinctive. If two different packages contain a class with the same name its important that there can be no naming conflict. This is done by ensuring the package names are different by starting the package name with the company domain, before being split into layers or features: package com.mycompany.utilities package org.bobscompany.application.userinterface

Wednesday, March 4, 2020

The Receivers Important Role in Clear Communication

The Receiver's Important Role in Clear Communication In the communication process, the receiver is the listener, reader, or observer- that is, the  individual (or the group of individuals)  to whom a message is directed. The receiver is also called the audience  or decoder. The person who initiates a message in the communication process is called the sender. Put simply, an effective message is one thats received in the way that the sender intended. Problems can arise on both ends that prevent the intended message from getting through to the receiver. The Message and Potential Problems For example, Paige asks Bill a question verbally. The message travels through the air, the channel, to  Bills ears. He responds. Paige is the sender, the question is the message, and Bill is the receiver and gives Paige feedback by answering the question. Myriad areas and ways exist where problems could arise even in this short exchange. If Paige whispers, Bill might not hear it. Maybe he hears only a portion of it and responds to a question that wasnt actually asked, and so Paige is confused. Maybe theres background noise, or the question isnt clear. If Bill is distracted by something and not paying attention, he might miss some of the words and respond inappropriately- or he might miss the question entirely so that the exchange needs to begin again. If hes not looking at Paige when she asks the question, he would miss any body language that would provide subtext to the question. If Paige sends an email or text  message to Bill, problems might arise because Bill doesnt have Paiges body language or tone of voice to interpret, which could add  information to the message. Autocorrect might have inserted errors into the text, or a missing question mark might make a question seem like a statement. These are all hindrances to effective communication. The degree of effectiveness is determined by how much of the message is understood by the receiver. Decoding the Message In the book, Business Communication, authors Carol M. Lehman and Debbie D. DuFrene lay it out this way: The receivers task is to interpret the senders message, both verbal and nonverbal, with as little distortion as possible. The process of interpreting the message is known as decoding. Because words and nonverbal signals have different meanings to different people, countless problems can occur at this point in the communication process: The sender inadequately encodes the original message with words not present in the receivers vocabulary; ambiguous, nonspecific ideas; or nonverbal signals that distract the receiver or contradict the verbal message. The receiver is intimidated by the position or authority of the sender, resulting in a tension that prevents effective concentration on the message and failure to ask for needed clarification.The receiver prejudges the topic as too boring or difficult to understand and does not attempt to understand the message.The receiver is close-minded and unreceptive to new and different ideas. With the infinite number of breakdowns possible at each stage of the communication process, it is indeed a miracle that effective communication ever occurs. Even the environment or the receivers  emotional state can affect the decoding of the message, for example, distractions in the room, discomfort on the part of the receiver, or stress or anxiety that allow the receiver to insert subtext that the sender didnt intend. Knowledge of social or cultural contexts can hinder the receiver from picking up cues or responding appropriately as well. Relational contexts can color a message, too, as messages from close friends could be received differently than a message from a work supervisor. Importance of Feedback When its not clear to the sender that understanding has occurred on the part of the receiver, communication continues, for example, through follow-up questions from either party, further discussion, or the sender giving examples, rephrasing the information, or other means of clarification to get the sender and receiver on the same so-called wavelength. In a presentation, the sender might show charts or images to make a point more clear to the audience or reader. The more cues and channels that the receiver has and is open to receiving is often better; for example, it can be easy to misconstrue tone or subtext in an email or text message, while that same message would come through clearly if the receiver hears the persons voice or is speaking with them face to face.   In the book, Planning, Implementing, and Evaluating Targeted Communication Programs, authors Gary W. Selnow and William D. Crano note that body language and tone arent just communication on the senders side: Feedback in the interpersonal setting provides a running account of a receivers reception of a message. Obvious cues such as direct questions show how well a receiver is processing the information. But subtle indicators also may provide information. For instance, a receivers yawn, silence when comments are expected, or expressions of boredom suggest that selective exposure gates may be in operation. A receiver also may have tone and subtext in the feedback given to the sender, such as responding with sarcasm or anger, which might be missed if the feedback is text-only  but likely would not be missed if the parties can either see or hear each other or both.