How the term 'software engineering' came to be
  • Margaret Hamilton:"I began to use the term 'software engineering' to distinguish it from hardware and other kinds of engineering," Hamilton told Verne's Jaime Rubio Hancock in an interview.
  • "When I first started using this phrase, it was considered to be quite amusing. It was an ongoing joke for a long time. They liked to kid me about my radical ideas. Software eventually and necessarily gained the same respect as any other discipline."
Enums: A Boolean Type on Steroids

Hello Tumblr,

Today I am writing about enums, this a feature that a lot of programming langauges support, including Java.

What is a Enum?

Plain and simple, a Enum is a type. While it may sound something simple and useles, it’s not. Enums are useful in a lot of situations. 

 When to Use Enums?

Did you ever come to a situation when you had to use constants to define the behvior of something. Tihs something could be an object, a method, or maybe a specific constructor. More than likely, in this situation, you felt that maybe a final static Integer or String will be perfect for this, but the fact is that when it comes to this specific situation, using final primitive types could be the worse thing you could do.  I, personally, consider it the worse thng you coud do because of the following example:

class Drawing
{
static final int Circle = 0;
static final int Square = 1;
static final int Triangle = 2;
public Drawing(int whatToDraw)
{
if(whatToDraw == Circle )
{
System.out.println(“drawing circle”);
}
else if(whatToDraw == Square)
{
System.out.println(“drawing Square”);
}
else if(whatToDraw == Triangle)
{
System.out.println(“drawing Triangle”);
}
}

public static void main(String[] args)
{
System.out.println(“I am going to draw things…”);
new Drawing(Drawing.Circle);
new Drawing(0);
}
}

Output:

I am going to draw things…
drawing circle
drawing circle


So the class above is a class that draws things, and as you can see the constructor is suppose to draw different things. And an integer is used to decide what the constructor will draw. Now, while this approach is practical, it is not a good choice. As you can see in  the main method, I create two constructors and it may seem like like ‘am passing different arguments to the constructor but I am passing the same argument. 

Why is this a bad idea?

First of all, the fact that I can pass a 0 instead of the static reference “circle” goes against the idea of self-documented code and ,as I’ve mentioned before, having  self-document code is just as important as any method in your code. Secondly, I don’t know if you have realized that one can pass any number to this constructor as longest as it is an integer, and this is TERRIBLE because if I pass 100 to the constructor, first of all it wouldn’t make any sense to pass a number to a Drawing constructor and in this case that 100 would not make anything happen, it will just be passed and nothing will happen. And even if we made these int fields Strings, Double, Long,  Object, and etc, one will still have the same issue of having the possibility of having a type passed with non-sense data.

This is Why Enums were created!

This is when enums are extremely useful! So below you will see an Enum being created:

enum Drawing_Type
{
Circle, Triangle, Square;
}

As you can see the syntax for creating an Enum is very the similar to the syntax of creating a class. The names you see listed in the body of this enum are the Drawing_Type types, hopefully that makes sense to you. Now, the beauty behind these(Circle, Triangle, Square) is the fact that they behave just like integers but they are not! The example below will help you understand this concept better :


class DrawingEnum
{
public DrawingEnum(Drawing_Type whatToDraw)
{
if(whatToDraw == Drawing_Type.Circle )
{
System.out.println(“drawing circle”);
}
else if(whatToDraw == Drawing_Type.Square)
{
System.out.println(“drawing Square”);
}
else if(whatToDraw == Drawing_Type.Triangle)
{
System.out.println(“drawing Triangle”);
}
}

public static void main(String[] args)
{
System.out.println(“I am going to draw things…”);
new DrawingEnum(Drawing_Type.Circle);
}


}

Output:

I am going to draw things…
drawing circle

As you can see this class is almost the same as the previous class, the only difference is the use of enums, which as you can see have the same properties of ints and one of them is the ability to compare the enum types with the “==” operator, which is extremely useful! Now does this solve our previous problems? Yes it does, the fact is that if one tries to pass an int or any other primitive/object type to the constructor  java will return a compiling error! 

The fact that java can check this when compiling the code is wonderful! It goes without saying that you can also see that code with enums is easier to self-document. 

There Is Even more to Enums

Now the java api has an actual class called Enum it has some useful methods that are implicitly inherited by any Enum type. To conclude with enums, enums can also be used in switch structs and this is good news because it turns out that switches are faster than else-if structs!


