|
Thread Rules 1. This is not a "do my homework for me" thread. If you have specific questions, ask, but don't post an assignment or homework problem and expect an exact solution. 2. No recruiting for your cockamamie projects (you won't replace facebook with 3 dudes you found on the internet and $20) 3. If you can't articulate why a language is bad, don't start slinging shit about it. Just remember that nothing is worse than making CSS IE6 compatible. 4. Use [code] tags to format code blocks. |
On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program)
I think you are confused.
OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects.
I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability.
What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software.
|
On July 22 2013 06:02 CptCutter wrote:“Implementation inheritance causes the same intertwining and brittleness that have been observed when goto statements are overused. As a result, OO systems often suffer from complexity and lack of reuse.” — John Ousterhout Scripting, IEEE Computer, March 1998 made me chuckle ^_^
On July 22 2013 23:40 Frigo wrote: However powerful OOP is, it is still just a tool. There are scenarios for which it is less suitable than other tools, and forcing it to solve ill-fitted problems will only end in tears. Don't let it be your Golden Hammer.
I'm not saying that you should force your Golden Saw on everything either, just because it is better for a particular problem than your Golden Hammer. Don't be stupid and revert to procedural programming just because OOP isn't perfect.
Use the correct tool for the correct job. To do that, you need to have a diverse toolbox, and knowledge of how, when, how not and when not to use one of its particular items.
And the most important rule: your best tool is your brain, you should learn how to use it.
----
“Sometimes, the elegant implementation is just a function. Not a method. Not a class. Not a framework. Just a function.” — John Carmack
Yes Mr. Carmack, except if it needs several input parameters that it passes to other functions, has repeatedly recalculated subproblems, has multiple results or we want to unit test its dependencies without actually calculating it. If any of these hold, you are better off with a Method Object. So that "sometimes" is pushing it a little bit.
These are problems associated with the Stroustrup strain of OOP, which some would say is not OOP at all.
C++/Java are atrocious OO languages, they should not be used as examples for why OO is bad. Implementation inheritance is amazing if it is done right, problem is with C++/Java, doing it right is almost if not impossible. So you end up with retarded design patterns like, "interface inheritance over implementation inheritance" which while it solves the problem of inflexiblity, in the general scheme of things it completely defeats the purpose of OOP (code re-use). So you end up wondering why you are even using Java in the first place.
Have a look at Ruby's mixins or Scala traits for an example of great uses of implementation inheritance.
|
On July 23 2013 14:21 sluggaslamoo wrote:Show nested quote +On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment.
|
Australia7069 Posts
On July 23 2013 14:45 Release wrote:Show nested quote +On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer?
Since when? As someone who works as a developer i've never had a choice of languages in any professional project
|
On July 23 2013 15:42 Kiante wrote:Show nested quote +On July 23 2013 14:45 Release wrote:On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer? Since when? As someone who works as a developer i've never had a choice of languages in any professional project
Give him a break xD
|
I just started out to learn programming, what any things that i should look out for, and what are good methods to get some experiances?
|
On July 23 2013 19:59 sabas123 wrote: I just started out to learn programming, what any things that i should look out for, and what are good methods to get some experiances?
That is a ridiculously broad question, what was your reason to learn to program? What language are you using? Are you going for web, if so back-end or front end? Win32 applications? Embedded hardware?
Be more specific and maybe we can help you.
|
On July 23 2013 19:59 sabas123 wrote: I just started out to learn programming, what any things that i should look out for, and what are good methods to get some experiances? Read through the original post in the topic, because it was specifically designed to focus a broad question like yours into narrow questions that have specific focused answers. Listen to the frustrated java-to-C student (quoted post) and the response that follows. Check out the websites linked. [[Continue to]] get your feet wet.
|
Ok, I have the requirement check working. Now I just want an alert to come up on submission, without going to my php form action page. I'm sort of a noob when it comes to javascript. I can get it to either:
A) Stay on the same page, but not get my alert to show
or
B) It just goes to my form action php page.
Again, I know I can use php header, but I want to do this with javascript. Relevant html/javascript:
+ Show Spoiler + <form id="myform" action="php/suggestionFunc.php" method="post" title="suggestion" > <fieldset> <legend>Service Area</legend> <div class="option"> <select name="serviceArea" required> <option value="" selected />Select...</option> <option value="Website" />Website</option> <option value="Reference" />Reference</option> <option value="Circulation" />Circulation</option> <option value="Collection" />Collection</option> <option value="Instruction" />Instruction</option> </select>
<script> $(document).ready(function(){ $form = $('#myform'); $form.submit(function(){ $.post($(this).attr('action'), $(this).serialize(), function(response){ alert('Thank you for your submission'); },'json'); return false; }); }); </script>
|
You can't actually do this with an HTTP header, so you can stop making that clarification each time 
Your source looks fine for achieving what you want, except that you haven't closed a bunch of your tags that you probably should. What exact behavior is that source exhibiting? Have you looked at it in the Chrome dev tools/firebug to see if its making the requests/getting the response you're expecting? Perhaps your server is returning the wrong content type and its therefore not getting parsed.
Also, in the future, please post code inside of code tags
|
I'm not posting the complete html, just the relevant stuff for the javascript, that is why it looks like there are un-closed tags. Regarding http header, I know it can't achieve the exact same result (staying on the same page), but it can achieve something pretty similar (having the php function send you back to the page). I mentioned it just so people wouldn't say "just use php header on your php function." But that's a digression.
The form is working fine. The php function is working fine. I'm just having trouble getting this last bit of javascript working. It isn't a server issue, as there are forms on this same server that do the same thing (I didn't make them). I'll take a look at what the dev tools say, but I'm really looking for someone with direct experience in doing this.
Edit: I just added this <form id="myform" action="php/suggestionFunc.php" method="post" title="suggestion" onSubmit="alert ('Thank you for you submission.')">
to my form, which is getting the desired results (submission alert and staying on same page). I'm still a little puzzled why my previous method wasn't working, but I guess whatever works, for now.
|
Your problem ist the "json" parameter. If you specify "json" your php has to return a valid json in return. If it's not returning valid json, your response function won't get executed. To solve it, either change the php to always return an json, or change or leave out the "json" parameter iteslf.
|
On July 23 2013 15:42 Kiante wrote:Show nested quote +On July 23 2013 14:45 Release wrote:On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer? Since when? As someone who works as a developer i've never had a choice of languages in any professional project I was saying that if you use a OO language, you don't have to use objects at all. You can write and copy paste everything if you want.
|
Australia7069 Posts
On July 24 2013 13:54 Release wrote:Show nested quote +On July 23 2013 15:42 Kiante wrote:On July 23 2013 14:45 Release wrote:On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer? Since when? As someone who works as a developer i've never had a choice of languages in any professional project I was saying that if you use a OO language, you don't have to use objects at all. You can write and copy paste everything if you want. I understand that you're young and new to programming, but I think it would be a good idea to step back and learn about things before you start trying to talk about them. if you and go reread the post you just made with some knowledge behind you you'd understand that it actually makes no sense.
I think that when you post in this thread you should make it more clear that your knowledge base isn't very large so others don't get mislead by your comments.
|
On July 24 2013 13:54 Release wrote:Show nested quote +On July 23 2013 15:42 Kiante wrote:On July 23 2013 14:45 Release wrote:On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer? Since when? As someone who works as a developer i've never had a choice of languages in any professional project I was saying that if you use a OO language, you don't have to use objects at all. You can write and copy paste everything if you want.
With a lot of OO languages everything is an object, sometimes even "null" and basic primitive data types are an object, so how does that work?
Pretty much the only language I can think of where you can decide not to use objects is C++, but even then, why wouldn't you?
Can you give me an example of where you aren't using objects in an OO language?
|
I'm sure he actually meant this:
...if you use an OO language, you don't have to use objects OOP at all.
For example, you could program procedurally in Java by declaring all of your methods and class members as "static". This makes them accessible by classpath namespacing without the need to instantiate objects of the type defined by the class you writing code in. You are still using objects in your granular bits of code, but you aren't using domain objects to organize the overall structure of your program.
|
On July 23 2013 15:42 Kiante wrote:Show nested quote +On July 23 2013 14:45 Release wrote:On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer? Since when? As someone who works as a developer i've never had a choice of languages in any professional project
In what way haven't you had a choice? Like the boss said "Use C, you cunts!" or "Shit, I want to use Python, but since this project have to be super fast, I will have to use C"?
|
On July 24 2013 17:11 Arnstein wrote:Show nested quote +On July 23 2013 15:42 Kiante wrote:On July 23 2013 14:45 Release wrote:On July 23 2013 14:21 sluggaslamoo wrote:On July 23 2013 07:33 Release wrote: The cool thing about OOP is that you don't have to use it. Completely up to the programmer.
The best thing about OOP imo is readability. 1 line per anything in the main (although sometimes it is better to expand. In theory, you could have 1 line for the entire program) I think you are confused. OOP is a paradigm, so if you don't always use Objects in an Object Oriented program, then you aren't doing OOP. Its just structured programming with objects. I disagree that OOP improves readability, I'd actually argue that functional programming or structured programming styles are better for readability. What OOP does is create a bridge between business models and code that makes it really easy for both the programmer and analyst to design software. Ah. Yes. I thought we were talking about OO languages. Disregard my comment. So you were trying to say that language choice was completely up to the programmer? Since when? As someone who works as a developer i've never had a choice of languages in any professional project In what way haven't you had a choice? Like the boss said "Use C, you cunts!" or "Shit, I want to use Python, but since this project have to be super fast, I will have to use C"? Most of the time I imagine you'd either join an existing project using a programming language already, or else the boss would say "we're doing X project with Y programming language, gogo".
|
Programmers aren't Product Managers. Product Managers talk with higher-ups and Architects who may or may not communicate with Senior Developers before reaching decisions in what designs/implementation details are used in the product - way before you actually have a project to work on. Assuming you're not in very new start-ups, because for most programmers you'll be joining several years in and hopping right into their chosen language. Programmers rarely make real important implementation decisions unless there's a huge issue and/or oversight found.
|
On July 24 2013 17:03 HeadBangaa wrote:I'm sure he actually meant this: For example, you could program procedurally in Java by declaring all of your methods and class members as "static". This makes them accessible by classpath namespacing without the need to instantiate objects of the type defined by the class you writing code in. You are still using objects in your granular bits of code, but you aren't using domain objects to organize the overall structure of your program.
But why?
Like why would you even consider that?
ugghhhh my brain!!!! brb think im having an aneurysm
|
|
|
|
|
|