Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Lambdas
#1
What do you guys think of them? Personally they're pretty useless in my opinion.
Reply
#2
exactly the same makes code more confusing
Reply
#3
hows that more readable
if ur not in an ide, say on github you have to find the method the lambda is standing in for... and thats way harder to read
Reply
#4
(10-25-2014, 11:31 AM)Bibl Wrote:  hows that more readable
if ur not in an ide, say on github you have to find the method the lambda is standing in for... and thats way harder to read

Agreed.
Reply
#5
(10-25-2014, 09:23 AM)Sunos Wrote:  It's pretty useful for functional interfaces and small forloops to make code more compact and readable.

However, this is the only time that i'd use them. Other ways are indeed very useless.

Example:


Code:
new Thread(r -> Thread.sleep(500)).start();

Instead of:


Code:
new Thread(new Runnable(){
    public synchronized void run(){
         Thread.sleep(500);
    }
}).start();

AND:


Code:
Vaginas.pussyList.forEach(v -> v.queueNewPeriod());

Instead of:


Code:
for(Vagina v : Vaginas.pussyList){
     v.queueNewPeriod();
}

Although it does seem the exact same...

Yeah. Lambdas ARE completely useless, except for functional interfaces.

also u can override run()v in thread instead of making a new anonymous runnable
Reply
#6
Alright, I'm going to go ahead and reply to a post of decent age, so apologies in advance.

Java as a programming language has been losing a decent amount of traction against newer languages with features pulled from newer-ish areas of CS language theory and other languages that are just quicker to write code in. I suspect that Java architects forsee this as having potential for snowballing if Java isn't kept at least somewhat refreshed so often. (Aside from generics in 1.5, the language really hasn't seen much change for the everyday programmer pre-1.8.)

With all that said, I think introducing basic functional programming constructs is great progress! Yes, lambdas are just syntactical sugar that compile to anonymous classes; yes, streams can be done via for loops; and yes, none of these things are "new" in a programming language. But the each of these things combine and give way to a paradigm that makes writing such transformation operations significantly less cumbersome. There are many cases where I have averted designing APIs with single-function anonymous classes specifically because they require(d) a stupid amount of boilerplate. I pretty strongly believe that language syntax should not have to be a deciding factor in the development of software, especially if you consider a language as a tool for the programmer to express his/her ideas.

Whenever you think about Java criticism (besides the ridiculously unfounded/antiquated notion of slowness that came out of the ass of the native camp in the 90s), you'll almost always see the boilerplate and language age mentioned. In my experience, those have been some of the largest reasons for new programmers to shy away and toward newer, shinier languages. A new paradigm that simplifies common operations syntactically and semantically is something Java really was in dire need for.
Reply
#7
They are indeed useless. I think they are also pretty confusing and render code as less easy to read.
For example, why use a forloop like this:
Code:
list.forEach(i -> i.invokeMethod());

When you can simply, and more readably do this:

Code:
for(int i : list){
   i.invokeMethod();
}
Reply
#8
(01-08-2015, 08:04 AM)Sex Slave Wrote:  They are indeed useless. I think they are also pretty confusing and render code as less easy to read.
For example, why use a forloop like this:

Code:
list.forEach(i -> i.invokeMethod());

When you can simply, and more readably do this:



Code:
for(int i : list){
  i.invokeMethod();
}

I suggest you look into functional programming languages to see where lambdas come from and why they're so important. Java's lambdas are relatively tame because the language wasn't designed around them from the start. When functions become first class members of a language, the design of everything else starts to shift (toward what has now developed into functional programming).
Reply
#9
(01-05-2015, 07:13 AM)DarkStorm Wrote:  Aside from generics in 1.5, the language really hasn't seen much change for the everyday programmer pre-1.8.

That's because it doesn't need changing.
[Image: 7rL6Nl0.png]
Reply
#10
(01-08-2015, 08:22 PM)zooty Wrote:  
(01-05-2015, 07:13 AM)DarkStorm Wrote:  Aside from generics in 1.5, the language really hasn't seen much change for the everyday programmer pre-1.8.

That's because it doesn't need changing.

My entire point in that post is that it does need changing. Something new to the language every so often will be necessary to keep it from being replaced by newer languages with more features and more succinct syntax. If you take a look at the TIOBE index you can clearly see its decline.
Reply
 


Forum Jump:


Users browsing this thread: 2 Guest(s)

About The Bytecode Club

We're a community focused on Reverse Engineering, we try to target Java/Android but we also include other langauges/platforms. We pride ourselves in supporting and free and open sourced applications.

Website