To Finish For Good

Don’t use primitive final constants to define behavior.

Do use enums to define behavior.

So hopefully now you understand what an Enum is and knwo how useful it can be!

while(coding)
{
No tumblr blogging;
}
Post something to tumblr ;)

psa for CS majors!!

If youre a computer science student and youre taking (or will be taking) data structures, PLEASE check out this website. Visualgo has some of the best visual demonstrations for basically ALL the important data structures and algorithms you learn in a data structures course. This site saved my ass for my final because I couldnt work with avl trees for shit lol 

please just give it a look i promise you wont be disappointed!

Websites to utilize

These are some of my favourite websites because they are so helpful for many different reasons.


khanacademy.org - I have been using this website for about 5 years and it is magical. They have everything from science and math to art and humanities. They show you videos that aren’t ridiculously long and boring. Super helpful for everything.

codecademy.com - Great site if you want to learn how to code in depth or just get a small grasp on it. You learn by doing which is super helpful. They offer several different languages and it walks you though it while you are writing the code. They have different levels and and small projects like creating a solar system. Great for learning how to code especially for computer science and web design.


wolframalpha.com - I only use this website for last minute math assignments. You can enter your math problem and say what you need from it, like the maximum and it will give you the answer. This is great for those last minute assignments or for if you completely forget when its due and only have an hour, which is what happens to me.

3

#THEME 02 - Donut Hole 

preview / code ( base code by vitanica )

throws this at u 

i actually started working on this long before theme #1 but i found it again and made it functional. any problems/glitches message me etc

reblog/like if you plan to use !! <3

FEATURES:

-13 color options

-300px/400px posts

-5 links

-faded images

-translucent posts

-corner image

-optional border + shadow

captainassemble asked:

That's so cool! I'm planning to major in computer science too. Do you think I should learn basic coding from now? I'm starting my senior year next week. I promised myself to learn coding over the holiday but there's tumblr sooo...

That’s amazing!!! And yes yes do it!! I promise it’s gonna be worth it. I wish I would have decided myself earlier on what major I wanted. Because I struggled my first year because I really didn’t understand so well and it was difficult for me to learn coding and there was even a point I hated my programming class (shout out to Karlie Kloss for inspiring me to keep studying Computer Science)  So I do wish I would have learned coding in my high school years since I had more free time then than I do now ( I’m in college and I work saturdays and sundays with kids so I don’t get much free time). So yeah please do push yourself to learn it. It will be great start for you and you’ll love it and you will be able to go through your programming class and it’d be an easy A+ for you. So here’s my recommendations to make it fun and easy. 

  • Play code combat - you can choose to play with which programming language you want to play and it helps you learn basics of functions and codes you can find the game here (x)
  • Go visit code.org - It is a great website that has fun games and activities that teach you about coding :) (x)

Now for application to start coding with are:

  • DFD - it is the easiest tool for programming. It is rather more graphic than writing a code but you can learn about objects and cycles and tools that will help you with coding. You can look up beginner tutorials and exercises on youtube and google.  Download is here (x
  • PSEINT- Okay this one is a lovely combination of an easy version of Eclipse (Java) and DFD. It gives you all the tools to move into the real coding (Eclipse). You can download here (x)  You can look up beginner tutorials and exercises on youtube and google.
  • Eclipse Luna (Java)- It is basically the jump to the coding for real lol. But if you are able to understand PSEINT then you won’t struggle with it. :) you can download here (x)  You can look up beginner tutorials and exercises on youtube and google.

Now here’s these two amazing tools for making apps!! You can find tutorials for them on Youtube and Google

  • App Inventor - It is an easy tool by MIT university for making android apps! You can work on it through this website (x
  • App Studio- Microsoft’s tool that allows you to make your own app and even be able to put it on the Microsoft app store. Also it is a great tool and you can be guided to convert it for google play/apple store if that’s what you like. here’s the link to that website (x)

I apologize for taking so long to reply to this but I wanted to give you all these info and resources its a little lengthy but I hope you go through it all. I promise they will help you and you’ll be grateful if you start learning coding now. You’ll have a such much easier time in college :) Also I hope you don’t mind me posting this publicly  cause I wanna post it just in case some of my followers are interested in learning how to code! :)