2. Topics
1. About Lean Agenda
2. About the Speaker
3. Expectations
4. Core Programming – the basics
5. Object Oriented Principles – the essentials
6. S.O.L.I.D. Principles
7. Industry needs and expectations AND TIPS!
3. 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
4. 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!
5. 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!
6. 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
7. 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
10. In simple terms…
Variable – is the container
Data type – is the type of container
Do you want to put cookies in a tumbler?
No!
11. 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
12. 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
15. 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
16. 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
18. 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
19. 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
20. 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.
21. 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
22. 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
23. 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
24. Classes
• Can be reused
• It’s like a blueprint
• Includes attributes and behaviour
25. Abstraction
• Exposing essential feature
• Hides irrelevant detail
• Process of identifying common patterns that have systematic variations
26. 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
27. 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
28. Polymorphism
• Poly = multiple
• Morph = to change
• Polymorphism = multiple forms or changes
• Behaviour change
• Virtual methods and overriding
29. 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
30. 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
31. 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
32. Single Responsibility Principle
• A class should have one responsibility only
• Separation of concern
• A class is not a swiss knife
• Demo
34. Liskov Substitution Principle
• objects in a program should be replaceable with instances of their subtypes
without altering the correctness of that program
• Demo
37. 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!
38. 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