<?xml version="1.0"?>
<News hasArchived="true" page="7574" pageCount="10799" pageSize="10" timestamp="Tue, 08 Sep 2026 21:10:02 -0400" url="https://my3.my.umbc.edu/posts.xml?mode=activity&amp;page=7574&amp;range=2">
<NewsItem contentIssues="false" id="44284" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44284">
<Title>UMBC Offers Health IT Master&#8217;s Starting Fall 2014</Title>
<Tagline>Program Fulfills Region&#8217;s Need for Skilled Professionals</Tagline>
<Body>
<![CDATA[
    <div class="html-content">
    <div>UMBC is accepting applications for its new <a href="http://www.umbc.edu/hit/" rel="nofollow external" class="bo">Health Information Technology Master’s Program</a>, offered beginning fall 2014. <br><br>
    </div>
    <div>As technology infiltrates the healthcare industry, the health IT field continues to grow at a rapid pace. The industry presents significant career potential, with postings for health care informatics jobs <a href="http://www.umbc.edu/hit/images/Trend_Watch_Health_Informatics.pdf" rel="nofollow external" class="bo">rising 53% between 2007 and 2012</a>. </div>
    <div>Given its large population and dynamic healthcare environment, the Baltimore-Washington area is poised for significant continued growth in the health IT field. UMBC, located just outside of Baltimore, offers a convenient location for industry professionals to receive the credentials needed to move into high-demand health IT roles.   <br><br>
    </div>
    <div>UMBC’s MPS in Health IT is an excellent choice for those who already have a degree in an IT or healthcare-related discipline, as well as those whose career has taken them into the field of healthcare IT.  Designed with working professionals in mind, the program offers flexible evening, weekend and hybrid course options. <br><br>
    </div>
    <div>Those interested in learning more about the program can register for a virtual information session on June 5, 2014. <a href="https://www1.gotomeeting.com/register/887930321" rel="nofollow external" class="bo">RSVP Here. </a>
    </div>
    <div><br></div>
    </div>
]]>
</Body>
<Summary>UMBC is accepting applications for its new Health Information Technology Master’s Program, offered beginning fall 2014.     As technology infiltrates the healthcare industry, the health IT field...</Summary>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44284/guest@my.umbc.edu/7ddc24cd4069a36931a0dca60d856a96/api/pixel</TrackingUrl>
<Tag>graduate</Tag>
<Tag>health</Tag>
<Tag>it</Tag>
<Tag>masters</Tag>
<Group token="dps">UMBC Professional Programs</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/dps</GroupUrl>
<AvatarUrl>https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/xsmall.png?1642086701</AvatarUrl>
<AvatarUrl size="original">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/original.png?1642086701</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/xxlarge.png?1642086701</AvatarUrl>
<AvatarUrl size="xlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/xlarge.png?1642086701</AvatarUrl>
<AvatarUrl size="large">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/large.png?1642086701</AvatarUrl>
<AvatarUrl size="medium">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/medium.png?1642086701</AvatarUrl>
<AvatarUrl size="small">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/small.png?1642086701</AvatarUrl>
<AvatarUrl size="xsmall">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/xsmall.png?1642086701</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/000/513/2e72ed76b7b3b9ce2f15fce64178dfaf/xxsmall.png?1642086701</AvatarUrl>
<Sponsor>Division of Professional Studies</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 15:33:09 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="true" id="44295" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44295">
<Title>Refactoring Legacy Code: Part 3 - Complex Conditionals</Title>
<Body>
<![CDATA[
    <div class="html-content">
    <p>Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, <em>Legacy Code</em>. This is a series that will help you work and deal with it.<br></p>
    
    <p>I like to think about code just as I think about prose. Long, nested, composed sentences with exotic words are hard to understand. From time to time you need one, but most of the time, you can just use plain simple words in short sentences. This is very true for source code also. Complex conditionals are hard to understand. Long methods are like endless sentences.</p>
    
    <h2>From Prose to Code</h2>
    
    <p>Here is a "prosaic" example to cheer you up. First, the all-in-one sentence. The ugly one.</p>
    <p><em>If temperature in the server room is below five degrees, and humidity rises over fifty percent but remains under eighty, and the air pressure is steady, then the senior technician John, who has at least three years of work experience in networking and servers administration should be notified, and he must wake up in the middle of the night, dress up, go out, take his car or call a cab if he does not have a car, drive to the office, enter the building, start the air conditioning and wait until temperature raises over ten degrees and humidity falls below twenty percent.</em></p>
    
    <p>If you can understand, comprehend, and remember that paragraph without re-reading it, I give you a medal (virtual of course). Long, entangled paragraphs written in a single complicated sentence are difficult to understand. Unfortunately, I don't know enough exotic English words to make that even harder to understand.</p>
    <h3>Simplification</h3>
    
    <p>Let's find a way to simplify it a little bit. All of its first part, up until the "then" is a condition. Yes, it is complicated but we could sum it up like this: <em>If environmental conditions represent a risk...</em> ... then something should be done. The complicated expression says we should notify someone who satisfies a lot of conditions: <em>then notify level three tech support</em>. Finally, a whole process is described from waking up the tech guy until all is fixed: <em>and expect environment to be restored within normal parameters.</em> Let's put it all together.</p>
    
    <p><em>If environmental conditions represent a risk, notify level three tech support and expect environment to be restored within normal parameters.</em></p>
    
    <p>Now, that's only about 20% in length compared to the original text. We don't know the details and in the significant majority of the cases, we don't care. And this is very true for source code also. How many times did you care about the implementation details of a <code>logInfo("Some message");</code> method? Probably once, if and when you implemented it. Then it just logs the message into the "info" category. Or when a user purchases one of your products, do you care how to invoice him? No. All you want to care about is <em>if the product was bought, discard it from inventory and invoice it to the buyer</em>. The examples could be endless. They are basically how we write correct software.</p>
    
    <h2>Complex Conditionals</h2>
    
    <p>In this section we will try to apply the prose philosophy to our trivia game. One step at a time. Starting with complex conditionals. Let's begin with some easy code. Just to warm up.</p>
    
    <p>Line twenty of the <code>GameRunner.php</code> file reads like this:</p>
    
    <pre>if (rand($minAnswerId, $maxAnswerId) == $wrongAnswerId)</pre>
    
    <p>How would that sound in prose? <em>If a random number between minimum answer ID and maximum answer ID equals the wrong answer's ID, then...</em></p>
    
    <p>This is not very complicated, but we can still make it simpler. What about this? <em>If wrong answer is selected, then...</em> Better, isn't it?</p>
    
    <h3>The Extract Method Refactoring</h3>
    
    <p>We need a way, a procedure, a technique to move that conditional statement somewhere else. That destination can easily be a method. Or in our case, since we are not inside a class here, a function. This moving of behavior into a new method or function is called the "Extract Method" refactoring. Below are the steps, as defined by Martin Fowler in his excellent book Refactoring: Improving the Design of Existing Code. If you didn't read this book, you should put it on your "To read" list now. It is one of the most essential books for a modern day programmer.</p>
    
    <p>For our tutorial, I have taken the original steps and simplified them a little bit to better fit our needs and our type of tutorial.</p>
    
    <ol>
    	<li>Create a new method and name it after what it does, not how it does it.</li>
    	<li>Copy the code from the extracted place, into the method. Please note, this is <em>copy</em>, do not yet delete the original code.</li>
    	<li>Scan the extracted code for any variables that are local. They must be made parameters for the method.</li>
    	<li>See if any temporary variables are used inside the extracted method. If so, declare them inside it and drop the extra parameter.</li>
    	<li>Pass into the target method the variables as parameters.</li>
    	<li>Replace the extracted code with the call to the target method.</li>
    	<li>Run your tests.</li>
    </ol>
    
    <p>Now this is quite complicated. However, the extract method is arguably the most frequently used refactoring, except for renaming maybe. So you must understand its mechanics.</p>
    
    <p>Luckily for us, modern day IDEs like PHPStorm provide great refactoring tools, as we've seen in the tutorial <a href="http://code.tutsplus.com/tutorials/phpstorm-when-the-ide-really-matters--cms-20787" rel="nofollow external" class="bo">PHPStorm: When the IDE Really Matters</a>. So we will use the features we have at our fingertips, instead of doing it all by hand. This is less error prone and much, much faster.</p>
    
    <p>Just select the desired part of the code and <strong>right-click</strong> it.</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/extract-method-phpstorm.png" style="max-width: 100%; height: auto;">
    
    <p>The IDE will automatically understand that we need three parameters to run our code and it will propose the following solution.</p>
    
    <pre>// ... //&#x000A;    $minAnswerId = 0;&#x000A;    $maxAnswerId = 9;&#x000A;    $wrongAnswerId = 7;&#x000A;    function isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId) {&#x000A;    	return rand($minAnswerId, $maxAnswerId) == $wrongAnswerId;&#x000A;    }&#x000A;    &#x000A;    do {&#x000A;    	$dice = rand(0, 5) + 1;&#x000A;    	$aGame-&gt;roll($dice);&#x000A;    &#x000A;    	if (isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId)) {&#x000A;    		$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    	} else {&#x000A;    		$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    	}&#x000A;    &#x000A;    } while ($notAWinner);</pre>
    
    <p>While this code is syntactically correct, it will break our tests. Between all the noise shown to us in red, blue and black colors, we can spot the reason why:</p>
    
    <pre>Fatal error: Cannot redeclare isCurrentAnswerWrong()&#x000A;    (previously declared in /home/csaba/Personal/Programming/NetTuts&#x000A;    /Refactoring Legacy Code - Part 3: Complex Conditionals and Long Methods&#x000A;    /Source/trivia/php/GameRunner.php:16)&#x000A;    in /home/csaba/Personal/Programming/NetTuts&#x000A;    /Refactoring Legacy Code - Part 3: Complex Conditionals and Long Methods&#x000A;    /Source/trivia/php/GameRunner.php on line 18</pre>
    
    <p>It basically says that we want to declare the function twice. But how can that happen? We have it only once in our <code>GameRunner.php</code>!</p>
    
    <p>Take a look at the tests. There is a <code>generateOutput()</code> method that does a <code>require()</code> on our <code>GameRunner.php</code>. It is called at least twice. Here is the source of the error.</p>
    
    <p>Now we have a dilemma. Because of the seeding of the random generator, we need to call this code with controlled values.</p>
    
    <pre>private function generateOutput($seed) {&#x000A;    	ob_start();&#x000A;    	srand($seed);&#x000A;    	require __DIR__ . '/../trivia/php/GameRunner.php';&#x000A;    	$output = ob_get_contents();&#x000A;    	ob_end_clean();&#x000A;    	return $output;&#x000A;    }</pre>
    
    <p>But there is no way to declare a function twice in PHP, so we need another solution. We start to feel the burden of our golden master testing. Running the whole thing 20000 times, every time we change a piece of code, may not be a solution for the long term. Besides the fact that it takes ages to run, it forces us to change our code to accommodate the way we test it. This is usually a sign of bad tests. The code should change and still make the test pass, but the changes should have reasons to change, coming only from the source code.</p>
    
    <p>But enough talk, we need a solution, even a temporary one will do for now. Migrating to unit tests will start with our next lesson.</p>
    
    <p>One way to solve our problem is to take all the rest of the code in <code>GameRunner.php</code> and put it in a function. Let's say <code>run()</code></p>
    
    <pre>include_once __DIR__ . '/Game.php';&#x000A;    &#x000A;    function isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId) {&#x000A;    	return rand($minAnswerId, $maxAnswerId) == $wrongAnswerId;&#x000A;    }&#x000A;    &#x000A;    function run() {&#x000A;    	$notAWinner;&#x000A;    &#x000A;    	$aGame = new Game();&#x000A;    &#x000A;    	$aGame-&gt;add("Chet");&#x000A;    	$aGame-&gt;add("Pat");&#x000A;    	$aGame-&gt;add("Sue");&#x000A;    &#x000A;    	$minAnswerId = 0;&#x000A;    	$maxAnswerId = 9;&#x000A;    	$wrongAnswerId = 7;&#x000A;    	do {&#x000A;    		$dice = rand(0, 5) + 1;&#x000A;    		$aGame-&gt;roll($dice);&#x000A;    &#x000A;    		if (isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId)) {&#x000A;    			$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    		} else {&#x000A;    			$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    		}&#x000A;    &#x000A;    	} while ($notAWinner);&#x000A;    }</pre>
    
    <p>This will allow us to test it, but be aware that running the code from the console will not run the game. We did a slight change in behavior. We gained testability at the cost of a behavioral change, which we did not want to do in the first place. If you want to run the code from the console, now you will need another PHP file that includes or requires the runner and then explicitly calls the run method on it. Not that big of a change but a must to remember, especially if you have third parties using your existing code.</p>
    
    <p>On the other hand, we can now just include the file in our test.</p>
    
    <pre>require __DIR__ . '/../trivia/php/GameRunner.php';</pre>
    
    <p>And then call <code>run()</code> inside the generateOutput() method.</p>
    
    <pre>private function generateOutput($seed) {&#x000A;    	ob_start();&#x000A;    	srand($seed);&#x000A;    	run();&#x000A;    	$output = ob_get_contents();&#x000A;    	ob_end_clean();&#x000A;    	return $output;&#x000A;    }</pre>
    
    <h3>Directory Structure, Files, &amp; Naming</h3>
    
    <p>Maybe this is a good opportunity to think about the structure of our directories and files. There are no more complex conditionals in our <code>GameRunner.php</code>, but before we continue to the <code>Game.php</code> file, we must not leave a mess behind us. Our <code>GameRunner.php</code> is not running anything, anymore and we needed to hack methods together to make it testable, which broke our public interface. The reason for this, is that maybe we are testing the wrong thing.</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/testing-deps-schema.png" style="max-width: 100%; height: auto;">
    
    <p>Our test calls <code>run()</code> in the <code>GameRunner.php</code> file, which includes <code>Game.php</code>, plays the game and a new golden master file is generated. What if we introduce another file? We make the <code>GameRunner.php</code> to actually run the game by calling <code>run()</code> and nothing else. So what if there's no logic in there that could go wrong and no tests are needed, and then we move our current code into another file?</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/testing-deps-with-new-runner.png" style="max-width: 100%; height: auto;">
    
    <p>Now this is a whole different story. Now our tests are accessing the code just under the runner. Basically, our tests are just runners. And of course in our new <code>GameRunner.php</code> there will only be a call to run the game. This is a true runner, it does nothing else but call the <code>run()</code> method. No logic means no tests are needed.</p>
    
    <pre>require_once __DIR__ . '/RunnerFunctions.php';&#x000A;    run();</pre>
    
    <p>There are other questions we could ask ourselves at this point. Do we really need a <code>RunnerFunctions.php</code>? Couldn't we just take the functions from there and move them to <code>Game.php</code>? We probably could, but with our current understanding of, what function belongs where? Is not enough. We will find a place for our method in an upcoming lesson.</p>
    
    <p>We also tried to name our files according to what the code inside them is doing. One is just a bunch of functions for the runner, functions we, at this point consider to belong together, in order to satisfy the needs of the runner. Will this become a class at one point in the future? Maybe. Maybe not. For now, it is good enough.</p>
    
    <h3>Cleaning Up RunnerFunctions</h3>
    
    <p>If we take a look at the <code>RunnerFunctions.php</code> file, there is a little bit of a mess that we've introduced.</p>
    
    <p>We define:</p>
    
    <pre>$minAnswerId = 0;&#x000A;    $maxAnswerId = 9;&#x000A;    $wrongAnswerId = 7;</pre>
    
    <p>... inside the <code>run()</code> method. They have a single reason to exist and a single place where they are used. Why not just define them inside that method and get rid of the parameters altogether?</p>
    
    <pre>function isCurrentAnswerWrong() {&#x000A;    	$minAnswerId = 0;&#x000A;    	$maxAnswerId = 9;&#x000A;    	$wrongAnswerId = 7;&#x000A;    	return rand($minAnswerId, $maxAnswerId) == $wrongAnswerId;&#x000A;    }</pre>
    
    <p>Ok, the tests are passing and the code is much nicer. But not good enough.</p>
    
    <h3>Negative Conditionals</h3>
    
    <p>It is much easier, for the human mind, to comprehend positive reasoning. So if you can avoid negative conditionals, you should always take that path. In our current example, the method checks for a wrong answer. It would be much easier to understand a method that checks for a validity and negate that, when needed.</p>
    
    <pre>function isCurrentAnswerCorrect() {&#x000A;    	$minAnswerId = 0;&#x000A;    	$maxAnswerId = 9;&#x000A;    	$wrongAnswerId = 7;&#x000A;    	return rand($minAnswerId, $maxAnswerId) != $wrongAnswerId;&#x000A;    }</pre>
    
    <p>We used the Rename Method refactoring. This is again, pretty complicated if used by hand, but in any IDE it is as simple as hitting <strong>CTRL+r</strong>, or selecting the appropriate option in the menu. To make our tests pass, we also need to update our conditional statement with a negation.</p>
    
    <pre>if (!isCurrentAnswerCorrect()) {&#x000A;    	$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    } else {&#x000A;    	$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    }</pre>
    
    <p>This brings us one step closer to our understanding of the conditional. Using <code>!</code> in an <code>if()</code> statement, actually helps. It stands out and highlights the fact that something is actually negated there. But can we reverse this in order, to avoid negation completely? Yes we can.</p>
    
    <pre>if (isCurrentAnswerCorrect()) {&#x000A;    	$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    } else {&#x000A;    	$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    }</pre>
    
    <p>Now we have no logical negation by using <code>!</code>, nor lexical negation by naming and returning the wrong things. All these steps made our conditional much, much more easier to comprehend.</p>
    
    <h2>Conditionals in <code>Game.php</code>
    </h2>
    
    <p>We simplified to the extreme, <code>RunnerFunctions.php</code>. Let's attack our <code>Game.php</code> file now. There are several ways you can search for conditionals. If you prefer, you can just scan the code by simply looking at it. This is slower, but has the added value of forcing you to try to understand it sequentially.</p>
    
    <p>The second obvious way to search for conditionals, is to just do a find for "if" or "if (". If you formatted your code with the built-in features of your IDE, you can be sure that all conditional statements have the same specific form. In my case, there is a space between the "if" and the parenthesis. Also, if you use the built-in search, the found results will be highlighted in a strident color, in my case yellow.</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/ide-find-highlights.png" style="max-width: 100%; height: auto;">
    
    <p>Now that we have all of them lighting up our code like a Christmas tree, we can take them one by one. We know the drill, we know the techniques we can use, it's time to apply them.</p>
    
    <pre>if ($this-&gt;inPenaltyBox[$this-&gt;currentPlayer])</pre>
    
    <p>This seems pretty reasonable. We could extract it into a method, but would there be a name for that method in order to make the condition clearer?</p>
    
    <pre>if ($roll % 2 != 0) </pre>
    
    <p>I bet 90% of all programmers can understand the problem in the above <code>if</code> statement. We are trying to concentrate on what our current method does. And our brain is wired into the domain of the problem. We don't want to "start another thread" to compute that mathematical expression in order to understand that it just checks if a number is odd. This is one of those small distractions that can ruin a difficult logical deduction. So I say let's extract it.</p>
    
    <pre>if ($this-&gt;isOdd($roll))</pre>
    
    <p>That is better because it is about the problem's domain and requires no additional brain power.</p>
    
    <pre>if ($this-&gt;places[$this-&gt;currentPlayer] &gt; $lastPositionOnTheBoard)</pre>
    
    <p>This seems to be another good candidate. It is not that difficult to understand as a mathematical expression, but again, it is an expression that needs side-processing. I am asking myself, what does it mean if the current player's position reached the end of the board? Can't we express this state in a more concise way? We probably can.</p>
    
    <pre>if ($this-&gt;playerReachedEndOfBoard($lastPositionOnTheBoard))</pre>
    
    <p>This is better. But what actually happens inside the <code>if</code>? The player is repositioned at the beginning of the board. The player starts a new "lap" in the race. What if in the future, we will have a different reason for starting a new lap? Should our <code>if</code> statement change when we change the underlying logic in the private method? Absolutely not! So, let's rename this method into what the <code>if</code> represents, into what happens, not what we are checking for. </p>
    
    <pre>if ($this-&gt;playerShouldStartANewLap($lastPositionOnTheBoard))</pre>
    
    <p>When you try to name methods and variables, always think about what the code should do and not what state or condition it represents. Once you get this right, renaming actions in your code will drop significantly. But still, even an experienced programmer needs to rename a method at least three to five times before finding its correct name. So don't be afraid to hit <strong>CTRL+r</strong> and rename frequently. Never commit your changes to the project's VCS if you did not scan the names of your newly added methods and your code does not read like well written prose. Renaming is so cheap in our days, that you can rename things just to try out various versions and revert with a single hit of a button.</p>
    
    <p>The <code>if</code> statement at line 90 is the same as our previous one. We can just reuse our extracted method. Voila, duplication eliminated! And don't forget to run your tests now-and-then, even when you refactor by using your IDE's magic. Which leads us to our next observation. Magic, sometimes, fails. Check out line 65.</p>
    
    <pre>$lastPositionOnTheBoard = 11;</pre>
    
    <p>We declare a variable and use it only in a single place, as a parameter to our newly extracted method. This strongly suggests that the variable should be inside the method.</p>
    
    <pre>private function playerShouldStartANewLap() {&#x000A;    	$lastPositionOnTheBoard = 11;&#x000A;    	return $this-&gt;places[$this-&gt;currentPlayer] &gt; $lastPositionOnTheBoard;&#x000A;    }</pre>
    
    <p>And don't forget to call the method without any parameters in your <code>if</code> statements.</p>
    
    <pre>if ($this-&gt;playerShouldStartANewLap())</pre>
    
    <p>The <code>if</code> statements in the <code>askQuestion()</code> method seem to be all right, as well as the ones in <code>currentCategory()</code>.</p>
    
    <pre>if ($this-&gt;inPenaltyBox[$this-&gt;currentPlayer])</pre>
    
    <p>This is a little bit more complicated, but in the domain and expressive enough.</p>
    
    <pre>if ($this-&gt;currentPlayer == count($this-&gt;players))</pre>
    
    <p>We can work on this one. It is obvious the comparison means, if the current player is out of bound. But as we learned above, we want intention not state. </p>
    
    <pre>if ($this-&gt;shouldResetCurrentPlayer())</pre>
    
    <p>That's much better, and we will reuse it at line 172, 189 and 203. Duplication, I mean triplication, I mean quadruplication, eliminated!</p>
    
    <p>Tests are passing and all <code>if</code> statements were evaluated for complexity.</p>
    
    <h2>Final Thoughts</h2>
    
    <p>There are several lessons that can be learned from refactoring conditionals. First of all, they help better understand the intent of the code. Then if you name the extracted method to represent the intent correctly, you will avoid future name changes. Finding duplication in logic is more difficult than finding duplicated lines of simple code. You may have thought we should do a conscious duplication, but I prefer to deal with duplication when I have unit tests I can trust my life with. The Golden Master is good, but it is at most a safety net, not a parachute.</p>
    
    <p>Thanks for reading and stay tuned for our next tutorial when we will introduce our first unit tests.</p>
    </div>
]]>
</Body>
<Summary>Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it.     I like to think about code just...</Summary>
<Website>http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-3-complex-conditionals--cms-20944</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44295/guest@my.umbc.edu/cfd305f03d395b9969d039dc8acd9003/api/pixel</TrackingUrl>
<Tag>css</Tag>
<Tag>development</Tag>
<Tag>html</Tag>
<Tag>javascript</Tag>
<Tag>mysql</Tag>
<Tag>php</Tag>
<Tag>sql</Tag>
<Tag>wed</Tag>
<Group token="retired-583">Web Developer - Build Group</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/retired-583</GroupUrl>
<AvatarUrl>https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="original">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/original.jpg?1363101197</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="xlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="large">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/large.png?1363101197</AvatarUrl>
<AvatarUrl size="medium">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/medium.png?1363101197</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/small.png?1363101197</AvatarUrl>
<AvatarUrl size="xsmall">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxsmall.png?1363101197</AvatarUrl>
<Sponsor>Web Developer - Build Group</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 15:32:42 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="true" id="44286" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44286">
<Title>Refactoring Legacy Code: Part 3 - Complex Conditionals &amp; Long Methods</Title>
<Body>
<![CDATA[
    <div class="html-content">
    <p>Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, <em>Legacy Code</em>. This is a series that will help you work and deal with it.<br></p>
    
    <p>I like to think about code just as I think about prose. Long, nested, composed sentences with exotic words are hard to understand. From time to time you need one, but most of the time, you can just use plain simple words in short sentences. This is very true for source code also. Complex conditionals are hard to understand. Long methods are like endless sentences.</p>
    
    <h2>From Prose to Code</h2>
    
    <p>Here is a "prosaic" example to cheer you up. First, the all-in-one sentence. The ugly one.</p>
    <p><em>If temperature in the server room is below five degrees, and humidity rises over fifty percent but remains under eighty, and the air pressure is steady, then the senior technician John, who has at least three years of work experience in networking and servers administration should be notified, and he must wake up in the middle of the night, dress up, go out, take his car or call a cab if he does not have a car, drive to the office, enter the building, start the air conditioning and wait until temperature raises over ten degrees and humidity falls below twenty percent.</em></p>
    
    <p>If you can understand, comprehend, and remember that paragraph without re-reading it, I give you a medal (virtual of course). Long, entangled paragraphs written in a single complicated sentence are difficult to understand. Unfortunately, I don't know enough exotic English words to make that even harder to understand.</p>
    <h3>Simplification</h3>
    
    <p>Let's find a way to simplify it a little bit. All of its first part, up until the "then" is a condition. Yes, it is complicated but we could sum it up like this: <em>If environmental conditions represent a risk...</em> ... then something should be done. The complicated expression says we should notify someone who satisfies a lot of conditions: <em>then notify level three tech support</em>. Finally, a whole process is described from waking up the tech guy until all is fixed: <em>and expect environment to be restored within normal parameters.</em> Let's put it all together.</p>
    
    <p><em>If environmental conditions represent a risk, notify level three tech support and expect environment to be restored within normal parameters.</em></p>
    
    <p>Now, that's only about 20% in length compared to the original text. We don't know the details and in the significant majority of the cases, we don't care. And this is very true for source code also. How many times did you care about the implementation details of a <code>logInfo("Some message");</code> method? Probably once, if and when you implemented it. Then it just logs the message into the "info" category. Or when a user purchases one of your products, do you care how to invoice him? No. All you want to care about is <em>if the product was bought, discard it from inventory and invoice it to the buyer</em>. The examples could be endless. They are basically how we write correct software.</p>
    
    <h2>Complex Conditionals</h2>
    
    <p>In this section we will try to apply the prose philosophy to our trivia game. One step at a time. Starting with complex conditionals. Let's begin with some easy code. Just to warm up.</p>
    
    <p>Line twenty of the <code>GameRunner.php</code> file reads like this:</p>
    
    <pre>if (rand($minAnswerId, $maxAnswerId) == $wrongAnswerId)</pre>
    
    <p>How would that sound in prose? <em>If a random number between minimum answer ID and maximum answer ID equals the wrong answer's ID, then...</em></p>
    
    <p>This is not very complicated, but we can still make it simpler. What about this? <em>If wrong answer is selected, then...</em> Better, isn't it?</p>
    
    <h3>The Extract Method Refactoring</h3>
    
    <p>We need a way, a procedure, a technique to move that conditional statement somewhere else. That destination can easily be a method. Or in our case, since we are not inside a class here, a function. This moving of behavior into a new method or function is called the "Extract Method" refactoring. Below are the steps, as defined by Martin Fowler in his excellent book Refactoring: Improving the Design of Existing Code. If you didn't read this book, you should put it on your "To read" list now. It is one of the most essential books for a modern day programmer.</p>
    
    <p>For our tutorial, I have taken the original steps and simplified them a little bit to better fit our needs and our type of tutorial.</p>
    
    <ol>
    	<li>Create a new method and name it after what it does, not how it does it.</li>
    	<li>Copy the code from the extracted place, into the method. Please note, this is <em>copy</em>, do not yet delete the original code.</li>
    	<li>Scan the extracted code for any variables that are local. They must be made parameters for the method.</li>
    	<li>See if any temporary variables are used inside the extracted method. If so, declare them inside it and drop the extra parameter.</li>
    	<li>Pass into the target method the variables as parameters.</li>
    	<li>Replace the extracted code with the call to the target method.</li>
    	<li>Run your tests.</li>
    </ol>
    
    <p>Now this is quite complicated. However, the extract method is arguably the most frequently used refactoring, except for renaming maybe. So you must understand its mechanics.</p>
    
    <p>Luckily for us, modern day IDEs like PHPStorm provide great refactoring tools, as we've seen in the tutorial <a href="http://code.tutsplus.com/tutorials/phpstorm-when-the-ide-really-matters--cms-20787" rel="nofollow external" class="bo">PHPStorm: When the IDE Really Matters</a>. So we will use the features we have at our fingertips, instead of doing it all by hand. This is less error prone and much, much faster.</p>
    
    <p>Just select the desired part of the code and <strong>right-click</strong> it.</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/extract-method-phpstorm.png" style="max-width: 100%; height: auto;">
    
    <p>The IDE will automatically understand that we need three parameters to run our code and it will propose the following solution.</p>
    
    <pre>// ... //&#x000A;    $minAnswerId = 0;&#x000A;    $maxAnswerId = 9;&#x000A;    $wrongAnswerId = 7;&#x000A;    function isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId) {&#x000A;    	return rand($minAnswerId, $maxAnswerId) == $wrongAnswerId;&#x000A;    }&#x000A;    &#x000A;    do {&#x000A;    	$dice = rand(0, 5) + 1;&#x000A;    	$aGame-&gt;roll($dice);&#x000A;    &#x000A;    	if (isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId)) {&#x000A;    		$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    	} else {&#x000A;    		$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    	}&#x000A;    &#x000A;    } while ($notAWinner);</pre>
    
    <p>While this code is syntactically correct, it will break our tests. Between all the noise shown to us in red, blue and black colors, we can spot the reason why:</p>
    
    <pre>Fatal error: Cannot redeclare isCurrentAnswerWrong()&#x000A;    (previously declared in /home/csaba/Personal/Programming/NetTuts&#x000A;    /Refactoring Legacy Code - Part 3: Complex Conditionals and Long Methods&#x000A;    /Source/trivia/php/GameRunner.php:16)&#x000A;    in /home/csaba/Personal/Programming/NetTuts&#x000A;    /Refactoring Legacy Code - Part 3: Complex Conditionals and Long Methods&#x000A;    /Source/trivia/php/GameRunner.php on line 18</pre>
    
    <p>It basically says that we want to declare the function twice. But how can that happen? We have it only once in our <code>GameRunner.php</code>!</p>
    
    <p>Take a look at the tests. There is a <code>generateOutput()</code> method that does a <code>require()</code> on our <code>GameRunner.php</code>. It is called at least twice. Here is the source of the error.</p>
    
    <p>Now we have a dilemma. Because of the seeding of the random generator, we need to call this code with controlled values.</p>
    
    <pre>private function generateOutput($seed) {&#x000A;    	ob_start();&#x000A;    	srand($seed);&#x000A;    	require __DIR__ . '/../trivia/php/GameRunner.php';&#x000A;    	$output = ob_get_contents();&#x000A;    	ob_end_clean();&#x000A;    	return $output;&#x000A;    }</pre>
    
    <p>But there is no way to declare a function twice in PHP, so we need another solution. We start to feel the burden of our golden master testing. Running the whole thing 20000 times, every time we change a piece of code, may not be a solution for the long term. Besides the fact that it takes ages to run, it forces us to change our code to accommodate the way we test it. This is usually a sign of bad tests. The code should change and still make the test pass, but the changes should have reasons to change, coming only from the source code.</p>
    
    <p>But enough talk, we need a solution, even a temporary one will do for now. Migrating to unit tests will start with our next lesson.</p>
    
    <p>One way to solve our problem is to take all the rest of the code in <code>GameRunner.php</code> and put it in a function. Let's say <code>run()</code></p>
    
    <pre>include_once __DIR__ . '/Game.php';&#x000A;    &#x000A;    function isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId) {&#x000A;    	return rand($minAnswerId, $maxAnswerId) == $wrongAnswerId;&#x000A;    }&#x000A;    &#x000A;    function run() {&#x000A;    	$notAWinner;&#x000A;    &#x000A;    	$aGame = new Game();&#x000A;    &#x000A;    	$aGame-&gt;add("Chet");&#x000A;    	$aGame-&gt;add("Pat");&#x000A;    	$aGame-&gt;add("Sue");&#x000A;    &#x000A;    	$minAnswerId = 0;&#x000A;    	$maxAnswerId = 9;&#x000A;    	$wrongAnswerId = 7;&#x000A;    	do {&#x000A;    		$dice = rand(0, 5) + 1;&#x000A;    		$aGame-&gt;roll($dice);&#x000A;    &#x000A;    		if (isCurrentAnswerWrong($minAnswerId, $maxAnswerId, $wrongAnswerId)) {&#x000A;    			$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    		} else {&#x000A;    			$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    		}&#x000A;    &#x000A;    	} while ($notAWinner);&#x000A;    }</pre>
    
    <p>This will allow us to test it, but be aware that running the code from the console will not run the game. We did a slight change in behavior. We gained testability at the cost of a behavioral change, which we did not want to do in the first place. If you want to run the code from the console, now you will need another PHP file that includes or requires the runner and then explicitly calls the run method on it. Not that big of a change but a must to remember, especially if you have third parties using your existing code.</p>
    
    <p>On the other hand, we can now just include the file in our test.</p>
    
    <pre>require __DIR__ . '/../trivia/php/GameRunner.php';</pre>
    
    <p>And then call <code>run()</code> inside the generateOutput() method.</p>
    
    <pre>private function generateOutput($seed) {&#x000A;    	ob_start();&#x000A;    	srand($seed);&#x000A;    	run();&#x000A;    	$output = ob_get_contents();&#x000A;    	ob_end_clean();&#x000A;    	return $output;&#x000A;    }</pre>
    
    <h3>Directory Structure, Files, &amp; Naming</h3>
    
    <p>Maybe this is a good opportunity to think about the structure of our directories and files. There are no more complex conditionals in our <code>GameRunner.php</code>, but before we continue to the <code>Game.php</code> file, we must not leave a mess behind us. Our <code>GameRunner.php</code> is not running anything, anymore and we needed to hack methods together to make it testable, which broke our public interface. The reason for this, is that maybe we are testing the wrong thing.</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/testing-deps-schema.png" style="max-width: 100%; height: auto;">
    
    <p>Our test calls <code>run()</code> in the <code>GameRunner.php</code> file, which includes <code>Game.php</code>, plays the game and a new golden master file is generated. What if we introduce another file? We make the <code>GameRunner.php</code> to actually run the game by calling <code>run()</code> and nothing else. So what if there's no logic in there that could go wrong and no tests are needed, and then we move our current code into another file?</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/testing-deps-with-new-runner.png" style="max-width: 100%; height: auto;">
    
    <p>Now this is a whole different story. Now our tests are accessing the code just under the runner. Basically, our tests are just runners. And of course in our new <code>GameRunner.php</code> there will only be a call to run the game. This is a true runner, it does nothing else but call the <code>run()</code> method. No logic means no tests are needed.</p>
    
    <pre>require_once __DIR__ . '/RunnerFunctions.php';&#x000A;    run();</pre>
    
    <p>There are other questions we could ask ourselves at this point. Do we really need a <code>RunnerFunctions.php</code>? Couldn't we just take the functions from there and move them to <code>Game.php</code>? We probably could, but with our current understanding of, what function belongs where? Is not enough. We will find a place for our method in an upcoming lesson.</p>
    
    <p>We also tried to name our files according to what the code inside them is doing. One is just a bunch of functions for the runner, functions we, at this point consider to belong together, in order to satisfy the needs of the runner. Will this become a class at one point in the future? Maybe. Maybe not. For now, it is good enough.</p>
    
    <h3>Cleaning Up RunnerFunctions</h3>
    
    <p>If we take a look at the <code>RunnerFunctions.php</code> file, there is a little bit of a mess that we've introduced.</p>
    
    <p>We define:</p>
    
    <pre>$minAnswerId = 0;&#x000A;    $maxAnswerId = 9;&#x000A;    $wrongAnswerId = 7;</pre>
    
    <p>... inside the <code>run()</code> method. They have a single reason to exist and a single place where they are used. Why not just define them inside that method and get rid of the parameters altogether?</p>
    
    <pre>function isCurrentAnswerWrong() {&#x000A;    	$minAnswerId = 0;&#x000A;    	$maxAnswerId = 9;&#x000A;    	$wrongAnswerId = 7;&#x000A;    	return rand($minAnswerId, $maxAnswerId) == $wrongAnswerId;&#x000A;    }</pre>
    
    <p>Ok, the tests are passing and the code is much nicer. But not good enough.</p>
    
    <h3>Negative Conditionals</h3>
    
    <p>It is much easier, for the human mind, to comprehend positive reasoning. So if you can avoid negative conditionals, you should always take that path. In our current example, the method checks for a wrong answer. It would be much easier to understand a method that checks for a validity and negate that, when needed.</p>
    
    <pre>function isCurrentAnswerCorrect() {&#x000A;    	$minAnswerId = 0;&#x000A;    	$maxAnswerId = 9;&#x000A;    	$wrongAnswerId = 7;&#x000A;    	return rand($minAnswerId, $maxAnswerId) != $wrongAnswerId;&#x000A;    }</pre>
    
    <p>We used the Rename Method refactoring. This is again, pretty complicated if used by hand, but in any IDE it is as simple as hitting <strong>CTRL+r</strong>, or selecting the appropriate option in the menu. To make our tests pass, we also need to update our conditional statement with a negation.</p>
    
    <pre>if (!isCurrentAnswerCorrect()) {&#x000A;    	$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    } else {&#x000A;    	$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    }</pre>
    
    <p>This brings us one step closer to our understanding of the conditional. Using <code>!</code> in an <code>if()</code> statement, actually helps. It stands out and highlights the fact that something is actually negated there. But can we reverse this in order, to avoid negation completely? Yes we can.</p>
    
    <pre>if (isCurrentAnswerCorrect()) {&#x000A;    	$notAWinner = $aGame-&gt;wasCorrectlyAnswered();&#x000A;    } else {&#x000A;    	$notAWinner = $aGame-&gt;wrongAnswer();&#x000A;    }</pre>
    
    <p>Now we have no logical negation by using <code>!</code>, nor lexical negation by naming and returning the wrong things. All these steps made our conditional much, much more easier to comprehend.</p>
    
    <h2>Conditionals in <code>Game.php</code>
    </h2>
    
    <p>We simplified to the extreme, <code>RunnerFunctions.php</code>. Let's attack our <code>Game.php</code> file now. There are several ways you can search for conditionals. If you prefer, you can just scan the code by simply looking at it. This is slower, but has the added value of forcing you to try to understand it sequentially.</p>
    
    <p>The second obvious way to search for conditionals, is to just do a find for "if" or "if (". If you formatted your code with the built-in features of your IDE, you can be sure that all conditional statements have the same specific form. In my case, there is a space between the "if" and the parenthesis. Also, if you use the built-in search, the found results will be highlighted in a strident color, in my case yellow.</p>
    <img alt="" src="https://s3.amazonaws.com/cms-assets.tutsplus.com/uploads/users/45/posts/20944/image/ide-find-highlights.png" style="max-width: 100%; height: auto;">
    
    <p>Now that we have all of them lighting up our code like a Christmas tree, we can take them one by one. We know the drill, we know the techniques we can use, it's time to apply them.</p>
    
    <pre>if ($this-&gt;inPenaltyBox[$this-&gt;currentPlayer])</pre>
    
    <p>This seems pretty reasonable. We could extract it into a method, but would there be a name for that method in order to make the condition clearer?</p>
    
    <pre>if ($roll % 2 != 0) </pre>
    
    <p>I bet 90% of all programmers can understand the problem in the above <code>if</code> statement. We are trying to concentrate on what our current method does. And our brain is wired into the domain of the problem. We don't want to "start another thread" to compute that mathematical expression in order to understand that it just checks if a number is odd. This is one of those small distractions that can ruin a difficult logical deduction. So I say let's extract it.</p>
    
    <pre>if ($this-&gt;isOdd($roll))</pre>
    
    <p>That is better because it is about the problem's domain and requires no additional brain power.</p>
    
    <pre>if ($this-&gt;places[$this-&gt;currentPlayer] &gt; $lastPositionOnTheBoard)</pre>
    
    <p>This seems to be another good candidate. It is not that difficult to understand as a mathematical expression, but again, it is an expression that needs side-processing. I am asking myself, what does it mean if the current player's position reached the end of the board? Can't we express this state in a more concise way? We probably can.</p>
    
    <pre>if ($this-&gt;playerReachedEndOfBoard($lastPositionOnTheBoard))</pre>
    
    <p>This is better. But what actually happens inside the <code>if</code>? The player is repositioned at the beginning of the board. The player starts a new "lap" in the race. What if in the future, we will have a different reason for starting a new lap? Should our <code>if</code> statement change when we change the underlying logic in the private method? Absolutely not! So, let's rename this method into what the <code>if</code> represents, into what happens, not what we are checking for. </p>
    
    <pre>if ($this-&gt;playerShouldStartANewLap($lastPositionOnTheBoard))</pre>
    
    <p>When you try to name methods and variables, always think about what the code should do and not what state or condition it represents. Once you get this right, renaming actions in your code will drop significantly. But still, even an experienced programmer needs to rename a method at least three to five times before finding its correct name. So don't be afraid to hit <strong>CTRL+r</strong> and rename frequently. Never commit your changes to the project's VCS if you did not scan the names of your newly added methods and your code does not read like well written prose. Renaming is so cheap in our days, that you can rename things just to try out various versions and revert with a single hit of a button.</p>
    
    <p>The <code>if</code> statement at line 90 is the same as our previous one. We can just reuse our extracted method. Voila, duplication eliminated! And don't forget to run your tests now-and-then, even when you refactor by using your IDE's magic. Which leads us to our next observation. Magic, sometimes, fails. Check out line 65.</p>
    
    <pre>$lastPositionOnTheBoard = 11;</pre>
    
    <p>We declare a variable and use it only in a single place, as a parameter to our newly extracted method. This strongly suggests that the variable should be inside the method.</p>
    
    <pre>private function playerShouldStartANewLap() {&#x000A;    	$lastPositionOnTheBoard = 11;&#x000A;    	return $this-&gt;places[$this-&gt;currentPlayer] &gt; $lastPositionOnTheBoard;&#x000A;    }</pre>
    
    <p>And don't forget to call the method without any parameters in your <code>if</code> statements.</p>
    
    <pre>if ($this-&gt;playerShouldStartANewLap())</pre>
    
    <p>The <code>if</code> statements in the <code>askQuestion()</code> method seem to be all right, as well as the ones in <code>currentCategory()</code>.</p>
    
    <pre>if ($this-&gt;inPenaltyBox[$this-&gt;currentPlayer])</pre>
    
    <p>This is a little bit more complicated, but in the domain and expressive enough.</p>
    
    <pre>if ($this-&gt;currentPlayer == count($this-&gt;players))</pre>
    
    <p>We can work on this one. It is obvious the comparison means, if the current player is out of bound. But as we learned above, we want intention not state. </p>
    
    <pre>if ($this-&gt;shouldResetCurrentPlayer())</pre>
    
    <p>That's much better, and we will reuse it at line 172, 189 and 203. Duplication, I mean triplication, I mean quadruplication, eliminated!</p>
    
    <p>Tests are passing and all <code>if</code> statements were evaluated for complexity.</p>
    
    <h2>Final Thoughts</h2>
    
    <p>There are several lessons that can be learned from refactoring conditionals. First of all, they help better understand the intent of the code. Then if you name the extracted method to represent the intent correctly, you will avoid future name changes. Finding duplication in logic is more difficult than finding duplicated lines of simple code. You may have thought we should do a conscious duplication, but I prefer to deal with duplication when I have unit tests I can trust my life with. The Golden Master is good, but it is at most a safety net, not a parachute.</p>
    
    <p>Thanks for reading and stay tuned for our next tutorial when we will introduce our first unit tests.</p>
    </div>
]]>
</Body>
<Summary>Old code. Ugly code. Complicated code. Spaghetti code. Gibberish nonsense. In two words, Legacy Code. This is a series that will help you work and deal with it.     I like to think about code just...</Summary>
<Website>http://code.tutsplus.com/tutorials/refactoring-legacy-code-part-3-complex-conditionals-long-methods--cms-20944</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44286/guest@my.umbc.edu/eb2dd89101d2aca86acb9699a9c1c282/api/pixel</TrackingUrl>
<Tag>css</Tag>
<Tag>development</Tag>
<Tag>html</Tag>
<Tag>javascript</Tag>
<Tag>mysql</Tag>
<Tag>php</Tag>
<Tag>sql</Tag>
<Tag>wed</Tag>
<Group token="retired-583">Web Developer - Build Group</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/retired-583</GroupUrl>
<AvatarUrl>https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="original">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/original.jpg?1363101197</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="xlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="large">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/large.png?1363101197</AvatarUrl>
<AvatarUrl size="medium">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/medium.png?1363101197</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/small.png?1363101197</AvatarUrl>
<AvatarUrl size="xsmall">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxsmall.png?1363101197</AvatarUrl>
<Sponsor>Web Developer - Build Group</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 15:32:42 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="false" id="109704" important="false" status="posted" url="https://my3.my.umbc.edu/posts/109704">
<Title>Advancing Excellence: Innovative Curriculum and Pedagogy</Title>
<Body>
<![CDATA[
    <div class="html-content">This is the third in a series of articles on the four focus areas that are part of UMBC’s strategic planning process. The primary goal of the Innovative Curriculum and Pedagogy strategy group is to develop strategies and goals that will enable UMBC to continue its leadership in innovative curricula and academic programs that support and enhance undergraduate and graduate student success; prepare students for meaningful careers, lifelong learning, and engaged citizenship; and thereby maintain and enhance UMBC’s position as a national leader in undergraduate and graduate education. Jeff Leips, associate professor, biological sciences, and Carole McCann, professor and chair, …</div>
]]>
</Body>
<Summary>This is the third in a series of articles on the four focus areas that are part of UMBC’s strategic planning process. The primary goal of the Innovative Curriculum and Pedagogy strategy group is...</Summary>
<Website>https://news.umbc.edu/advancing-excellence-innovative-curriculum-and-pedagogy/</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/109704/guest@my.umbc.edu/0707193e66d4cf7f2e1f57853b561ed0/api/pixel</TrackingUrl>
<Tag>community</Tag>
<Group token="umbc-news">UMBC News</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/umbc-news</GroupUrl>
<AvatarUrl>https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xsmall.png?1632921809</AvatarUrl>
<AvatarUrl size="original">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/original.png?1632921809</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xxlarge.png?1632921809</AvatarUrl>
<AvatarUrl size="xlarge">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xlarge.png?1632921809</AvatarUrl>
<AvatarUrl size="large">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/large.png?1632921809</AvatarUrl>
<AvatarUrl size="medium">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/medium.png?1632921809</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/small.png?1632921809</AvatarUrl>
<AvatarUrl size="xsmall">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xsmall.png?1632921809</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xxsmall.png?1632921809</AvatarUrl>
<Sponsor>UMBC News</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>false</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 15:24:35 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="false" id="44279" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44279">
<Title>Office hours - Commons Drive!!</Title>
<Body>
<![CDATA[
    <div class="html-content">
    <div>Attention Team Study Groups!</div>
    <div><br></div>If you missed my office hours today, do not worry, you can stop by to see me on Monday!  I will be holding office hours<strong> Monday, 5/5,</strong> in the Commons from<strong> 11am - 1:00pm</strong>. <div><br></div>
    <div>Stop by to register your current study groups (<u><em><strong>ANY STUDY GROUP</strong></em></u> that you have been involved with during the Spring 2014 semester), receive help finding study groups, or give me updates.<div>
    <div><br></div>
    <div>Hope to see you there!</div>
    <div><br></div>
    <div>Dr. Felix</div>
    </div>
    </div>
    </div>
]]>
</Body>
<Summary>Attention Team Study Groups!    If you missed my office hours today, do not worry, you can stop by to see me on Monday!  I will be holding office hours Monday, 5/5, in the Commons from 11am -...</Summary>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44279/guest@my.umbc.edu/a4b0caeed60baaf41999abf6edae6888/api/pixel</TrackingUrl>
<Group token="retired-635">iCubed Cohort 3: Team Study Groups</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/retired-635</GroupUrl>
<AvatarUrl>https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/xsmall.png?1375732423</AvatarUrl>
<AvatarUrl size="original">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/original.png?1375732423</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/xxlarge.png?1375732423</AvatarUrl>
<AvatarUrl size="xlarge">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/xlarge.png?1375732423</AvatarUrl>
<AvatarUrl size="large">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/large.png?1375732423</AvatarUrl>
<AvatarUrl size="medium">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/medium.png?1375732423</AvatarUrl>
<AvatarUrl size="small">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/small.png?1375732423</AvatarUrl>
<AvatarUrl size="xsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/xsmall.png?1375732423</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/635/8e47b6819f70d10722612702859d8ae2/xxsmall.png?1375732423</AvatarUrl>
<Sponsor>iCubed Cohort 3: Team Study Groups</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 15:15:08 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="true" id="44281" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44281">
<Title>A Vision of the Future From Those Likely to Invent It</Title>
<Body>
<![CDATA[
    <div class="html-content">In a series of interviews, seven people who are driving this transformation provided a glimpse into the not-too-distant future<br><br><br><a href="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/rc/1/rc.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/rc/1/rc.img" style="max-width: 100%; height: auto;"></a><br><a href="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/rc/2/rc.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/rc/2/rc.img" style="max-width: 100%; height: auto;"></a><br><a href="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/rc/3/rc.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/rc/3/rc.img" style="max-width: 100%; height: auto;"></a><br><br><a href="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/a2.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505520518/u/0/f/640387/c/34625/s/3a00a1c5/sc/21/a2.img" style="max-width: 100%; height: auto;"></a>
    </div>
]]>
</Body>
<Summary>In a series of interviews, seven people who are driving this transformation provided a glimpse into the not-too-distant future</Summary>
<Website>http://rss.nytimes.com/c/34625/f/640387/s/3a00a1c5/sc/21/l/0L0Snytimes0N0Cinteractive0C20A140C0A50C0A20Cupshot0CFUTURE0Bhtml0Dpartner0Frss0Gemc0Frss/story01.htm</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44281/guest@my.umbc.edu/96cbfea1977ef1d83950a2e4b6edd731/api/pixel</TrackingUrl>
<Tag>new</Tag>
<Tag>technology</Tag>
<Tag>york</Tag>
<Group token="retired-583">Web Developer - Build Group</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/retired-583</GroupUrl>
<AvatarUrl>https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="original">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/original.jpg?1363101197</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="xlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="large">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/large.png?1363101197</AvatarUrl>
<AvatarUrl size="medium">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/medium.png?1363101197</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/small.png?1363101197</AvatarUrl>
<AvatarUrl size="xsmall">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxsmall.png?1363101197</AvatarUrl>
<Sponsor>Web Developer - Build Group</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 15:12:22 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="false" id="109705" important="false" status="posted" url="https://my3.my.umbc.edu/posts/109705">
<Title>Rethinking Intellectual Activism Recap</Title>
<Body>
<![CDATA[
    <div class="html-content">On April 12, 2014 over one hundred graduate students, faculty, staff, and community partners gathered in UMBC’s Performing Arts and Humanities Building for the Rethinking Intellectual Activism graduate student conference. Presenters represented UMBC’s Language, Literacy and Culture (LLC) Doctoral Program and the departments of Geography and Environmental Systems, Public Policy, Psychology, and Sociology, as well as universities across the country, such as UCLA, MICA, George Mason, and the University of Louisville, and the world, such as University of Oxford, England, Sabancı University, Turkey and North South University, Bangladesh. Presenters and attendees discussed a variety of topics connected to the notion …</div>
]]>
</Body>
<Summary>On April 12, 2014 over one hundred graduate students, faculty, staff, and community partners gathered in UMBC’s Performing Arts and Humanities Building for the Rethinking Intellectual Activism...</Summary>
<Website>https://news.umbc.edu/rethinking-intellectual-activism-recap/</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/109705/guest@my.umbc.edu/872b6845c3a9014076d626a7b0b3b894/api/pixel</TrackingUrl>
<Tag>community</Tag>
<Tag>llc</Tag>
<Group token="umbc-news">UMBC News</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/umbc-news</GroupUrl>
<AvatarUrl>https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xsmall.png?1632921809</AvatarUrl>
<AvatarUrl size="original">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/original.png?1632921809</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xxlarge.png?1632921809</AvatarUrl>
<AvatarUrl size="xlarge">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xlarge.png?1632921809</AvatarUrl>
<AvatarUrl size="large">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/large.png?1632921809</AvatarUrl>
<AvatarUrl size="medium">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/medium.png?1632921809</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/small.png?1632921809</AvatarUrl>
<AvatarUrl size="xsmall">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xsmall.png?1632921809</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/001/944/2c79aeea85b1abb37f8cf9fbcdc382b0/xxsmall.png?1632921809</AvatarUrl>
<Sponsor>UMBC News</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>false</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 14:26:59 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="false" id="122628" important="false" status="posted" url="https://my3.my.umbc.edu/posts/122628">
<Title>Round-Up: UMBC In the News, 5/2</Title>
<Body>
<![CDATA[
    <div class="html-content">
    <p><em>One of the things that makes UMBC great is how wonderful our alumni, students, faculty and staff are. Because of these amazing people, UMBC often finds itself “in the news,” so each week, we’ll be sharing with you a round-up of the most newsworthy achievements from our community.</em></p>
    <ul>
    <li><a href="http://umbcinsights.wordpress.com/2014/04/17/visual-arts-faculty-and-imda-candidate-in-socially-engaged-art-journal/" rel="nofollow external" class="bo">Visual Arts Faculty and IMDA Candidate in Socially Engaged Art Journal</a></li>
    <li><a href="http://umbcinsights.wordpress.com/2014/04/18/laura-hussey-political-science-on-marylandreporter-com/" rel="nofollow external" class="bo">Laura Hussey, Political Science, on MarylandReporter.com</a></li>
    <li><a href="http://umbcinsights.wordpress.com/2014/04/18/ellen-handler-spitz-honors-college-writes-essay-in-city-paper-for-national-library-week/" rel="nofollow external" class="bo">Ellen Handler Spitz, Honors College, Writes Essay in City Paper for National Library Week</a></li>
    <li><a href="http://umbcinsights.wordpress.com/2014/04/23/constantine-vaporis-asian-studies-op-ed-in-al-jazeera-america-2/" rel="nofollow external" class="bo">Constantine Vaporis, Asian Studies, Op-Ed in Al Jazeera America</a></li>
    <li><a href="http://umbcinsights.wordpress.com/2014/04/25/michelle-stefano-american-studies-in-city-paper/" rel="nofollow external" class="bo">Michelle Stefano, American Studies, in City Paper</a></li>
    <li><a href="http://umbcinsights.wordpress.com/2014/04/25/john-rennie-short-public-policy-in-world-future-review/" rel="nofollow external" class="bo">John Rennie Short, Public Policy, in World Future Review</a></li>
    </ul>
    <p>Check out all the other great campus news on <a href="http://umbcinsights.wordpress.com/" rel="nofollow external" class="bo">Insights Weekly</a>.</p>
    </div>
]]>
</Body>
<Summary>One of the things that makes UMBC great is how wonderful our alumni, students, faculty and staff are. Because of these amazing people, UMBC often finds itself “in the news,” so each week, we’ll be...</Summary>
<Website>https://umbc.edu/stories/round-up-umbc-in-the-news-52/</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/122628/guest@my.umbc.edu/17785680ff75b09264b037d2aa014334/api/pixel</TrackingUrl>
<Tag>al-jazeera-america</Tag>
<Tag>alumni</Tag>
<Tag>city-paper</Tag>
<Tag>constantine-vaporis</Tag>
<Tag>ellen-handler-spitz</Tag>
<Tag>imda-candidate</Tag>
<Tag>john-rennie-short</Tag>
<Tag>laura-hussey</Tag>
<Tag>marylandreporter-com</Tag>
<Tag>michelle-stefano</Tag>
<Tag>national-library-week</Tag>
<Tag>socially-engaged-art-journal</Tag>
<Tag>visual-arts-faculty</Tag>
<Tag>world-future-review</Tag>
<Group token="umbc-news-magazine">UMBC News &amp;amp; Magazine</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/umbc-news-magazine</GroupUrl>
<AvatarUrl>https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/xsmall.png?1748556657</AvatarUrl>
<AvatarUrl size="original">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/original.png?1748556657</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/xxlarge.png?1748556657</AvatarUrl>
<AvatarUrl size="xlarge">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/xlarge.png?1748556657</AvatarUrl>
<AvatarUrl size="large">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/large.png?1748556657</AvatarUrl>
<AvatarUrl size="medium">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/medium.png?1748556657</AvatarUrl>
<AvatarUrl size="small">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/small.png?1748556657</AvatarUrl>
<AvatarUrl size="xsmall">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/xsmall.png?1748556657</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/001/943/24435aa6207c452e7bc15cc74b42c7bb/xxsmall.png?1748556657</AvatarUrl>
<Sponsor>UMBC News &amp; Magazine</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>false</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 14:00:18 -0400</PostedAt>
</NewsItem>

<NewsItem contentIssues="true" id="44278" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44278">
<Title>PayPal&#8217;s new logo fails to impress</Title>
<Body>
<![CDATA[
    <div class="html-content">
    <p><img alt="thumbnail" src="http://netdna.webdesignerdepot.com/uploads/2014/05/thumbnail2.jpg" width="200" height="160" style="max-width: 100%; height: auto;">This week saw PayPal reveal a redesign of several key brand elements, including their first logo redesign for seven years. The new look is expected to roll out worldwide in the coming weeks.</p> <p>However, despite PayPal’s marketing spin, the new logo bears all of the hallmarks of a design that was arrived at on a whim and rationalised after the fact.</p> <p></p>
    <div class="embed-container"><iframe src="//www.youtube.com/embed/DIn3M72rfdA" frameborder="0" webkitallowfullscreen="webkitAllowFullScreen" mozallowfullscreen="mozallowfullscreen" allowfullscreen="allowFullScreen">[Video]</iframe></div> <p>Brand continuity is a big issue for PayPal: significant change would leave thousands of websites bearing the old PayPal branding dated and less trusted. Anyone using PayPal’s embed code can relax, the branding will be updated automatically, but the tens of thousands of businesses that use third-party carts may find their checkouts looking outdated.</p> <p>Broadly speaking the new logo, which consists of a wordmark and monogram, are in keeping with the previous incarnation. The pseudo italic lean is an ill-conceived metaphor for progress and dynamism, and the increased diagonal stress on the ‘y’ makes the shape tilt drunkenly in the middle, but considering the existing brand recognition—which is PayPal’s primary asset if you discount its eBay monopoly—the team at <a href="http://www.fuseproject.com/work/paypal/brand_identity/?focus=overview" rel="nofollow external" class="bo">Fuseproject</a> (who designed the new look) were wise to retain the feature.</p> <blockquote> <p>We want this update to confer a sense of momentum that embodies our vision of optimism, progress and empowerment. For our name, we chose a typeface, colors and shapes that are simpler, richer and more vibrant.</p> </blockquote> <p>The new logo uses a modified form of Futura, and this is my first issue with the new design: Futura is a geometric sans-serif engineered rather than drawn; it’s a fine typeface, but it communicates nothing about human connectivity. PayPal say they want to emphasise the human aspect of their business, but no amount of rounded corners will change the typeface’s underlying aesthetics.</p> <p>The wordmark itself has been poorly executed. It’s normal that letterspace varies; kerning can correct some issues, as can ligatures; but the incompatibility of some letter combinations means that variable spacing is inevitable. The only approach is for whitespace to be optically balanced.</p> <p><img src="http://netdna.webdesignerdepot.com/uploads/2014/05/web.jpg" width="650" alt="PayPals new logo fails to impress" style="max-width: 100%; height: auto;"></p> <p><em>The new logo online.</em></p> <p>In PayPal’s case several combinations are problematic: ‘Pa’ leaves a hole beneath the ‘P’, and the angle of the strokes on the ‘y’ cause excess space between it and both the ‘a’ and ‘P’. In fact the only combination that doesn’t present a problem to a designer is the ‘al’ combination.</p> <p>It’s ironic then, that it’s precisely the ‘al’ characters that cause the problem in the new design. Because extra whitespace leaks into every other letter combination, the <em>correct</em> spacing between the ‘a’ and the ‘l’ is optically <em>incorrect</em>. The final letterspace in the word is too tight, and once you’ve seen it, you can’t unsee it.</p> <p><img src="http://netdna.webdesignerdepot.com/uploads/2014/05/email.jpg" width="650" alt="PayPals new logo fails to impress" style="max-width: 100%; height: auto;"></p> <p><em>The new logo in email.</em></p> <blockquote> <p>Connecting people to people is what we do. We’ve redesigned our “double P” monogram to reflect this connection.</p> </blockquote> <p>The rationale for the monogram is that the ‘P’s with filled counters will be more recognizable from a distance. Certainly, in combination with the more saturated color palette, the monogram feels more like a financial service than the previous logo; it wouldn’t be out of place on an ATM, and there’s more than a nod towards the ubiquitous MasterCard/Maestro branding.</p> <p>A lot of designers are querying the third color generated by the overlapping ‘P’s, stating that it’s too difficult to spot, or that it looks like a printing error. However, it’s the one part of the monogram I actually like, it allows the shapes to hint at the missing counters and I think the shape would be considerably less legible without it.</p> <p><img src="http://netdna.webdesignerdepot.com/uploads/2014/05/comparison.jpg" width="650" alt="PayPals new logo fails to impress" style="max-width: 100%; height: auto;"></p> <p><em>PayPal’s logo, old and new.</em></p> <p>Where the monogram falls down is depth. The darker ‘P’s bowl is larger—although strangely the stems are the same size—bringing the shape forward into the foreground ahead of the lighter ‘P’. But the darker ‘P’ is a darker tone, causing it to recede behind the lighter ‘P’. But the darker ‘P’ is closer in tone to the third color so it appears to overlap the lighter ‘P’. But the only sharp corner in the outline is the bottom right of the darker ‘P’s stem, making it appear that the lighter ‘P’ overlaps the darker.</p> <p>The overall effect is a logo that is literally fighting with itself; an apt metaphor for anyone who has ever had to wade through PayPal’s woeful documentation, but hardly the message the redesign was intended to communicate.</p> <p>Ultimately, PayPal is a globally successful corporation, with enough money to continue to dominate the market. Most people will simply never notice this change in branding. However, it’s disappointing to see yet another large tech firm make basic design errors in a key piece of their visual identity.</p> <p><br><br> </p>
    <table width="100%"> <tbody>
    <tr> <td> <a href="http://www.mightydeals.com/deal/tink-tank-wordpress-theme-bundle.html?ref=inwidget" rel="nofollow external" class="bo"><strong>7 Unique Responsive Tink Tank WordPress Themes – only $27!</strong></a> </td> <td> <a href="http://www.mightydeals.com/?ref=inwidget" rel="nofollow external" class="bo"><br> <img src="http://mightydeals.com/web/images/widget-logo.png" height="40" width="90" alt="PayPals new logo fails to impress" style="max-width: 100%; height: auto;"><br> </a> </td> </tr> </tbody>
    </table> <p><br> </p> <a href="http://www.webdesignerdepot.com/2014/05/paypals-new-logo-fails-to-impress/" rel="nofollow external" class="bo">Source</a> <br><br><br><a href="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/rc/1/rc.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/rc/1/rc.img" style="max-width: 100%; height: auto;"></a><br><a href="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/rc/2/rc.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/rc/2/rc.img" style="max-width: 100%; height: auto;"></a><br><a href="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/rc/3/rc.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/rc/3/rc.img" style="max-width: 100%; height: auto;"></a><br><br><a href="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/a2.htm" rel="nofollow external" class="bo"><img src="http://da.feedsportal.com/r/195505491865/u/49/f/661066/c/35285/s/3a004f26/sc/4/a2.img" style="max-width: 100%; height: auto;"></a>
    </div>
]]>
</Body>
<Summary>This week saw PayPal reveal a redesign of several key brand elements, including their first logo redesign for seven years. The new look is expected to roll out worldwide in the coming weeks....</Summary>
<Website>http://rss.feedsportal.com/c/35285/f/661066/s/3a004f26/sc/4/l/0L0Swebdesignerdepot0N0C20A140C0A50Cpaypals0Enew0Elogo0Efails0Eto0Eimpress0C/story01.htm</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44278/guest@my.umbc.edu/82f21a769b7353caa8742aa104e9673e/api/pixel</TrackingUrl>
<Tag>art</Tag>
<Tag>branding</Tag>
<Tag>branding-inspiration</Tag>
<Tag>css</Tag>
<Tag>design</Tag>
<Tag>development</Tag>
<Tag>html</Tag>
<Tag>html5</Tag>
<Tag>illustrator</Tag>
<Tag>javascript</Tag>
<Tag>logo-inspiration</Tag>
<Tag>logos</Tag>
<Tag>mysql</Tag>
<Tag>oracle</Tag>
<Tag>paypal</Tag>
<Tag>paypal-branding</Tag>
<Tag>paypal-logo</Tag>
<Tag>photoshop</Tag>
<Tag>php</Tag>
<Tag>rebrands</Tag>
<Tag>sql</Tag>
<Tag>tech-branding</Tag>
<Group token="retired-583">Web Developer - Build Group</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/retired-583</GroupUrl>
<AvatarUrl>https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="original">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/original.jpg?1363101197</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="xlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xlarge.png?1363101197</AvatarUrl>
<AvatarUrl size="large">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/large.png?1363101197</AvatarUrl>
<AvatarUrl size="medium">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/medium.png?1363101197</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/small.png?1363101197</AvatarUrl>
<AvatarUrl size="xsmall">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xsmall.png?1363101197</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/583/fc60f5d7abc2e080599bb6dc465db54d/xxsmall.png?1363101197</AvatarUrl>
<Sponsor>Web Developer - Build Group</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 13:15:00 -0400</PostedAt>
<EditAt>Fri, 02 May 2014 13:15:00 -0400</EditAt>
</NewsItem>

<NewsItem contentIssues="false" id="44076" important="false" status="posted" url="https://my3.my.umbc.edu/posts/44076">
<Title>ANVISA certifies Next Breath</Title>
<Tagline>as center for in-vitro pharmaceutical equivalence</Tagline>
<Body>
<![CDATA[
    <div class="html-content"><table border="0" width="100%"><tbody>
    <tr>
    <td>
    <h4>
                                    ANVISA certifies Next Breath as center for in-vitro pharmaceutical equivalence</h4>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <span>
                                    Our Bureau, Bengaluru</span><br><p>
                                <span>
                                    Friday, May 02, 2014, 14:15 Hrs  [IST]</span>
                            </p>
    </td>
                        </tr>
                        <tr>
                            <td>
                            <br>
    </td>
                        </tr>
                        <tr>
                            <td>
                                <p>
                                    Next Breath, LLC, a member of Aptar Group,  has successfully completed its audit carried out by the Brazilian National Sanitary Surveillance Agency (ANVISA) and its facility is now recognised as a Center for Pharmaceutical Equivalence (EQFAR).<br><br>As a result, Next Breath is now authorized to conduct Pharmaceutical Equivalence studies for Brazil. In November 2013, ANVISA performed a week-long comprehensive audit of Next Breath’s quality systems.<br><br>The audit focused on ensuring that all quality systems, analytical capabilities, regulatory expertise and statistical expertise meet ANVISA’s rigorous standard for becoming an approved Center for Pharmaceutical Equivalence. The successful audit approves Next Breath for performing in vitro pharmaceutical equivalence and submission of Nasal Sprays, Dry Powder Inhalers (DPIs), and Pressurized Metered Dose Inhalers (pMDIs) to the Brazilian authorities.<br><br>Only ANVISA certified laboratories are authorized to perform in-vitro pharmaceutical equivalence testing for generic applications in the Brazilian market. The Center for Pharmaceutical Equivalence certification makes Next Breath the only laboratory outside Brazil certified to perform in vitro pharmaceutical equivalence testing for use in the Brazilian market.<br><br>According to Dr. Julie Suman, president, Next Breath, the recognition as an EQFAR laboratory allows us to bring our scientific expertise and know-how to advance generic drug approvals.<br><br>“ANVISA’s certification is an important milestone for Next Breath. The ability to support our partners will be greatly enhanced with Next Breath’s direct engagement of ANVISA”, stated Badre Hammond, Associate Director,  Business Development, Next Breath.<br><br>Aptar Group is a cGMP specialty Contract Research Organization (CRO) with analytical expertise for pharmaceutical, biotechnology, and consumer health product development focused on pulmonary, nasal, topical and ophthalmic delivery systems. Next Breath provides comprehensive solutions to the development processes from proof of concept to commercialization. It  has led successful submissions for pulmonary and nasal drug products and devices in the US and international markets.</p>
    </td>
    </tr>
    </tbody></table></div>
]]>
</Body>
<Summary>ANVISA certifies Next Breath as center for in-vitro pharmaceutical equivalence...</Summary>
<Website>http://www.pharmabiz.com/NewsDetails.aspx?aid=81665&amp;sid=2</Website>
<TrackingUrl>https://my3.my.umbc.edu/api/v0/pixel/news/44076/guest@my.umbc.edu/82183e19f9dc6b4637c1cf8cc04fc7bc/api/pixel</TrackingUrl>
<Group token="bwtech">bwtech@UMBC Research and Technology Park</Group>
<GroupUrl>https://my3.my.umbc.edu/groups/bwtech</GroupUrl>
<AvatarUrl>https://assets1-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/xsmall.png?1760034935</AvatarUrl>
<AvatarUrl size="original">https://assets2-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/original.png?1760034935</AvatarUrl>
<AvatarUrl size="xxlarge">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/xxlarge.png?1760034935</AvatarUrl>
<AvatarUrl size="xlarge">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/xlarge.png?1760034935</AvatarUrl>
<AvatarUrl size="large">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/large.png?1760034935</AvatarUrl>
<AvatarUrl size="medium">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/medium.png?1760034935</AvatarUrl>
<AvatarUrl size="small">https://assets4-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/small.png?1760034935</AvatarUrl>
<AvatarUrl size="xsmall">https://assets1-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/xsmall.png?1760034935</AvatarUrl>
<AvatarUrl size="xxsmall">https://assets3-my.umbc.edu/system/shared/avatars/groups/000/000/410/afff9420ec03574fa84c6bb85b54a3e3/xxsmall.png?1760034935</AvatarUrl>
<Sponsor>bwtech@UMBC</Sponsor>
<PawCount>0</PawCount>
<CommentCount>0</CommentCount>
<CommentsAllowed>true</CommentsAllowed>
<PostedAt>Fri, 02 May 2014 12:11:00 -0400</PostedAt>
<EditAt>Fri, 02 May 2014 12:15:04 -0400</EditAt>
</NewsItem>

</News>
