software development fundamentals
TRANSCRIPT
SOFTWARE DEVELOPMENT FUNDAMENTALS
by: A.J. Grandeza, Co-founder Lean Agenda
Topics1. About Lean Agenda2. About the Speaker3. Expectations4. Core Programming – the basics5. Object Oriented Principles – the essentials6. S.O.L.I.D. Principles7. Industry needs and expectations AND TIPS!
The Lean Agenda• A branch of Lean Consulting PH
• We aim to narrow the gap between school knowledge and industry expectations
• Prepare and educate people on the 21st century skills
About Me• Graduate of Ateneo de Davao, Computer Science 2012
• Over 5 years of software engineering experience, .NET and AngularJS
• Co-founder/CTO of T.H.E. Patrons (ex-CTO)
• Co-founder of Lean Consulting, Lean Agenda
• Microsoft Technology Associate
• I LIKE TO LEARN!
What to expect• Programming Language: C#• Only fundamentals will be discussed• Not your typical what-is-a and this-is-a discussion• Feel free to ask• Feel free to correct the speaker• Feel free to add• Learn something new!
What I except from you• Your attention• Questions!• You have at least little knowledge on programming
Because we won’t just be discussing definitions We will have a why-when type of discussion
Core Programming – the basics• What is a variable?
Holds a value temporarily in a computer memory
• What is a constant? Same as variable BUT cannot be changed on runtime or during program
execution
• What is a data type? Classification of the type of a data – Integer, Boolean
Core Programming – Data types
Why is it important to know the data type?
In simple terms…Variable – is the containerData type – is the type of container
Do you want to put cookies in a tumbler?
No!
Well, technically...• Using the correct data type will save space – in memory, only use
what you need You don’t need to use int for “Age”. Nobody gets 2,147,483,647 years old
• Because you won’t be able to multiply a string… 2 * “2”
• It is an implementation detail
Double vs Float vs Decimal• Precision is the main difference
• Float: 7 digits• Double: 15-16 digits
Both are floating binary point types Faster than decimal
• Decimal: 28-29 digits Floating decimal point types Mainly used in financial solutions Slower than the other 2
Core Programming – Data structures• Arrays• Dictionaries
Arrays• A collection of variables• C# arrays are zero indexed
Dictionaries• A collection of objects that are accessed by using a key• Use dictionary if your indexes have a special meaning besides just
positional placement
Core Programming - Decision Making• If, if-else, if-else-if VS Switch
• Switch is faster (a little) However, this is just a micro-optimization
• Switch is more readable• Use switch if you have many items, if-else if fewer
Core Programming - Repetition• For• While• Do while
When to use for loop?• you can run a statement or a block of statements repeatedly until a
specified expression evaluates to false
• Useful for arrays
• When the number of times is known before hand
• Example: Displaying all data in a list
When to use while?• executes a statement or a block of statements until a specified
expression evaluates to false.
• When the number of times is NOT known before hand
• Example: when your program is waiting for a form to be completed, it will not save the form
When to use do-while• Almost the same with while BUT is executed one time before the
conditional expression is evaluated
• When the number of times is NOT known before hand AND you want to make sure it will be executed at least once
• Example: Display a question, and if the answer is correct move on to the next question.
Core Programming – Exception Handling• What is an exception?
An exception is a problem that arises during the execution of a program.
• Try identifies a block of code for which particular exceptions is activated
• Catch the place in a program where you want to handle the problem
• Finally is used to execute a given set of statements, whether an exception is thrown or
not thrown
• Throw is used to signal the occurrence of an anomalous situation (exception) during the
program execution
Core Programming – Exception Handling• A try-catch structure doesn’t prevent the exception from being
thrown, it simply gives the developer a chance to keep the program from crashing.
• When to use? When you are trying to do something that may not work
• When not to use? To hide problems happening in your code
• Demo
Object Oriented - Principles• What is OOP?
Is a programming paradigm based on objects
• Is it useful? Why? Code reusability Provides clear modular structure for programs Software components can be easily adapted and modified
• What are its disadvantages? Over complication Complexity in understanding “established” code – especially for beginners Prone to code spaghetti
Classes• Can be reused
• It’s like a blueprint
• Includes attributes and behaviour
Abstraction• Exposing essential feature
• Hides irrelevant detail
• Process of identifying common patterns that have systematic variations
Encapsulation• Hide implementation details• Creates a black box• Behaviour can be exposed through interfaces• Data members cannot be directly changed• Encapsulation is implemented by using access specifiers
Private Public Protected Internal Protected Internal
Inheritance• Data & behaviour taken from another class
• Concept of super and sub class
• Provides base functionality for similar objects
• Allows for code re-use
• Use the “is-a” test if it’s appropriate to use
Polymorphism• Poly = multiple
• Morph = to change
• Polymorphism = multiple forms or changes
• Behaviour change
• Virtual methods and overriding
Abstract Class VS Interfaces• Abstract class
Cannot be instantiated Must be inherited from May be fully implemented, partially implemented or not implemented at all
• Why do we need abstract classes? To provide some sort of default functionality Affects all derived classes if there are changes on the base class
Abstract Class VS Interfaces• Interface
Totally abstract set of members No implementation, contains only signatures Represents a contract In real world, a medium to interact with something
• Why do we need Interfaces? Multiple inheritance support Used in service contracts Loose coupling Modularity
S.O.L.I.D. Principles• What is S.O.L.I.D. ?
• Basic principles which help you create good software architecture• Acronym for
Single Responsibility Principle Open Closed Principle Liskov Substitution Principle Interface Segregation Principle Dependency Inversion Principle
Single Responsibility Principle• A class should have one responsibility only
• Separation of concern
• A class is not a swiss knife
• Demo
Open Closed Principle• Should be open for extension but closed for modification
• Demo
Liskov Substitution Principle• objects in a program should be replaceable with instances of their
subtypes without altering the correctness of that program
• Demo
Interface Segregation Principle• many client-specific interfaces are better than one general-purpose
interface
• Demo
Dependency Inversion Principle• Depend on abstractions, not on concretions
• Demo
What to expect in the real world• “If you think teachers are tough, wait till you get a boss” – Bill Gates
• Do not expect any training
• Be ready to read, read and read
• If you get bored easily on tedious work, programming is for you!
What to learn & how to improve• If you’re a beginner, master one programming language• After, strategically choose another language• Master SQL. Everything is all about data.• Learn Version Control, it’ll save a lot of time and plus points on
applying for work!• Constantly challenge yourself• Join GitHub, StackOverflow• Don’t be lazy, always follow best practices until it becomes a habit• Constantly learn new things• Always ask why
Any questions?
•“ Any fool can write code that a computer can understand. Good programmers write code that humans can understand. ” - Martin Fowler
References• http://stackoverflow.com/questions/618535/difference-between-decimal-float-and-double-in-net• https://msdn.microsoft.com/en-us/library/cs7y5x0x%28v=vs.90%29.aspx• http://csharpindepth.com/Articles/General/FloatingPoint.aspx• https://msdn.microsoft.com/en-us/library/aa288453(v=vs.71).aspx• http://programmers.stackexchange.com/questions/139052/dictionary-vs-list• https://msdn.microsoft.com/en-us/library/ch45axte.aspx• http://wiki.tcl.tk/13398• https://standardofnorms.wordpress.com/2012/09/02/4-pillars-of-object-oriented-programming/• http://www.c-sharpcorner.com/UploadFile/d0e913/abstract-class-interface-two-villains-of-every-
interview/• http://www.c-sharpcorner.com/UploadFile/d0e913/abstract-class-interface-two-villains-of-every-intervi
ew756/
• http://www.c-sharpcorner.com/UploadFile/yusufkaratoprak/difference-between-loose-coupling-and-tight-coupling/
• http://www.codeproject.com/Articles/703634/SOLID-architecture-principles-using-simple-Csharp