New User Special Price Expires in

Let's log you in.

Sign in with Facebook


Don't have a StudySoup account? Create one here!


Create a StudySoup account

Be part of our community, it's free to join!

Sign up with Facebook


Create your account
By creating an account you agree to StudySoup's terms and conditions and privacy policy

Already have a StudySoup account? Login here

Lecture 2 - Good Code, Bad Code

by: Jerry Tan

Lecture 2 - Good Code, Bad Code CS2103

Jerry Tan
GPA 4.3
Software Engineering
Damith C. Rajapakse

Almost Ready


These notes were just uploaded, and will be ready to view shortly.

Purchase these notes here, or revisit this page.

Either way, we'll remind you when they're ready :)

Preview These Notes for FREE

Get a free preview of these Notes, just enter your email below.

Unlock Preview
Unlock Preview

Preview these materials now for free

Why put in your email? Get access to more of this material and other relevant free materials for your school

View Preview

About this Document

Anybody can write code that the computer understands, but only the good programmers can write code that humans understand. In this lecture, find out 1) What makes code good? 2) Features of good c...
Software Engineering
Damith C. Rajapakse
Class Notes
25 ?




Popular in Software Engineering

Popular in Quantitative Methods

This 3 page Class Notes was uploaded by Jerry Tan on Saturday August 22, 2015. The Class Notes belongs to CS2103 at National University of Singapore taught by Damith C. Rajapakse in Summer 2015. Since its upload, it has received 130 views. For similar materials see Software Engineering in Quantitative Methods at National University of Singapore.


Reviews for Lecture 2 - Good Code, Bad Code


Report this Material


What is Karma?


Karma is the currency of StudySoup.

You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 08/22/15
National University of Singapore NUS CS2103 Software Engineering AY2015 SEM 1 Lecture 2 Good Code Bad Code Friday 21St August 2015 By Jerry Tan Si Kai Good code Bad code What are the qualities of production level code 1 Performance 2 Readability 3 Functionality 4 Ease of maintenance 5 Documentation Code quality is measured by WTF min Practices for better quality code 1 Follow a standard a Indentation b Function naming c Syntax d All code in any codebase should look like a single person typed it no matter how many people contributedquot 2 Comment a Some comments are wrong b Some comments will eventually be wrong c Selfexplanatory code works better than having comments so what really is the value of comments d Good comments explain i What the function is supposed to do ii Why do we call certain methods purpose for doing something iii How it is implemented e Avoid magic numbers define a constant for frequently used numbers 3 Exploit abstraction SLAP 4 Optimize if you must Single Level of Abstraction Per Function SLAP What 1 In order to make sure our functions are doing one thingquot we need to make sure that the statements within the function are at the same level of abstraction 2 Eg public static void main String args String command getCommandscanner String result parseCommandO String msg executeCommandresult0 result1 printExecutionResultmsg 3 Do not mix high intermediate and low level abstractions within the same function Why SLAP 1 There is a limit to how much the brain can process it is easier to understand smaller functions than bigger functions 2 Breakdown big problems into smaller manageable bitesized chunks Why not SLAP 1 More functions slow down the code a Prematurely optimizing code is the root of evil in programmingquot b Obscures the code c The code where you optimize may not even be the one that gets executed d Negligible improvements in performance Messy things get messier fast So we have to clean up code Refactor cleaning up code by modifying it incrementally without modifying behaviour But refactoring may introduce regression So perform a regression test after refactoring Revision Control Software We are using Git for C82 103 Repository folder containing all the files and folder that the RC5 will track Local your computer Remote server does not exist on your computer


Buy Material

Are you sure you want to buy this material for

25 Karma

Buy Material

BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.


You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

Why people love StudySoup

Steve Martinelli UC Los Angeles

"There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

Kyle Maynard Purdue

"When you're taking detailed notes and trying to help everyone else out in the class, it really helps you learn and understand the I made $280 on my first study guide!"

Bentley McCaw University of Florida

"I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"


"Their 'Elite Notetakers' are making over $1,200/month in sales by creating high quality content that helps their classmates in a time of need."

Become an Elite Notetaker and start selling your notes online!

Refund Policy


All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email


StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here:

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.