Kate Lo
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # Week 2 ## SE: Intro * SE: application of a **systematic, disciplined, quantifiable approach** to the **development, operation, and maintenance** of software. * Compare Software Engineering with Civil Engineering in terms of how work products in CE (i.e. buildings) differ from those of SE (i.e. software). | Buildings | Software | |:---------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- | | Visible, tangible | Invisible, intangible | | Wears out over time | Does not wear out | | Change is limited by physical restrictions (e.g. difficult to remove a floor from a high rise building) | Change is not limited by such restrictions. Just change the code and recompile. | | Creating an exact copy of a building is impossible. Creating a near copy is almost as costly as creating the original. | Any number of exact copies can be made with near zero cost. | | Difficult to move. | Easily delivered from one place to another. | | Many low-skilled workers following tried-and-tested procedures. | No low-skilled workers involved. Workers have more freedom to follow their own procedures. | | Easier to assure quality (just follow accepted procedure). | Not easy to assure quality. | | Majority of the work force has to be on location. | Can be built by people who are not even in the same country. | | Raw materials are costly, costly equipment required. | Almost free raw materials and relatively cheap equipment. | | Once construction is started, it is hard to do drastic changes to the design. | Building process is very flexible. Drastic design changes can be done, although costly | | A lot of manual and menial labor involved. | Most work involves highly-skilled labor. | | Generally robust. E.g. removing a single brick is unlikely to destroy a building. | More fragile than buildings. A single misplaced semicolon can render the whole system useless. | * Comment on this statement: Building software is cheaper and easier than building bridges (all we need is a PC!). ``` Depends on the size of the software. Manpower required for software is very costly. On the other hand, we can create a very valuable software (e.g. an iPhone application that can make million dollars in a month) with a just a PC and a few days of work! ``` * Justify this statement: Coding is still a ‘design’ activity, not a ‘manufacturing’ activity. You may use a comparison (or an analogy) of Software engineering versus Civil Engineering to argue this point. ``` Arguments to support this statement: 1. If coding is a manufacturing activity, we should be able to do it using robotic machines (just like in the car industry) or low-skilled laborers (like in the construction industry). 2. If coding is a manufacturing activity, we wouldn’t be changing it so much after we code software. But if the code is in fact a ‘design’, yes, we would fiddle with it until we get it right. 3. Manufacturing is the process of building a finished product based on the design. Code is the design. Manufacturing is what is done by the compiler (fully automated). However, the type of ‘design’ that occurs during coding is at a much lower level than the ‘design’ that occurs before coding. ``` * List some (at least three each) pros and cons of Software Engineering compared to other traditional Engineering careers. ``` pros: 1. pay well 2. work environment is clean and well lighted 3. easy to find a job cons: 1. stressful 2. must stay on the cutting edge of technology in order to keep skills relevant and up to date 3. no break on weekends :( ``` * Which one of these is not included in Brook’s list of ‘Woes of the Craft’? **c** ``` a. Need for perfection when developing software b. Requiring some amount of tedious, painstaking labor c. Ease of copying and transporting software makes it difficult to keep track of versions d. High dependence on others e. Seemingly never ending effort required for testing and debugging software f. Fast moving industry making our work obsolete quickly ``` ## Java: Intro * Java is directly related to both C and C++. Java inherits its **syntax from C**. Its **object model is adapted from C++**. * Java is both ==**compiled**== (generates **machine code** from source code before executing the program) and ==**interpreted**== (the interpreter executes the program directly, one statement at a time). * Instead of translating programs directly into machine language, the **Java compiler generates byte code**. Byte code is **portable**, so it is possible to compile a Java program on one machine, transfer the byte code to another machine, and run the byte code on the other machine. That’s why Java is considered a **platform independent technology**, aka **WORA** (Write Once Run Anywhere). The interpreter that runs byte code is called a “Java Virtual Machine” (**JVM**). * Java technology is **both a programming language and a platform.** * 4 platforms of the Java programming language: > Java Platform, Standard Edition (**Java SE**): Contains the core functionality of the Java programming language. Java Platform, Enterprise Edition (**Java EE**): For developing and running large-scale enterprise applications. Built on top of Java SE. Java Platform, Micro Edition (**Java ME**): For Java programming language applications meant for small devices, like mobile phones. A subset of Java SE. **JavaFX**: For creating applications with graphical user interfaces. Can work with the other three above. * HelloWorld in Java: ```java= public class HelloWorld { public static void main(String[] args) { // generate some simple output System.out.println("Hello, World!"); } } ``` ==public== is an access modifier that indicates the method is **accessible from outside this class**. Similarly, ==private== access modifier indicates that a method/attribute is **not accessible outside the class**. ==static== indicates this method is defined as a **class-level** member. ==void== indicates that the method does not return anything. * Java use the term *method* instead of *function*. In particular, Java doesn’t have stand-alone functions. Every method should belong to a class. The main method will not work unless it is inside the HelloWorld class. * In most cases (i.e., there are exceptions), the name of the class has to match the name of the file it is in, so this class has to be in a file named HelloWorld.java. * The library files needed by the HelloWorld code is available by default *without having to "include"* them explicitly. * There is no need to return 0 at the end of the main method to indicate the execution was successful. It is considered as a successful execution unless an error is signalled specifically. ## Java: Data Types * `byte` (8 bits): an integer in the range -128 to 127 (inclusive). * `short` (16 bits): an integer in the range -32,768 to 32,767 (inclusive). * `int` (32 bits): an integer in the range -2^31 to 2^31-1. * `long` (64 bits): An integer in the range -2^63 to 2^63-1. * `float` (32 bits): a single-precision 32-bit IEEE 754 floating point. This data type should never be used for precise values, such as currency. For that, you will need to use the java.math.BigDecimal class instead. * `double` (64 bits): a double-precision 64-bit IEEE 754 floating point. For decimal values, this data type is generally the default choice. This data type should never be used for precise values, such as currency. * `boolean`: has only two possible values: true and false. * `char` (16 bits): The char data type is a single 16-bit Unicode character. It has a minimum value of '\u0000' (or 0) and a maximum value of '\uffff' (or 65,535 inclusive). * Use the keyword `final` to indicate that the variable value, once assigned, should not be allowed to change later i.e., act like a ‘**constant**’. By convention, names for constants are all uppercase, with the underscore character ( _) between words. ```=java final double CM_PER_INCH = 2.54; ``` ## Java: Control Flow * Enhanced for loops: ```java= for (int i = 0; i < values.length; i++) { int value = values[i]; System.out.println(value); } ``` We could rewrite the loop like this: ```java= for (int value : values) { System.out.println(value); } ``` ## RCS: Init, Commit * **Revision control**: the process of managing multiple versions of a piece of information. * Revision control software will **track the history and evolution** of your project, which makes it easier for you to **collaborate** when you're working with other people. * It can help you to **recover** from mistakes. * It will help you to **work simultaneously** on, and manage the drift between, multiple versions of your project. :::warning **RCS: Revision Control Software** are the software tools that **automate the process of Revision Control** i.e. managing revisions of software artifacts. ::: :::warning **Revision**: A revision (some seem to use it interchangeably with version while others seem to distinguish the two -- here, let us treat them as the same, for simplicity) is **a state of a piece of information at a specific time that is a result of some changes to it** e.g., if you modify the code and save the file, you have a new revision (or a version) of that file. ::: :::warning **Repository** (repo for short): The **database of the history of a directory** being tracked by an RCS software (e.g. Git). ::: * The repository is the **database where the meta-data about the revision history are stored**. * Suppose you want to apply revision control on files in a directory called `ProjectFoo`. In that case you need to set up a repo (short for repository) in `ProjectFoo` directory, which is referred to as the working directory of the repo. For example, Git uses a hidden folder named `.git` inside the working directory. * **You can have multiple repos in your computer**, each repo revision-controlling files of a different working directly, for examples, files of different projects. * **In a repo, we can specify which files to track and which files to ==ignore==.** Some files such as temporary log files created during the build/test process should not be revision-controlled. * **==Committing== saves a snapshot of the current state of the tracked files in the revision control history.** Such a snapshot is also called a commit (i.e. the noun). * **When ready to commit, we first ==stage== the specific changes we want to commit.** This intermediate step allows us to commit only some changes while saving other changes for a later commit. * Each commit in a repo is a recorded point in the history of the project that is **uniquely** identified by an **auto-generated ==hash==** e.g. a16043703f28e5b3dab95915f5c5e5bf4fdc5fc1. * We can **==tag==** a specific commit with a **more easily identifiable name** e.g. v1.0.2 :::warning **Working directory**: The directory the repo is based in is called the working directory. ::: :::warning **Commit**: Saving the current state of the working folder into the Git revision history. ::: :::warning **Stage**: Instructing Git to prepare a file for committing. ::: ## RCS: Fork, Clone * **Remote repositories** are **copies of a repo** that are hosted on remote computers. * **You can ==clone== a remote repo onto your computer** which will create a copy of a remote repo on your computer, including the version history as the remote repo. * **You can ==push== new commits in your clone to the remote repo** which will copy the new commits onto the remote repo. Note that pushing to a remote repo requires you to have write-access to it. * **You can ==pull== from the remote repos to receive new commits in the remote repo**. Pulling is used to sync your local repo with latest changes to the remote repo. * **A ==fork== is a remote copy of a remote repo.** If there is a remote repo that you want to push to but you do not have write access to it, you can fork the remote repo, which gives you your own remote repo that you can push to. * **A ==pull request== is mechanism for contributing code to a remote repo**. It is a formal request sent to the maintainers of the repo asking them to pull your new code to their repo. ![](https://i.imgur.com/J1Yayu8.png) ## IDEs: Basic Features * Professional software engineers often write code using **Integrated Development Environments (IDEs)**. IDEs **support most development-related work within the same tool** (hence, the term integrated). * An IDE generally consists of: * A **source code editor** that includes features such as syntax coloring, auto-completion, easy code navigation, error highlighting, and code-snippet generation. * A **compiler and/or an interpreter** (together with other build automation support) that facilitates the compilation/linking/running/deployment of a program. * A **debugger** that allows the developer to execute the program one step at a time to observe the run-time behavior in order to locate bugs. * Other tools that aid various aspects of coding e.g. support for automated testing, drag-and-drop construction of UI components, version management support, simulation of the target runtime platform, and modeling support. * Which of these are features available in IDEs? **all** ``` a. Compiling b. Syntax error highlighting c. Debugging d. Code navigation e.g., to navigate from a method call to the method implementation e. Simulation e.g., run a mobile app in a simulator f. Code analysis e.g. to find unreachable code g. Reverse engineering design/documentation e.g. generate diagrams from code h. Visual programming e.g. Write programs using ‘drag and drop’ actions instead of typing code i. Syntax assistance e.g., show hints as you type j. Code generation e.g., to generate the code required by simply specifying which component/structure you want to implement k. Extension i.e., ability add more functionality to the IDE using plugins ``` ## Code Quality: Coding Standards * One essential way to improve code quality is to **follow a consistent style**. That is why software engineers follow a strict **coding standard** (aka style guide). * The aim of a coding standard is to **make the entire code base look like it was written by one person**.

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully